diff --git a/dev/cnf/gradle/transform/transform.properties b/dev/cnf/gradle/transform/transform.properties index 1644b43fc33..051ac51213b 100644 --- a/dev/cnf/gradle/transform/transform.properties +++ b/dev/cnf/gradle/transform/transform.properties @@ -5,6 +5,7 @@ com.ibm.json4j=Kernel com.ibm.os400.native=Kernel com.ibm.websphere.appserver.api.config=Kernel com.ibm.websphere.appserver.api.hpel=Kernel +com.ibm.websphere.appserver.api.json=KernelTest com.ibm.websphere.appserver.api.kernel.service=Kernel com.ibm.websphere.appserver.kernel-1.0=Kernel com.ibm.websphere.appserver.kernelCore-1.0=Kernel @@ -17,6 +18,7 @@ com.ibm.websphere.appserver.spi.kernel.service=Kernel com.ibm.websphere.appserver.spi.logging=Kernel com.ibm.websphere.appserver.spi.threading=Kernel com.ibm.websphere.appserver.spi.zosCommandProcessing=Kernel +com.ibm.websphere.filetransfer=KernelTest com.ibm.websphere.javaee.jsonp.1.0=Kernel com.ibm.websphere.javaee.servlet.3.0=KernelTest com.ibm.websphere.javaee.servlet.3.1=KernelTest @@ -41,8 +43,11 @@ com.ibm.ws.config.server.schemagen=Kernel com.ibm.ws.config.server.schemagen.serverschemagen=Kernel com.ibm.ws.config.utility=Kernel com.ibm.ws.config.utility.configUtility=Kernel +com.ibm.ws.config.utility_fat=KernelTest com.ibm.ws.config.utility_test=KernelTest com.ibm.ws.config_bvt.parser=KernelTest +com.ibm.ws.config_bvt.schema=KernelTest +com.ibm.ws.config_fat=KernelTest com.ibm.ws.config_test=KernelTest com.ibm.ws.crypto.certificateutil=Kernel com.ibm.ws.crypto.certificateutil_bvt=KernelTest @@ -64,7 +69,9 @@ com.ibm.ws.install.utility.installUtility=Kernel com.ibm.ws.install.ws-cikLauncher=Kernel com.ibm.ws.install_test=KernelTest com.ibm.ws.jmx=Kernel +com.ibm.ws.jmx.connector.client.rest=KernelTest com.ibm.ws.jmx.scripting.client=Kernel +com.ibm.ws.jmx_fat=KernelTest com.ibm.ws.jmx_test=KernelTest com.ibm.ws.kernel.boot=Kernel com.ibm.ws.kernel.boot.archive=Kernel @@ -77,6 +84,7 @@ com.ibm.ws.kernel.boot.nested=Kernel com.ibm.ws.kernel.boot.ws-launch=Kernel com.ibm.ws.kernel.boot.ws-server=Kernel com.ibm.ws.kernel.boot_bvt=KernelTest +com.ibm.ws.kernel.boot_fat=KernelTest com.ibm.ws.kernel.boot_test=KernelTest com.ibm.ws.kernel.cmdline=Kernel com.ibm.ws.kernel.cmdline_test=KernelTest @@ -90,10 +98,12 @@ com.ibm.ws.kernel.feature_bvt=KernelTest com.ibm.ws.kernel.feature_fat=KernelTest com.ibm.ws.kernel.feature_test=KernelTest com.ibm.ws.kernel.filemonitor=Kernel +com.ibm.ws.kernel.filemonitor_fat=KernelTest com.ibm.ws.kernel.filemonitor_test=KernelTest com.ibm.ws.kernel.instrument.agent=Kernel com.ibm.ws.kernel.instrument.check=Kernel com.ibm.ws.kernel.metatype.helper=Kernel +com.ibm.ws.kernel.metatype.helper_fat=KernelTest com.ibm.ws.kernel.metatype.helper_test=KernelTest com.ibm.ws.kernel.security.thread=Kernel com.ibm.ws.kernel.service=Kernel @@ -106,9 +116,11 @@ com.ibm.ws.logging.hpel=Kernel com.ibm.ws.logging.hpel.binarylogviewer=Kernel com.ibm.ws.logging.hpel.osgi=Kernel com.ibm.ws.logging.hpel_bvt=KernelTest +com.ibm.ws.logging.hpel_fat=KernelTest com.ibm.ws.logging.hpel_test=KernelTest com.ibm.ws.logging.osgi=Kernel com.ibm.ws.logging_bvt=KernelTest +com.ibm.ws.logging_fat=KernelTest com.ibm.ws.logging_test=KernelTest com.ibm.ws.org.apache.ant=KernelPrereq com.ibm.ws.org.apache.aries.jmx.api=KernelPrereq @@ -126,40 +138,52 @@ com.ibm.ws.org.eclipse.equinox.coordinator=KernelPrereq com.ibm.ws.org.eclipse.equinox.metatype=KernelPrereq com.ibm.ws.org.eclipse.equinox.region=KernelPrereq com.ibm.ws.org.glassfish.json=KernelPrereq +com.ibm.ws.org.glassfish.json_fat=KernelTest com.ibm.ws.org.objectweb.asm=KernelPrereq com.ibm.ws.org.osgi.annotation.versioning=KernelPrereq com.ibm.ws.org.osgi.service.resolver=KernelTest com.ibm.ws.product.utility=Kernel com.ibm.ws.product.utility.productutil=Kernel com.ibm.ws.product.utility_bvt=KernelTest +com.ibm.ws.product.utility_fat=KernelTest com.ibm.ws.product.utility_test=KernelTest com.ibm.ws.ras.instrument=Kernel com.ibm.ws.repository=Kernel com.ibm.ws.repository.liberty=Kernel com.ibm.ws.repository.resolver=Kernel +com.ibm.ws.repository.resolver_fat=KernelTest com.ibm.ws.repository.resolver_test=KernelTest +com.ibm.ws.repository.test.utils=KernelTest +com.ibm.ws.repository.test.utils_test=KernelTest com.ibm.ws.runtime.update=Kernel com.ibm.ws.runtime.update_bvt=KernelTest +com.ibm.ws.runtime.update_fat=KernelTest com.ibm.ws.runtime.update_test=KernelTest com.ibm.ws.security.thread.zos.hooks=Kernel com.ibm.ws.security.utility=Kernel com.ibm.ws.security.utility.securityutil=Kernel com.ibm.ws.security.utility_bvt=KernelTest +com.ibm.ws.security.utility_fat=KernelTest com.ibm.ws.security.utility_test=KernelTest com.ibm.ws.threading=Kernel com.ibm.ws.threading_bvt=KernelTest +com.ibm.ws.threading_fat=KernelTest com.ibm.ws.threading_test=KernelTest com.ibm.ws.timer=KernelTest com.ibm.ws.transport.http=KernelTest com.ibm.ws.zos.channel.console=Kernel com.ibm.ws.zos.command.processing=Kernel com.ibm.ws.zos.command.processing_test=KernelTest +com.ibm.ws.zos.command.processing_zfat=KernelTest +com.ibm.ws.zos.command.processing_ztest=KernelTest com.ibm.ws.zos.core=Kernel com.ibm.ws.zos.core_test=KernelTest com.ibm.ws.zos.diagnostics=Kernel com.ibm.ws.zos.diagnostics_test=KernelTest com.ibm.ws.zos.logging=Kernel com.ibm.ws.zos.logging_test=KernelTest +com.ibm.ws.zos.logging_zfat=KernelTest +com.ibm.ws.zos.logging_ztest=KernelTest com.ibm.wsspi.org.osgi.core=KernelPrereq com.ibm.wsspi.org.osgi.namespace.service=KernelPrereq com.ibm.wsspi.org.osgi.service.cm=KernelPrereq @@ -180,4 +204,5 @@ prereq.java.1.7=KernelPrereq prereq.java.1.8=KernelPrereq prereq.java.tools=KernelPrereq wlp.lib.extract=Kernel +wlp.lib.extract_fat=KernelTest wlp.lib.extract_test=KernelTest diff --git a/dev/com.ibm.websphere.appserver.api.json/.classpath b/dev/com.ibm.websphere.appserver.api.json/.classpath new file mode 100644 index 00000000000..bd52baaf243 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.api.json/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.websphere.appserver.api.json/.gitignore b/dev/com.ibm.websphere.appserver.api.json/.gitignore new file mode 100644 index 00000000000..05ee82b1e37 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.api.json/.gitignore @@ -0,0 +1,3 @@ +/bin/ +/build/ +/generated/ diff --git a/dev/com.ibm.websphere.appserver.api.json/.project b/dev/com.ibm.websphere.appserver.api.json/.project new file mode 100644 index 00000000000..93a49f1138b --- /dev/null +++ b/dev/com.ibm.websphere.appserver.api.json/.project @@ -0,0 +1,23 @@ + + + com.ibm.websphere.appserver.api.json + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.websphere.appserver.api.json/bnd.bnd b/dev/com.ibm.websphere.appserver.api.json/bnd.bnd new file mode 100644 index 00000000000..41f99c8f9b5 --- /dev/null +++ b/dev/com.ibm.websphere.appserver.api.json/bnd.bnd @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion: 1.0 + +Bundle-Name: WebSphere JSON API +Bundle-Description: WebSphere JSON API, version ${bVersion} +Bundle-SymbolicName: com.ibm.websphere.appserver.api.json + +Export-Package: com.ibm.json.java,com.ibm.json.xml + +Import-Package: com.ibm.json.java,com.ibm.json.xml + +-includeresource: {META-INF/maven/com.ibm.websphere.appserver.api/com.ibm.websphere.appserver.api.json/pom.xml=com.ibm.websphere.appserver.api.json.pom} + +publish.wlp.jar.suffix: dev/api/ibm + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + com.ibm.json4j;version=latest diff --git a/dev/com.ibm.websphere.appserver.api.json/build.gradle b/dev/com.ibm.websphere.appserver.api.json/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.websphere.appserver.api.json/com.ibm.websphere.appserver.api.json.pom b/dev/com.ibm.websphere.appserver.api.json/com.ibm.websphere.appserver.api.json.pom new file mode 100644 index 00000000000..3d8e15485db --- /dev/null +++ b/dev/com.ibm.websphere.appserver.api.json/com.ibm.websphere.appserver.api.json.pom @@ -0,0 +1,26 @@ + + + + + + + IBM International License Agreement for Non-Warranted Programs + http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/licenses/L-JTHS-8SZMHX/HTML/ + repo + Additional notices http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/licenses/L-JTHS-8SZMHX/HTML/notices.html + + + + 4.0.0 + com.ibm.websphere.appserver.api + com.ibm.websphere.appserver.api.json + ${bFullVersion} + WebSphere JSON API + WebSphere JSON API, version 1.0 + diff --git a/dev/com.ibm.websphere.filetransfer/.classpath b/dev/com.ibm.websphere.filetransfer/.classpath new file mode 100755 index 00000000000..2876090f903 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.websphere.filetransfer/.classpath.gradle b/dev/com.ibm.websphere.filetransfer/.classpath.gradle new file mode 100644 index 00000000000..2876090f903 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.websphere.filetransfer/.gitignore b/dev/com.ibm.websphere.filetransfer/.gitignore new file mode 100644 index 00000000000..57b341172a1 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/generated/ diff --git a/dev/com.ibm.websphere.filetransfer/.project b/dev/com.ibm.websphere.filetransfer/.project new file mode 100755 index 00000000000..d0435f4bb97 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.project @@ -0,0 +1,23 @@ + + + com.ibm.websphere.filetransfer + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..845c3083c7d --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +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.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c874b581698 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.websphere.filetransfer/.settings/org.sonar.ide.eclipse.core.prefs b/dev/com.ibm.websphere.filetransfer/.settings/org.sonar.ide.eclipse.core.prefs new file mode 100755 index 00000000000..e0b979e14e4 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/.settings/org.sonar.ide.eclipse.core.prefs @@ -0,0 +1,7 @@ +analyseLocally=false +eclipse.preferences.version=1 +extraProperties= +lastAnalysisDate=1366911191199 +projectKey=Liberty-8.5.5\:com.ibm.websphere.filetransfer +serverUrl=http\://szeged.hursley.ibm.com\:8080/sonar +version=2 diff --git a/dev/com.ibm.websphere.filetransfer/README.txt b/dev/com.ibm.websphere.filetransfer/README.txt new file mode 100755 index 00000000000..9cd48f08a57 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/README.txt @@ -0,0 +1,5 @@ +Last update: 2013/08/13 + +This project (com.ibm.websphere.filetransfer) is intended to encapsulate all of +the public API and SPI related to file transfer support. Do not add non-public +interfaces to this project. diff --git a/dev/com.ibm.websphere.filetransfer/bnd.bnd b/dev/com.ibm.websphere.filetransfer/bnd.bnd new file mode 100755 index 00000000000..c5c4404d0cf --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: WebSphere File Services APIs +Bundle-SymbolicName: com.ibm.websphere.filetransfer +Bundle-Description: APIs for WebSphere File Services; version=${bVersion} +Bundle-ActivationPolicy: lazy + +Export-Package: com.ibm.websphere.filetransfer + +instrument.disabled: true + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + com.ibm.ws.org.osgi.annotation.versioning.1.0.0;version=latest diff --git a/dev/com.ibm.websphere.filetransfer/build.gradle b/dev/com.ibm.websphere.filetransfer/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.websphere.filetransfer/build.xml b/dev/com.ibm.websphere.filetransfer/build.xml new file mode 100755 index 00000000000..511276204f2 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/build.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.websphere.filetransfer/findbugs.exclude.xml b/dev/com.ibm.websphere.filetransfer/findbugs.exclude.xml new file mode 100755 index 00000000000..1cf8902cff2 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/findbugs.exclude.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileServiceMXBean.java b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileServiceMXBean.java new file mode 100755 index 00000000000..acf390bfa21 --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileServiceMXBean.java @@ -0,0 +1,231 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.filetransfer; + +import java.beans.ConstructorProperties; +import java.util.Date; +import java.util.List; + +/** + * This MBean provides file service operations on the host system on which + * the server resides. + *

+ * The ObjectName for this MBean is {@value #OBJECT_NAME}. + *

+ * All paths are implicitly remote, as the operations performed by this MBean + * occur on the host which the server resides. All paths are required to be + * absolute, either explicitly or rooted with a WebSphere variable such as + * ${wlp.install.dir}. + * + * @ibm-api + */ +public interface FileServiceMXBean { + + /** + * A String representing the {@link javax.management.ObjectName} that this MXBean maps to. + */ + String OBJECT_NAME = "WebSphere:feature=restConnector,type=FileService,name=FileService"; + + /** + * Option indicating all available keys should be used for the query. + */ + String REQUEST_OPTIONS_ALL = "a"; + + /** + * Option indicating that "isDirectory" key should be used for the query. + */ + String REQUEST_OPTIONS_IS_DIRECTORY = "d"; + + /** + * Option indicating that "isReadOnly" key should be used for the query. + */ + String REQUEST_OPTIONS_READ_ONLY = "r"; + + /** + * Option indicating that "size" key should be used for the query. + */ + String REQUEST_OPTIONS_SIZE = "s"; + + /** + * Option indicating that "lastModified" key should be used for the query. + */ + String REQUEST_OPTIONS_LAST_MODIFIED = "t"; + + /** + * The name of the attribute representing the list of read locations. + */ + String ATTRIBUTE_NAME_READ_LIST = "ReadList"; + + /** + * The name of the attribute representing the list of write locations. + */ + String ATTRIBUTE_NAME_WRITE_LIST = "WriteList"; + + /** + * Get the configured list of read-accessible locations on the host where + * this server resides. This list is configurable for each server by + * modifying the server.xml. Each directory to allow for read access can + * be specified to the <remoteFileAccess> configuration element + * 'readDir' attribute. + *

+ * For example: + *
+ *

+     * <remoteFileAccess>
+     *     <readDir>$ server.output.dir}/payloads</readDir>
+     * </remoteFileAccess>
+     * 
+ *

+ * The default is an empty list. + * + * @return a list of Strings containing the absolute paths which are read-accessible. + */ + List getReadList(); + + /** + * Get the configured list of write-accessible locations on the host where + * this server resides. This list is configurable for each server by + * modifying the server.xml. Each direcoty to allow for write access can + * be specified to the <remoteFileAccess> configuration element + * 'writeDir' attribute. + *

+ * For example: + *
+ *

+     * <remoteFileAccess>
+     *     <writeDir>${server.output.dir}/target</writeDir>
+     * </remoteFileAccess>
+     * 
+ *

+ * The default is a list containing 3 entries: ${wlp.install.dir}, + * ${wlp.user.dir} and ${server.output.dir}. + * + * @return a list of Strings containing the absolute paths which are write-accessible. + */ + List getWriteList(); + + /** + * Get the metadata pertaining to the specified path. The result object + * will contain the requested metadata subset as indicated by the + * requestOptions String value, which should be constructed as a + * concatenation of the desired values. + *

+ * For example: to obtain a request that provides only the "size" and + * "lastModified" metadata values, the user can pass in "st" as the + * requestOptions field. + * + * @param path the absolute path of the file or directory for which to retrieve the metadata + * @param requestOptions a String representing the concatenation of the requested metadata keys. See REQUEST_OPTIONS_* fields. + * @return a CompositeData containing the requested metadata + */ + MetaData getMetaData(String path, String requestOptions); + + /** + * List the directory/files for the given path. + * + * @param directory the absolute path of the directory to list + * @param recursive a boolean to specify if the search should be done to all descendant paths + * @param requestOptions a String representing the concatenation of the requested metadata keys + * @return an array of CompositeData, representing the requested metadata for each entry + */ + MetaData[] getDirectoryEntries(String directory, boolean recursive, String requestOptions); + + /** + * Create an archive of the given sourcePath. + *

+ * This operation occurs on the file system on which this server resides. + * Therefore the sourcePath and targetPath are paths on the server's host + * system. + * + * @param sourcePath the absolute path of the entity to archive + * @param targetPath the absolute path to where resulting archive is to be stored + * @return true if archive was successfully created, false otherwise + */ + boolean createArchive(String sourcePath, String targetPath); + + /** + * Expand the archive at the given sourcePath. + *

+ * This operation occurs on the file system on which this server resides. + * Therefore the sourcePath and targetPath are paths on the server's host + * system. + * + * @param sourcePath the absolute path of the archive to be expanded + * @param targetPath the absolute path to where archive is to be expanded + * @return true if archive was successfully expanded, false otherwise + */ + boolean expandArchive(String sourcePath, String targetPath); + + /** + * Return type for the getMetaData and getDirectoryEntries methods. + * + * The JMX framework will convert this to a CompositeData object on the client side. + */ + public class MetaData { + + private final Boolean directory; + private final Boolean readOnly; + private final Date lastModified; + private final Long size; + private final String fileName; + + @ConstructorProperties({ "directory", "lastModified", "size", "readOnly", "fileName" }) + public MetaData(Boolean directory, Date lastModified, Long size, Boolean readOnly, String fileName) { + this.directory = directory; + this.lastModified = (lastModified == null) ? null : (Date) lastModified.clone(); + this.size = size; + this.readOnly = readOnly; + this.fileName = fileName; + } + + /** + * Boolean value indicating whether or not the entity is a directory. + * + * @return {@code true} if the entity is a directory, {@code false} otherwise. + */ + public Boolean getDirectory() { + return this.directory; + } + + /** + * @return Date object representing the time the entity was last modified + */ + public Date getLastModified() { + return (this.lastModified == null) ? null : (Date) this.lastModified.clone(); + } + + /** + * @return Long object indicating the size of the entity. + */ + public Long getSize() { + return this.size; + } + + /** + * Boolean value indicating whether or not the entity is read-only. + * + * @return {@code true} if the entity is read-only, {@code false} otherwise. + */ + public Boolean getReadOnly() { + return this.readOnly; + } + + /** + * @return String value indicating the entity's absolute path. + */ + public String getFileName() { + return this.fileName; + } + + } + +} diff --git a/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileTransferMBean.java b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileTransferMBean.java new file mode 100755 index 00000000000..33b9690890c --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/FileTransferMBean.java @@ -0,0 +1,137 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.filetransfer; + +import java.io.IOException; +import java.util.List; + +/** + * This MBean exposes remote file transfer capabilities and must be accessed + * only within IBM's JMX REST Connector. Accessing this MBean by any + * other means will result in a {@link java.lang.UnsupportedOperationException}. + *

+ * The ObjectName for this MBean is {@value #OBJECT_NAME}. + *

+ * For the remote file parameters (ie: remoteSourceFile for download/delete + * and remoteTargetFile for upload) the following characteristics apply: + *

+ *

+ * For the local file parameters (ie: localTargetFile for download and and + * localSourceFile for upload) the following characteristics apply: + *

+ * + * @ibm-api + */ +public interface FileTransferMBean { + + /** + * A string representing the {@link javax.management.ObjectName} that this MBean maps to. + */ + String OBJECT_NAME = "WebSphere:feature=restConnector,type=FileTransfer,name=FileTransfer"; + + /** + * Download a file from the specified remote source location and write it + * in the specified local target location. + *

+ * Directories are not supported as the remote source file. To download a + * directory, it must first be archived. + * + * @param remoteSourceFile the remote file location of the source to download + * @param localTargetFile the local file location where the source contents will be written + * @throws IOException if there are any issues handling the source or target files + */ + void downloadFile(String remoteSourceFile, String localTargetFile) throws IOException; + + /** + * Download part of a file from the specified remote source location using the specified start and + * end offset byte values and write it in the specified local target location. + *

+ * Directories are not supported as the remote source file. To download a + * directory, it must first be archived. + *

+ * This partial download feature is currently available only in non-routing scenarios. + * + * @param remoteSourceFile the remote file location of the source to download + * @param localTargetFile the local file location where the source contents will be written + * @param startOffset index of the first byte to copy (zero-based and inclusive) + * @param endOffset index of the last byte to copy (zero-based and inclusive). + * Specify -1 to copy until the end of file. + * + * @return Index to use as start offset for next partial file download request. + * If this value is greater than the startOffset value that was passed in, then + * some bytes (equivalent to the difference) were transferred by this download request. + *
+ * Note: It is assumed that in-between the download requests, remote source file is not + * modified in any way except for appending contents to end of the file. + * + * @throws IOException if there are any issues handling the source or target files + */ + long downloadFile(String remoteSourceFile, String localTargetFile, long startOffset, long endOffset) throws IOException; + + /** + * Upload a file from the specified local source location and write it + * in the specified remote target location. + *

+ * This method optionally supports expanding an archive (specified as the local + * source file) to the remote target file. The supported compression + * formats are 'zip' and 'jar' (including war and ear) . All other format types will result in + * undefined behaviour. + *

+ * Directories are not supported as the local source file. To upload a + * directory, it must first be archived and can then be expanded during upload using the expandOnCompletion option. + * This option has a special behaviour: the archive will be uploaded as a regular file to the remote system, and then we + * will make a directory that matches the filename specified by remoteTargetFile, and the contents will be expanded inside that new folder. + * + *

Example: Uploading an archive with remoteTargetFile /home/myFolder/wlp.zip and the expandOnCompletion + * option set to true will upload the archive wlp.zip to the remote file system, create a folder called wlp.zip + * under the directory /home/myFolder, and then expand the contents of the archive inside the folder /home/myFolder/wlp.zip. + * + * If expandOnCompletion flag is false,then remoteTargetFile must match a filename with an extension (unless the file has not extension), and + * cannot be a folder. + * + * + * @param localSourceFile the local path to the file that will be uploaded. + * The source file must be a file, since directories are not supported. + * @param remoteTargetFile the remote path of the uploaded file. + * The target file must be a file, since directories are not supported. + * @param expandOnCompletion indicates if the archive should be expanded automatically after it is uploaded. + * @throws IOException if there are any issues handling the request + */ + void uploadFile(String localSourceFile, String remoteTargetFile, boolean expandOnCompletion) throws IOException; + + /** + * Delete a file located at the remote specified location. + *

+ * Recursive deletion of a directory is not supported, however deletion of + * an empty directory is supported. + * + * @param remoteSourceFile the location of the remote file to be deleted + * @throws IOException if there are any issues handling the request + */ + void deleteFile(String remoteSourceFile) throws IOException; + + /** + * Delete files and folders (empty and non-empty) at the remote specified locations + * + * @param remoteArtifacts list of locations of remote files and folders (empty and non-empty) to delete + * @throws IOException if there are any issues handling the request + */ + void deleteAll(List remoteArtifacts) throws IOException; + +} diff --git a/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/package-info.java b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/package-info.java new file mode 100755 index 00000000000..4b8251a907a --- /dev/null +++ b/dev/com.ibm.websphere.filetransfer/src/com/ibm/websphere/filetransfer/package-info.java @@ -0,0 +1,21 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +/** + * This package is intended to encapsulate the public API and SPI related + * to file transfer. Do not add non-public interfaces to this package. + * + * @version 1.1 + */ +@org.osgi.annotation.versioning.Version("1.1") +package com.ibm.websphere.filetransfer; + diff --git a/dev/com.ibm.ws.config.utility_fat/.classpath b/dev/com.ibm.ws.config.utility_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config.utility_fat/.classpath.gradle b/dev/com.ibm.ws.config.utility_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config.utility_fat/.gitignore b/dev/com.ibm.ws.config.utility_fat/.gitignore new file mode 100644 index 00000000000..27e131e35a6 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.config.utility_fat/.project b/dev/com.ibm.ws.config.utility_fat/.project new file mode 100755 index 00000000000..91eb01d8ee5 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.config.utility_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..f48ecd6cc60 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c92277a371a --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.config.utility_fat/bnd.bnd b/dev/com.ibm.ws.config.utility_fat/bnd.bnd new file mode 100644 index 00000000000..d87d7bffc3b --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.org.apache.commons.io.1.4;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.config.utility;version=latest diff --git a/dev/com.ibm.ws.config.utility_fat/bnd.bnd.gradle b/dev/com.ibm.ws.config.utility_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..d87d7bffc3b --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/bnd.bnd.gradle @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.org.apache.commons.io.1.4;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.config.utility;version=latest diff --git a/dev/com.ibm.ws.config.utility_fat/build-test.xml b/dev/com.ibm.ws.config.utility_fat/build-test.xml new file mode 100755 index 00000000000..e546d657a95 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/build-test.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config.utility_fat/build.gradle b/dev/com.ibm.ws.config.utility_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.config.utility_fat/delivery.sets b/dev/com.ibm.ws.config.utility_fat/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/FATSuite.java b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/FATSuite.java new file mode 100755 index 00000000000..19b0cca3054 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/FATSuite.java @@ -0,0 +1,23 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.utility.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Collection of all FAT tests + */ +@RunWith(Suite.class) +@SuiteClasses({ ServerConfigUtilityFatTesting.class }) +public class FATSuite {} \ No newline at end of file diff --git a/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/ServerConfigUtilityFatTesting.java b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/ServerConfigUtilityFatTesting.java new file mode 100755 index 00000000000..69f63909d74 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/ServerConfigUtilityFatTesting.java @@ -0,0 +1,336 @@ +package com.ibm.ws.config.utility.fat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.util.Properties; + +import org.apache.commons.io.FileUtils; +import org.junit.AfterClass; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; + +public class ServerConfigUtilityFatTesting extends TestRepository { + + private static final Class c = ServerConfigUtilityFatTesting.class; + + static Machine machine; + String installRoot = server.getInstallRoot(); + String controllerPort = System.getProperty("HTTP_default.secure"); + String adminUser = "user001"; + String adminPassword = "pass001"; + String keystorePassword = "passwordKeystore"; + String encodingType = "aes"; + String configFilePath = System.getProperty("user.dir") + System.getProperty("file.separator") + "configFile.txt"; + + private static final String SLASH = System.getProperty("file.separator"); + public static LibertyServer server = TestRepository.server; + + @BeforeClass + public static void setUp() throws Exception { + Assume.assumeTrue(new TestRepository().testRepositoryConnection()); + final String methodName = "setUp"; + Log.entering(c, methodName); + + machine = server.getMachine(); + Log.info(c, methodName, "Starting Server"); + server.startServer(); + + // Wait for the smarter planet message + assertNotNull("The smarter planet message did not get printed", server.waitForStringInLog("CWWKF0011I")); + Log.exiting(c, methodName); + } + + @AfterClass + public static void tearDown() throws Exception { + if (server.isStarted()) { + server.stopServer(); + } + } + + public static String readFile(String path) throws IOException { + return FileUtils.readFileToString(new File(path)).trim(); + } + + @Mode(TestMode.LITE) + @Test + public void testConfigUtilityUseLocalFile() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testConfigUtilityUseLocalFile"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + Log.info(c, methodName, "Running configUtility --useLocalFile"); + Log.info(c, methodName, "Path to --useLocalFile" + p); + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p, + "--VadminUser=" + adminUser, + "--VwritePath=path1", + "--encoding=" + encodingType, + "--key=" + "123", + "--VhttpPort=8081" + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "--useLocalFile result:\n" + po.getStdout()); + assertEquals("ConfigUtility task should complete with return code as 0.", 0, po.getReturnCode()); + + assertTrue("Fail: did not match expected username:", po.getStdout().contains("userName=\"" + adminUser + "\"")); + assertTrue("Fail: did not match expected writePath snippet:path1", po.getStdout().contains("path1")); + assertTrue("Fail: did not match expected httpPort snippet:", po.getStdout().toString().contains("httpPort=\"8081\"")); + + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testConfigUtilityCheckErrorCodes() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testConfigUtilityCheckErrorCodes"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + Log.info(c, methodName, "Running configUtility --useLocalFile"); + Log.info(c, methodName, "Path to --useLocalFile" + p); + + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p + "abc", + "--VadminUser=" + adminUser, + "--VwritePath=path1", + "--encoding=" + encodingType, + "--key=" + "123", + "--VhttpPort=8081" + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "--useLocalFile result:\n" + po.getStdout()); + assertEquals("ConfigUtility task should complete with return code as 255.", 255, po.getReturnCode()); + + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testInvalidValArgsConfigUtility() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testInvalidValArgsConfigUtility"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + Log.info(c, methodName, "Running configUtility --useLocalFile"); + Log.info(c, methodName, "Path to --useLocalFile" + p); + + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p, + "--Vinvalid=" + adminUser, + "--VwritePath=path1", + "--encoding=" + encodingType, + "--key=" + "123", + "--VhttpPort=8081" + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "--useLocalFile result:\n" + po.getStdout()); + assertEquals("ConfigUtility task should complete with return code as 20.", 20, po.getReturnCode()); + + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testEncodingConfigUtilityUseLocalFile() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testEncodingConfigUtilityUseLocalFile"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + Log.info(c, methodName, "Running configUtility --useLocalFile"); + + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p, + "--VadminUser=" + adminUser, + "--VwritePath=" + "path1", + "--VadminPassword=" + adminPassword, + "--VkeystorePassword=" + keystorePassword, + "--encoding=" + encodingType, + "--key=" + "123" + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "ConfigUtility result:\n" + po.getStdout()); + assertEquals("ConfigUtility task should complete with return code as 0.", 0, po.getReturnCode()); + + assertTrue("Fail: did not match expected username:", po.getStdout().contains("userName=\"" + adminUser + "\"")); + assertTrue("Fail: did not match expected writePath snippet:path1", po.getStdout().contains("path1")); + assertFalse("Fail: adminPassword should not match generated password:", + po.getStdout().contains(adminPassword)); + assertTrue("Fail: did not match expected encodingType 'aes':", + po.getStdout().contains("userPassword=\"{aes}")); + + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testDefaultEncodingConfigUtility() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testDefaultEncodingConfigUtility"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + Log.info(c, methodName, "Running configUtility --useLocalFile"); + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p, + "--VadminUser=" + adminUser, + "--VwritePath=" + "path1", + "--VadminPassword=" + adminPassword, + "--VkeystorePassword=" + keystorePassword + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "ConfigUtility result:\n" + po.getStdout()); + assertEquals("ConfigUtility task should complete with return code as 0.", 0, po.getReturnCode()); + + assertTrue("Fail: did not match expected username:", po.getStdout().contains("userName=\"" + adminUser + "\"")); + assertTrue("Fail: did not match expected writePath snippet:path1", po.getStdout().contains("path1")); + assertFalse("Fail: adminPassword should not match generated password:", + po.getStdout().contains(adminPassword)); + assertTrue("Fail: did not match expected encodingType 'xor':userPassword=\"{xor}", + po.getStdout().contains("userPassword=\"{xor}")); + + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testFindAllConfigSnippets() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testFindAllConfigSnippets"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + Log.info(c, methodName, "Running configUtility find"); + + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { "find" }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + + assertFalse("FAIL: configUtility find should return all snippets:", po.getStdout().isEmpty()); + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testFindRelatedConfigSnippets() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testFindRelatedConfigSnippets"; + + Log.entering(c, methodName); + Properties env = new Properties(); + String arg = "security"; + + Log.info(c, methodName, "Running configUtility find " + arg); + + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { "find", arg }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + + assertFalse("FAIL: configUtility info should return snippets related to " + arg, po.getStdout().isEmpty()); + Log.exiting(c, methodName); + } + + @Mode(TestMode.LITE) + @Test + public void testCreateConfigFileSnippets() throws Exception { + Assume.assumeTrue(testRepositoryConnection()); + final String methodName = "testCreateConfigFileSnippets"; + + Log.entering(c, methodName); + Properties env = new Properties(); + + Log.info(c, methodName, "Running configUtility -list"); + Log.info(c, methodName, "Create Config File in " + configFilePath); + String p = server.getServerRoot() + SLASH + "files" + SLASH + "remoteJMXConnection.xml"; + ProgramOutput po = machine.execute(server.getInstallRoot() + "/bin/configUtility", + new String[] { + "install", + "--useLocalFile=" + p, + "--VadminUser=" + adminUser, + "--VwritePath=" + "path1", + "--VadminPassword=" + adminPassword, + "--VkeystorePassword=" + keystorePassword, + "--createConfigFile=" + configFilePath + }, + installRoot, + env); + + Log.info(c, methodName, "Executed configUtility command:" + po.getCommand()); + Log.info(c, methodName, "ConfigFile result:\n" + po.getStdout()); + + File configFile = new File(configFilePath); + assertTrue("The configFile " + configFilePath + " was created.", configFile.exists()); + configFile.deleteOnExit(); + + Log.exiting(c, methodName); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/TestRepository.java b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/TestRepository.java new file mode 100755 index 00000000000..1a8adb15702 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/fat/src/com/ibm/ws/config/utility/fat/TestRepository.java @@ -0,0 +1,72 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.utility.fat; + +import java.io.File; + +import org.junit.Rule; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.connections.liberty.MainRepository; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + * TestRepository makes sure that the connection to the repository is successful + */ +public class TestRepository { + + private static Class logClass = TestRepository.class; + public static boolean connectedToRepo = false; + public static String massiveRepoFile; + private static String repositoryUrl; + public static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.utility.fat"); + + @Rule + public final TestName method = new TestName(); + private static final String SLASH = System.getProperty("file.separator"); + + @SuppressWarnings("deprecation") + public boolean testRepositoryConnection() { + Log.entering(logClass, method.getMethodName()); + try { + massiveRepoFile = server.pathToAutoFVTTestFiles + "massive" + SLASH + "massiveRepoLocation.props"; + + String repositoryDescriptionUrl = new File(massiveRepoFile).getCanonicalFile().toURI().toURL().toString(); + System.setProperty("repository.description.url", repositoryDescriptionUrl); + + RestRepositoryConnection connection = MainRepository.createConnection(); + connectedToRepo = connection.isRepositoryAvailable(); + + if (connectedToRepo) { + Log.info(logClass, method.getMethodName(), "Repository connection is OK."); + } else { + connectedToRepo = false; + Log.info(logClass, method.getMethodName(), "Cannot connect to the test repository: " + repositoryUrl); + } + + } catch (Exception e) { + Log.info(logClass, method.getMethodName(), "Cannot connect to the repository : " + e.getMessage()); + connectedToRepo = false; + } finally { + MainRepository.clearCachedRepoProperties(); + } + + Log.exiting(logClass, method.getMethodName()); + return connectedToRepo; + } + +} diff --git a/dev/com.ibm.ws.config.utility_fat/publish/files/massive/massiveRepoLocation.props b/dev/com.ibm.ws.config.utility_fat/publish/files/massive/massiveRepoLocation.props new file mode 100755 index 00000000000..7ce8be4e822 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/files/massive/massiveRepoLocation.props @@ -0,0 +1,6 @@ +# Details for Test Massive Repo - Toronto Polaris Team + +repository.url=http://ltestl91.hursley.ibm.com:9002/ma/v1 +apiKey=79984835186 +userId=xmlxsltb@ca.ibm.com +password=Polaris2015 \ No newline at end of file diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/bootstrap.properties b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/bootstrap.properties new file mode 100755 index 00000000000..08ade3c8318 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/bootstrap.properties @@ -0,0 +1,8 @@ +com.ibm.ws.logging.trace.specification=*=event=enabled:\ +com.ibm.ws.collective.member.*=all=enabled:\ +com.ibm.ws.collective.repository.*=all=enabled +com.ibm.ws.collective.utility.*=all=enabled +com.ibm.ws.logging.max.file.size=0 +ds.loglevel=debug + +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/ejbSnippet.xml b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/ejbSnippet.xml new file mode 100755 index 00000000000..0d8f77439f6 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/ejbSnippet.xml @@ -0,0 +1,50 @@ + +Downloading the requested config snippet... + +Modifiying the config snippet... + + + + + appSecurity-2.0 + ejbLite-3.1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Please ensure administrative security is configured for the server. diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/remoteJMXConnection.xml b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/remoteJMXConnection.xml new file mode 100755 index 00000000000..a31952449ff --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/remoteJMXConnection.xml @@ -0,0 +1,32 @@ + + + + + + + restConnector-1.0 + + + + + + + + + + + + + + + ${writePath} + ${readPath} + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/resultingSnippet.xml b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/resultingSnippet.xml new file mode 100755 index 00000000000..e94b5be515f --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/files/resultingSnippet.xml @@ -0,0 +1,36 @@ + + + + + + + + restConnector-1.0 + + + + + + + + + + + + + + + ${writePath} + ${readPath} + + + + +Please ensure administrative security is configured for the server. +An administrative user is required to join members to the collective. diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/resources/security/ltpa.keys b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/resources/security/ltpa.keys new file mode 100755 index 00000000000..e0e7d511ac3 --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/resources/security/ltpa.keys @@ -0,0 +1,8 @@ +#Sun Jan 15 15:01:21 CST 2012 +com.ibm.websphere.CreationDate=Sun Jan 15 15\:01\:21 CST 2012 +com.ibm.websphere.CreationHost=localhost +com.ibm.websphere.ltpa.Realm=PreGeneratedLTPAKeys +com.ibm.websphere.ltpa.version=1.0 +com.ibm.websphere.ltpa.3DESKey=xpUAUsH4SZc+VuiAqzL+Tz+MfBmb+6vv3/cGjIn+mR4\= +com.ibm.websphere.ltpa.PublicKey=AMan4Qo5MKIeYf26TJbTZwRdYai7rWRVXDwy/6XI1iq+CVxny1O74rE4cn7wXalID05hKwm/HUxvFd72Y3dABzL1bTUpl1uE6SQNePrcdrQC8rmtichsdvY0baiGYexURYP7fbHF5Z70RfQGCPYnuZTB9jsHdh4HJlrOlsx6K2mJAQAB +com.ibm.websphere.ltpa.PrivateKey=TkjZeR/1L6khA7UKNjBRI1T+nbwEWXv1AWVSOCEgpKfLvw8iAkIc7+8I2zfc3j88XciTxDuagepUDoWCXHJ1ithSptZSLnHBASD7Ki1dLTKY7jszPXmIIwoa8YaQFtuuNeSJ7r6r8krSB5ml5sk7aTF0Sed8TFrx1aDEQRIZCovZV8BQX29bBZC99gTqk3chCpcOVRqcxvQRGzdP0PenvaA9afeflV5t4Iw8errfmHjedNVDog90ZVVAeecO+ZLqn7yAHh98ZTdV9IEVyqnFI7XQljrMJsNt3zl/tB7ktQ6VuyxJmlQdDbmvJ+F6DZeR9lVC991a/Ks0i1VKVOrwhPxJYLX2Xz7MWpLu09pwapo\= diff --git a/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/server.xml b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/server.xml new file mode 100755 index 00000000000..80576a2e13b --- /dev/null +++ b/dev/com.ibm.ws.config.utility_fat/publish/servers/com.ibm.ws.config.utility.fat/server.xml @@ -0,0 +1,9 @@ + + + + + servlet-3.0 + restConnector-1.0 + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/.classpath b/dev/com.ibm.ws.config_bvt.schema/.classpath new file mode 100644 index 00000000000..c8c4cd4a46c --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/.classpath.gradle b/dev/com.ibm.ws.config_bvt.schema/.classpath.gradle new file mode 100644 index 00000000000..c8c4cd4a46c --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/.project b/dev/com.ibm.ws.config_bvt.schema/.project new file mode 100755 index 00000000000..34341dba146 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.config_bvt.schema + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..f48ecd6cc60 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..3d73ed77a17 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,113 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=true +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.config_bvt.schema/bnd.bnd b/dev/com.ibm.ws.config_bvt.schema/bnd.bnd new file mode 100755 index 00000000000..d6ad84f508f --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bnd.bnd @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.filetransfer;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.kernel.service;version=latest, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.config_bvt.schema/bnd.bnd.gradle b/dev/com.ibm.ws.config_bvt.schema/bnd.bnd.gradle new file mode 100755 index 00000000000..d6ad84f508f --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bnd.bnd.gradle @@ -0,0 +1,18 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + bvt/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.filetransfer;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.kernel.service;version=latest, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.config_bvt.schema/build-bvt.xml b/dev/com.ibm.ws.config_bvt.schema/build-bvt.xml new file mode 100755 index 00000000000..cfd95ae8350 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/build-bvt.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/build.gradle b/dev/com.ibm.ws.config_bvt.schema/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle.bnd b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle.bnd new file mode 100755 index 00000000000..6a076d8a1fa --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle.bnd @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion = 1.0 + +Bundle-Name: Schema Generator Servlet +Bundle-SymbolicName: test.server.schema +Bundle-Description: Schema Generator Servlet Bundle, version ${bVersion} + +Service-Component: test.server.schema.servlet; \ + implementation:=test.server.schema.SchemaGeneratorActivator; \ + http=org.osgi.service.http.HttpService; \ + schemaGenerator=com.ibm.websphere.metatype.SchemaGenerator; \ + locationService=com.ibm.wsspi.kernel.service.location.WsLocationAdmin; \ + immediate:=true; \ + properties:="service.vendor=IBM" + +Private-Package: test.server.* + +Import-Package: \ + !*.internal.*, * + +Include-Resource: \ + @junit.jar diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-one.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-one.xml new file mode 100755 index 00000000000..ec9638411f3 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-one.xml @@ -0,0 +1,8 @@ + + + + 192.168.1.1 + 192.168.1.2 + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-two.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-two.xml new file mode 100755 index 00000000000..ac83f85b806 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/factory-two.xml @@ -0,0 +1,7 @@ + + + + localhost + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/singleton.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/singleton.xml new file mode 100755 index 00000000000..aa6de86a06b --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/config/singleton.xml @@ -0,0 +1,8 @@ + + + + 192.168.1.1 + 192.168.1.2 + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-attributecopy.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-attributecopy.xml new file mode 100755 index 00000000000..814ccb257f1 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-attributecopy.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-childfirstextends.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-childfirstextends.xml new file mode 100755 index 00000000000..a4eef6a04bd --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-childfirstextends.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-default.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-default.xml new file mode 100755 index 00000000000..4104848f4cd --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-default.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-dynamic.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-dynamic.xml new file mode 100755 index 00000000000..5c3bb23e0e4 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-dynamic.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions-two.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions-two.xml new file mode 100755 index 00000000000..fb6ec51a0f7 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions-two.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions.xml new file mode 100755 index 00000000000..3c8cd56a279 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-extensions.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-hidden.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-hidden.xml new file mode 100755 index 00000000000..dc9cba68f5c --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-hidden.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-defaults.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-defaults.xml new file mode 100755 index 00000000000..3517b65d8f2 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-defaults.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-merge.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-merge.xml new file mode 100755 index 00000000000..45191d7342d --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-merge.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-two.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-two.xml new file mode 100755 index 00000000000..298392be79b --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested-two.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested.xml new file mode 100755 index 00000000000..2517e32e3e4 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-nested.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-reference.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-reference.xml new file mode 100755 index 00000000000..822bc5c71ad --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-reference.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-serviceobjectclass.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-serviceobjectclass.xml new file mode 100755 index 00000000000..eb51e264151 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-serviceobjectclass.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-variable.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-variable.xml new file mode 100755 index 00000000000..df6523ed86a --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype-variable.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype.xml b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype.xml new file mode 100755 index 00000000000..8221cb375f0 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/resources/metatype.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseHttpTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseHttpTest.java new file mode 100755 index 00000000000..7d0c513401b --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseHttpTest.java @@ -0,0 +1,62 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server; + +import java.util.Dictionary; +import java.util.HashSet; +import java.util.Set; + +import javax.servlet.Servlet; +import javax.servlet.ServletException; + +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.http.HttpContext; +import org.osgi.service.http.HttpService; +import org.osgi.service.http.NamespaceException; + +@Component +public abstract class BaseHttpTest { + + protected volatile HttpService http = null; + private final Set registrations = new HashSet(); + + protected void activate(ComponentContext context) throws Exception {} + + protected void deactivate(ComponentContext context) { + for (String alias : registrations) { + http.unregister(alias); + } + http = null; + } + + protected void registerServlet(String alias, Servlet servlet, Dictionary initParams, HttpContext context) throws ServletException, NamespaceException { + if (http == null) { + throw new NullPointerException("Http service is not present"); + } + http.registerServlet(alias, servlet, initParams, context); + registrations.add(alias); + } + + @Reference(name = "http", service = HttpService.class) + protected void setHttp(HttpService ref) { + this.http = ref; + } + + protected void unsetHttp(HttpService ref) { + if (ref == this.http) { + this.http = null; + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTest.java new file mode 100755 index 00000000000..94e1f52e156 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTest.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server; + +public abstract class BaseTest { + + public static final long TIMEOUT = 30 * 1000; + + protected String name; + + public BaseTest(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public abstract String[] getServiceClasses(); + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTestRunner.java new file mode 100755 index 00000000000..a753213ba9d --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/BaseTestRunner.java @@ -0,0 +1,166 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server; + +import static org.junit.Assert.fail; + +import java.io.BufferedWriter; +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.Hashtable; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Reference; + +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; +import com.ibm.wsspi.kernel.service.location.WsResource; + +import test.server.config.dynamic.ConfigWriter; + +public abstract class BaseTestRunner extends BaseHttpTest { + + protected BundleContext bundleContext; + protected WsLocationAdmin locationService; + protected ConfigurationAdmin configAdmin; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + + bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + } + + protected void addTest(BaseTest test) { + Dictionary properties = new Hashtable(); + properties.put(Constants.SERVICE_PID, test.getName()); + bundleContext.registerService(test.getServiceClasses(), test, properties); + } + + @Reference(name = "locationService", service = WsLocationAdmin.class) + protected void setLocationService(WsLocationAdmin ref) { + this.locationService = ref; + } + + protected void unsetLocationService(WsLocationAdmin ref) { + if (ref == this.locationService) { + this.locationService = null; + } + } + + private WsResource getConfigRoot() { + return locationService.resolveResource("${server.config.dir}/server.xml"); + } + + protected ConfigWriter readConfiguration() throws Exception { + InputStream in = getConfigRoot().get(); + try { + return new ConfigWriter(in); + } finally { + close(in); + } + } + + protected void writeConfiguration(ConfigWriter configWriter) throws Exception { + // try to write the entire config in one step (or least possible) + OutputStreamWriter os = new OutputStreamWriter(getConfigRoot().putStream(), "UTF-8"); + BufferedWriter writer = new BufferedWriter(os, 25 * 1024); + try { + configWriter.write(writer); + } finally { + close(writer); + } + StringWriter sw = new StringWriter(); + configWriter.write(sw); + System.out.println(sw.toString()); + } + + public static void dictionaryEquals(Dictionary one, Dictionary two) { + if (one.size() != two.size()) { + fail("Dictionaries are not the same: " + one + " " + two); + } + Enumeration e = one.keys(); + while (e.hasMoreElements()) { + Object key = e.nextElement(); + Object value1 = one.get(key); + Object value2 = two.get(key); + if (value1 instanceof String[] && value2 instanceof String[]) { + value1 = Arrays.asList((String[]) value1); + value2 = Arrays.asList((String[]) value2); + } + if (!value1.equals(value2)) { + fail("Dictionaries are not the same: " + key + " " + value1 + " " + value2); + } + } + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + public class TestDynamicConfigServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest rq, HttpServletResponse rsp) throws IOException { + PrintWriter pw = rsp.getWriter(); + rsp.setContentType("text/plain"); + + String testName = rq.getParameter("testName"); + + try { + log("Begin test: " + testName); + invokeTest(testName); + pw.println("OK"); + } catch (NoSuchMethodException e) { + pw.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + pw.println("FAILED"); + e.getTargetException().printStackTrace(pw); + } catch (Throwable e) { + pw.println("FAILED"); + e.printStackTrace(pw); + } finally { + log("End test: " + testName); + } + } + + } + + public static void close(Closeable closeable) { + if (closeable != null) { + try { + closeable.close(); + } catch (IOException ignore) { + } + } + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationAdminTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationAdminTest.java new file mode 100755 index 00000000000..79161e62be3 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationAdminTest.java @@ -0,0 +1,79 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import java.util.Dictionary; +import java.util.Hashtable; + +import junit.framework.Assert; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * + */ +public class ConfigurationAdminTest extends Test { + private final ConfigurationAdmin configAdmin; + + public ConfigurationAdminTest(String name, ConfigurationAdmin ca) { + super(name, 0); + this.configAdmin = ca; + } + + public void testConfigurationAdmin() throws Exception { + String myPID = "my.test.pid"; + Configuration cfg = configAdmin.createFactoryConfiguration(myPID); + Dictionary props = new Hashtable(); + props.put("a", "a"); +// props.put("A", "a"); + cfg.update(props); + + Configuration caCfg = configAdmin.getConfiguration(cfg.getPid()); + Dictionary caProps = caCfg.getProperties(); + + // check # of elements + Assert.assertNotNull("missing key a", caProps.remove("a")); + Object o = caProps.remove("A"); + Assert.assertNull("has key A: " + o, o); + + // update dictionary make sure its copied + props.put("b", "b"); + Assert.assertNull("b is present", caProps.get("b")); + + caProps.put("c", "c"); + Dictionary caProps2 = caCfg.getProperties(); + Assert.assertNull("c is present", caProps2.get("c")); + + caCfg.update(caProps); + Assert.assertNull("c is present", caProps2.get("c")); + + caProps2 = caCfg.getProperties(); + Assert.assertNotNull("c is not present", caProps2.get("C")); + } + + @Override + public String[] getServiceClasses() { + return null; + } + + @Override + public Throwable getException() { + try { + testConfigurationAdmin(); + } catch (Throwable t) { + exception = t; + } + + return exception; + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationPluginTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationPluginTest.java new file mode 100755 index 00000000000..ad92d4dd101 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ConfigurationPluginTest.java @@ -0,0 +1,59 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import java.util.Dictionary; + +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ConfigurationPlugin; + +public class ConfigurationPluginTest extends ManagedFactoryTest implements ConfigurationPlugin { + + /** */ + private static final String VALUE = "VALUE"; + /** */ + private static final String NEW_KEY = "NEW_KEY"; + /** */ + private static final String INJECT = "inject"; + + public ConfigurationPluginTest(String name) { + super(name, 2); + } + + @Override + public String[] getServiceClasses() { + String[] baseServices = super.getServiceClasses(); + String[] services = new String[baseServices.length + 1]; + services[0] = ConfigurationPlugin.class.getName(); + System.arraycopy(baseServices, 0, services, 1, baseServices.length); + return services; + } + + @Override + public void configurationUpdated(String pid, Dictionary props) throws ConfigurationException { + if (Boolean.TRUE.equals(props.get(INJECT))) { + if (!props.get(NEW_KEY).equals(VALUE)) { + throw new ConfigurationException(NEW_KEY, "Missing " + VALUE); + } + } + } + + @Override + public void modifyConfiguration(ServiceReference ref, Dictionary props) { + if (name.equals(ref.getProperty(Constants.SERVICE_PID)) && Boolean.TRUE.equals(props.get(INJECT))) { + props.put(NEW_KEY, VALUE); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryAliasTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryAliasTest.java new file mode 100755 index 00000000000..2967607e157 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryAliasTest.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class FactoryAliasTest extends ManagedFactoryTest { + + public FactoryAliasTest(String name, int count) { + super(name, count); + } + + @Override + public void configurationUpdated(String pid, Dictionary properties) throws ConfigurationException { + String id = (String) properties.get("id"); + + assertEquals("kids", new Integer(3), properties.get("kids")); + + if ("simpsons".equals(id)) { + assertEquals("lastName", "Simpson", properties.get("lastName")); + assertEquals("firstName", "Homer", properties.get("firstName")); + assertEquals("fullName", "Homer Simpson", properties.get("fullName")); + } else if ("griffins".equals(id)) { + assertEquals("lastName", "Griffin", properties.get("lastName")); + assertEquals("firstName", "Peter", properties.get("firstName")); + assertEquals("fullName", "Peter Griffin", properties.get("fullName")); + } else { + throw new RuntimeException("Invalid instance id: " + id); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryMetaTypeTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryMetaTypeTest.java new file mode 100755 index 00000000000..86fa93a8d0d --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactoryMetaTypeTest.java @@ -0,0 +1,49 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Dictionary; +import java.util.Vector; + +import org.osgi.service.cm.ConfigurationException; + +public class FactoryMetaTypeTest extends ManagedFactoryTest { + + public FactoryMetaTypeTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(String pid, Dictionary properties) throws ConfigurationException { + String id = (String) properties.get("id"); + if ("FamilyGuy".equals(id)) { + // picked up directly from metatype + assertEquals("present", Boolean.TRUE, properties.get("present")); + assertArrayEquals("int array", new int[] { 1, 2, 3 }, (int[]) properties.get("intColl")); + assertEquals("long vector", new Vector(Arrays.asList(4l, 5l, 6l, 7l)), properties.get("longColl")); + + // from metatype + assertEquals("lastname", "Griffin", properties.get("lastname")); + assertEquals("spouse", "Lois Griffin", properties.get("spouse")); + + // from server config + assertArrayEquals("children", new String[] { "Meg Griffin", "Chris Griffin" }, (String[]) properties.get("children")); + } else { + throw new RuntimeException("Invalid instance id: " + id); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactorySimpleTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactorySimpleTest.java new file mode 100755 index 00000000000..0b003cf92bf --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FactorySimpleTest.java @@ -0,0 +1,38 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class FactorySimpleTest extends ManagedFactoryTest { + + public FactorySimpleTest(String name, int count) { + super(name, count); + } + + @Override + public void configurationUpdated(String pid, Dictionary properties) throws ConfigurationException { + String id = (String) properties.get("id"); + if ("serverInstance".equals(id)) { + assertEquals("simple attr", "foo", properties.get("simpleAttr")); + assertArrayEquals("collection attr", new String[] { "Lisa", "Simpson" }, (String[]) properties.get("collAttr")); + } else { + throw new RuntimeException("Invalid instance id: " + id); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FinalTypeTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FinalTypeTest.java new file mode 100755 index 00000000000..adaf906721a --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/FinalTypeTest.java @@ -0,0 +1,41 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; + +/** + * + */ +public class FinalTypeTest extends ManagedTest { + + /** + * @param name + */ + public FinalTypeTest(String name) { + super(name); + } + + /** {@inheritDoc} */ + @Override + public void configurationUpdated(Dictionary properties) throws Exception { + assertEquals("name", "someName", properties.get("name")); + assertNull("finalField1 should be null but is " + properties.get("finalField1"), properties.get("finalField1")); + String configDir = System.getProperty("user.variable"); + assertEquals("finalField2 should be an expanded variable", configDir, properties.get("finalField2")); + assertEquals("finalField3 should be a default value", "someDefault", properties.get("finalField3")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedFactoryTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedFactoryTest.java new file mode 100755 index 00000000000..327e68eb0af --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedFactoryTest.java @@ -0,0 +1,50 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; + +public abstract class ManagedFactoryTest extends Test implements ManagedServiceFactory { + + public ManagedFactoryTest(String name) { + this(name, 1); + } + + public ManagedFactoryTest(String name, int count) { + super(name, count); + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedServiceFactory.class.getName() }; + } + + @Override + public void updated(String pid, Dictionary properties) throws ConfigurationException { + try { + configurationUpdated(pid, properties); + } catch (Throwable e) { + exception = e; + } finally { + latch.countDown(); + } + } + + public abstract void configurationUpdated(String pid, Dictionary properties) throws Exception; + + @Override + public void deleted(String pid) {} + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedTest.java new file mode 100755 index 00000000000..f4228aa1f45 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/ManagedTest.java @@ -0,0 +1,43 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedService; + +public abstract class ManagedTest extends Test implements ManagedService { + + public ManagedTest(String name) { + super(name); + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedService.class.getName() }; + } + + @Override + public void updated(Dictionary properties) throws ConfigurationException { + try { + configurationUpdated(properties); + } catch (Throwable e) { + exception = e; + } finally { + latch.countDown(); + } + } + + public abstract void configurationUpdated(Dictionary properties) throws Exception; + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigComplexElementTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigComplexElementTest.java new file mode 100755 index 00000000000..c6e485c1ef9 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigComplexElementTest.java @@ -0,0 +1,111 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Map; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * Test a complex config requirement that was requested from the security team + */ +public class NestedConfigComplexElementTest extends ManagedFactoryTest { + + private final ConfigurationAdmin configAdmin; + private final Map realms, ids, passwords, users; + private final String GROUP_ELEM = "group"; + private final String USER_ELEM = "user"; + private final String ID_ATTR = "id"; + private final String PASSWORD_ATTR = "password"; + private final String REALM_ATTR = "realm"; + + /** + * @param name + */ + public NestedConfigComplexElementTest(String name, ConfigurationAdmin configAdmin) { + super(name); + this.configAdmin = configAdmin; + realms = new HashMap(); + ids = new HashMap(); + passwords = new HashMap(); + users = new HashMap(); + init(); + } + + /** + * results data to compare against + */ + private void init() { + realms.put("SampleBasicRealm", null); + ids.put("admin", "SampleBasicRealm"); + ids.put("user1", "SampleBasicRealm"); + ids.put("user2", "SampleBasicRealm"); + ids.put("user3", "SampleBasicRealm"); + ids.put("memberlessGroup", "SampleBasicRealm"); + ids.put("adminGroup", "SampleBasicRealm"); + ids.put("users", "SampleBasicRealm"); + passwords.put("admin", "admin"); + passwords.put("user1", "user1"); + passwords.put("user2", "user2"); + passwords.put("user3", "user3"); + users.put("admin", "SampleBasicRealm"); + users.put("user1", "SampleBasicRealm"); + users.put("user2", "SampleBasicRealm"); + } + + /** {@inheritDoc} */ + @Override + public void configurationUpdated(String pid, Dictionary properties) throws Exception { + String name = (String) properties.get(REALM_ATTR); + assertTrue(realms.containsKey(name)); + String[] userArr = (String[]) properties.get(USER_ELEM); + assertNotNull(userArr); + assertEquals(4, userArr.length); + String[] groupArr = (String[]) properties.get(GROUP_ELEM); + assertNotNull(groupArr); + assertEquals(3, groupArr.length); + + for (int i = 0; i < userArr.length; i++) { + Configuration config = configAdmin.getConfiguration(userArr[i]); + Dictionary prop = config.getProperties(); + String id = (String) prop.get(ID_ATTR); + assertTrue(ids.containsKey(id)); + assertEquals(ids.get(id), name); + String password = (String) prop.get(PASSWORD_ATTR); + assertTrue(passwords.containsKey(password)); + assertEquals(passwords.get(password), id); + } + + for (int i = 0; i < groupArr.length; i++) { + Configuration config = configAdmin.getConfiguration(groupArr[i]); + Dictionary prop = config.getProperties(); + String id = (String) prop.get(ID_ATTR); + assertTrue(ids.containsKey(id)); + assertEquals(ids.get(id), name); + String[] userList = (String[]) prop.get(USER_ELEM); + if (userList != null) { + for (int j = 0; j < userList.length; j++) { + assertTrue(users.containsKey(userList[j])); + assertEquals(users.get(userList[j]), name); + } + } + } + + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigElementTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigElementTest.java new file mode 100755 index 00000000000..7d117125cd9 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedConfigElementTest.java @@ -0,0 +1,144 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Map; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +/** + * + */ +public class NestedConfigElementTest extends ManagedFactoryTest { + + private final ConfigurationAdmin configAdmin; + private final Map apps, hostNames, ports; + + /** + * @param name + */ + public NestedConfigElementTest(String name, ConfigurationAdmin configAdmin) { + super(name); + this.configAdmin = configAdmin; + apps = new HashMap(); + hostNames = new HashMap(); + ports = new HashMap(); + init(); + } + + /** + * results data to compare against + */ + private void init() { + apps.put("fred", null); + apps.put("bob", null); + apps.put("app", null); + hostNames.put("w3.ibm.com", "fred"); + hostNames.put("w3.hursley.ibm.com", "fred"); + hostNames.put("butterfly.torolab.ibm.com", "bob"); + hostNames.put("mallet.torolab.ibm.com", "bob"); + hostNames.put("*", "app"); + hostNames.put("nonexistent", "app"); + ports.put("9084", "app"); + ports.put("9085", "app"); + ports.put("9080", "fred"); + ports.put("9081", "fred"); + ports.put("9082", "bob"); + ports.put("9083", "bob"); + } + + /** {@inheritDoc} */ + @Override + public void configurationUpdated(String pid, Dictionary properties) throws Exception { + String parentPID = (String) properties.get("service.pid"); + assertEquals("Expected top level pid", "test.config.nested.elements", properties.get("service.factoryPid")); + String[] virtualHosts = (String[]) properties.get("testVirtualHost"); + assertNotNull(virtualHosts); + assertEquals("There should be two virtual hosts", 2, virtualHosts.length); + String name = (String) properties.get("name"); + assertTrue(apps.containsKey(name)); + + if ("fred".equals(name)) { + String[] nestedSingleton = (String[]) properties.get("aNestedSingleton"); + Configuration singletonConfig = configAdmin.getConfiguration(nestedSingleton[0]); + assertEquals("Expected pid", "bundletwo.singleton", singletonConfig.getPid()); + Dictionary singletonProps = singletonConfig.getProperties(); + assertEquals("The config.parentPID value should be equal to the parent's service.pid value", parentPID, + singletonProps.get(XMLConfigConstants.CFG_PARENT_PID)); + assertEquals("The displayID should be application[fred]/aNestedSingleton", "application[fred]/aNestedSingleton", + singletonProps.get(XMLConfigConstants.CFG_CONFIG_INSTANCE_DISPLAY_ID)); + assertEquals(1, ((String[]) singletonProps.get("anArray")).length); + + String[] libraries = (String[]) properties.get("library"); + assertNotNull(libraries); + assertEquals(2, libraries.length); + + for (int i = 0; i < libraries.length; i++) { + Configuration config = configAdmin.getConfiguration(libraries[i]); + assertEquals("Expected factoryPid", "test.config.nested.bundletwo", config.getFactoryPid()); + Dictionary prop = config.getProperties(); + assertEquals("The config.parentPID value should be equal to the parent's service.pid value", parentPID, + prop.get(XMLConfigConstants.CFG_PARENT_PID)); + String aString = (String) prop.get("aString"); + String[] anArray = (String[]) prop.get("anArray"); + if ("defaultString".equals(aString)) { + assertEquals(4, anArray.length); + assertEquals("The displayID should be application[fred]/library[default-1]", "application[fred]/library[default-1]", + prop.get(XMLConfigConstants.CFG_CONFIG_INSTANCE_DISPLAY_ID)); + } else if ("notADefault".equals(aString)) { + assertEquals(3, anArray.length); + assertEquals("The displayID should be application[fred]/library[default-0]", "application[fred]/library[default-0]", + prop.get(XMLConfigConstants.CFG_CONFIG_INSTANCE_DISPLAY_ID)); + } else { + fail("Invalid value for attribute aString: " + aString); + } + + } + + for (int i = 0; i < virtualHosts.length; i++) { + Configuration config = configAdmin.getConfiguration(virtualHosts[i]); + assertEquals("Expected factoryPid", "test.config.nested.virtualHost", config.getFactoryPid()); + Dictionary prop = config.getProperties(); + assertEquals("The config.parentPID value should be equal to the parent's service.pid value", parentPID, + prop.get(XMLConfigConstants.CFG_PARENT_PID)); + String[] hostAliases = (String[]) prop.get("testHostAlias"); + assertEquals(1, hostAliases.length); + Configuration aliasConfig = configAdmin.getConfiguration(hostAliases[0]); + assertEquals("Expected factoryPid", "test.host.alias", aliasConfig.getFactoryPid()); + Dictionary aliasProps = aliasConfig.getProperties(); + String[] aliases = (String[]) aliasProps.get("names"); + assertEquals(2, aliases.length); + } + } + for (int i = 0; i < virtualHosts.length; i++) { + Configuration config = configAdmin.getConfiguration(virtualHosts[i]); + Dictionary prop = config.getProperties(); + String host = (String) prop.get("host"); + assertTrue(hostNames.containsKey(host)); + assertEquals(hostNames.get(host), name); + String port = String.valueOf(prop.get("port")); + assertTrue(ports.containsKey(port)); + assertEquals(ports.get(port), name); + } + + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedResultTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedResultTest.java new file mode 100755 index 00000000000..e147e32ad39 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedResultTest.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Dictionary; +import java.util.Map; + +import org.osgi.service.cm.ConfigurationException; + +public class NestedResultTest extends ManagedFactoryTest { + + private Map> expectedProperties; + + public NestedResultTest(String name, int count) { + super(name, count); + } + + public void setExpectedProperties(Map> expectedProperties) { + this.expectedProperties = expectedProperties; + } + + @Override + public void configurationUpdated(String pid, Dictionary properties) throws ConfigurationException { + String name = (String) properties.get("name"); + + Map expectedProps = expectedProperties.get(name); + assertNotNull("Unexpected name: " + name, expectedProps); + for (Map.Entry entry : expectedProps.entrySet()) { + assertEquals("property " + entry.getKey() + " mismatch", entry.getValue(), properties.get(entry.getKey())); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedSingletonTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedSingletonTest.java new file mode 100755 index 00000000000..a5e8eab0354 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/NestedSingletonTest.java @@ -0,0 +1,104 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.cm.ManagedService; + +/** + * Test singleton pids + */ +public class NestedSingletonTest extends ManagedTest { + + private final ConfigurationAdmin configAdmin; + private final String nestedElement; + private Map> expectedProperties; + + public NestedSingletonTest(String name, String nestedElement, ConfigurationAdmin configAdmin) { + super(name); + this.configAdmin = configAdmin; + this.nestedElement = nestedElement; + } + + public void setExpectedProperties(Map> expectedProperties) { + this.expectedProperties = expectedProperties; + } + + public static Map> getExpectedProperties() { + Map map1 = new HashMap(); + map1.put("pass", "9999"); + map1.put("fail", "7777"); + + Map map2 = new HashMap(); + map2.put("pass", "100"); + map2.put("fail", "0"); + + Map> expectedProperties = new HashMap>(); + expectedProperties.put("one", map1); + expectedProperties.put("two", map2); + + return expectedProperties; + } + + public static Map> getMetatypeExpectedProperties() { + Map map1 = new HashMap(); + map1.put("pass", Integer.valueOf(9999)); + map1.put("fail", Integer.valueOf(7777)); + + Map map2 = new HashMap(); + map2.put("pass", Integer.valueOf(100)); + map2.put("fail", Integer.valueOf(0)); + + Map> expectedProperties = new Hashtable>(); + expectedProperties.put("one", map1); + expectedProperties.put("two", map2); + + return expectedProperties; + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedService.class.getName() }; + } + + @Override + public void configurationUpdated(Dictionary properties) throws Exception { + assertEquals("singletonNested1", (properties.get("name"))); + + String[] testResults = (String[]) properties.get(nestedElement); + assertNotNull(testResults); + assertEquals(2, testResults.length); + + Map> expectedProperties = new HashMap>(this.expectedProperties); + for (int i = 0; i < testResults.length; i++) { + Configuration config = configAdmin.getConfiguration(testResults[i]); + Dictionary prop = config.getProperties(); + String innerName = (String) prop.get("name"); + Map expectedProps = expectedProperties.remove(innerName); + assertNotNull("Unexpected name: " + innerName, expectedProps); + for (Map.Entry entry : expectedProps.entrySet()) { + assertEquals("property " + entry.getKey() + " mismatch", entry.getValue(), prop.get(entry.getKey())); + } + } + + assertEquals(0, expectedProperties.size()); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/PasswordTypeTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/PasswordTypeTest.java new file mode 100755 index 00000000000..62606d1c881 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/PasswordTypeTest.java @@ -0,0 +1,83 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import com.ibm.wsspi.kernel.service.utils.SerializableProtectedString; + +/** + * + */ +public class PasswordTypeTest extends ManagedFactoryTest { + + /** + * @param name + */ + public PasswordTypeTest(String name) { + super(name); + } + + /** {@inheritDoc} */ + @Override + public void configurationUpdated(String pid, Dictionary properties) throws Exception { + + String id = (String) properties.get("id"); + + if (id.equals("p1")) { + + // + assertEquals("p1.name", "admin", properties.get("name")); + SerializableProtectedString sps = (SerializableProtectedString) properties.get("password"); + assertEquals("p1.password", "secret,secret", new String(sps.getChars())); + + } else if (id.equals("p2")) { + + // + // Only substitution variables are path-normalized. p2 contains no substitution + // variables, therefore none of the attribute values are path-normalized. + + assertEquals("p2.name", "my//name/", properties.get("name")); + SerializableProtectedString sps = (SerializableProtectedString) properties.get("password"); + assertEquals("p2.password", "secret//secret/", new String(sps.getChars())); + + } else if (id.equals("p3")) { + + // + // p3.name=my//name/ + // p3.password=secret//secret/ + + // p3 contains substitution variables. Substitution variables are path-normalized for all + // attribute types EXCEPT ibm:type="password". This test ensures that the password attribute + // value is not path-normalized. + + // Path-normalization will... + // 1. convert sequences of "//" to just "/" + // 2. strip off any trailing "/" from the value. + + // NOTE: We are (at least temporarily) removing path normalization for variables, so the test below is + // changing to expect that "my//name/" will not be normalized. + assertEquals("p3.name", "my//name/", properties.get("name")); + + // "secret//secret/" ==> "secret//secret/" (no normalization) + SerializableProtectedString sps = (SerializableProtectedString) properties.get("password"); + assertEquals("p2.password", "secret//secret/", new String(sps.getChars())); + + } else { + throw new RuntimeException("Invalid test.config.password instance id: " + id); + } + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SharedAliasTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SharedAliasTest.java new file mode 100755 index 00000000000..565e14bd20f --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SharedAliasTest.java @@ -0,0 +1,39 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class SharedAliasTest extends ManagedTest { + + private final String firstName; + private final String lastName; + + public SharedAliasTest(String name, String firstName, String lastName) { + super(name); + this.firstName = firstName; + this.lastName = lastName; + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + assertEquals("kids", "5", properties.get("kids")); + assertEquals("lastName", lastName, properties.get("lastName")); + assertEquals("firstName", firstName, properties.get("firstName")); + assertEquals("fullName", firstName + " " + lastName, properties.get("fullName")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonAliasTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonAliasTest.java new file mode 100755 index 00000000000..c400a17442a --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonAliasTest.java @@ -0,0 +1,35 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class SingletonAliasTest extends ManagedTest { + + public SingletonAliasTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + assertEquals("kids", new Integer(2), properties.get("kids")); + assertEquals("lastName", "Smith", properties.get("lastName")); + assertEquals("firstName", "Stan", properties.get("firstName")); + assertEquals("fullName", "Stan Smith", properties.get("fullName")); + assertEquals("others", "Roger Smith, Klaus Smith", properties.get("others")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonMetaTypeTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonMetaTypeTest.java new file mode 100755 index 00000000000..c3bf255ee7f --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonMetaTypeTest.java @@ -0,0 +1,40 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Dictionary; +import java.util.Vector; + +import org.osgi.service.cm.ConfigurationException; + +public class SingletonMetaTypeTest extends ManagedTest { + + public SingletonMetaTypeTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + // all picked up directly from metatype + assertEquals("present", Boolean.TRUE, properties.get("present")); + assertArrayEquals("int array", new int[] { 1, 2, 3 }, (int[]) properties.get("intColl")); + assertEquals("long vector", new Vector(Arrays.asList(4l, 5l, 6l, 7l)), properties.get("longColl")); + + assertEquals("lastname", "Simpson", properties.get("lastname")); + assertEquals("spouse", "Marge Simpson", properties.get("spouse")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerMetaTypeTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerMetaTypeTest.java new file mode 100755 index 00000000000..726c6c4b9ed --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerMetaTypeTest.java @@ -0,0 +1,44 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Dictionary; +import java.util.Vector; + +import org.osgi.service.cm.ConfigurationException; + +public class SingletonServerMetaTypeTest extends ManagedTest { + + public SingletonServerMetaTypeTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + // picked up directly from metatype + assertEquals("present", Boolean.TRUE, properties.get("present")); + assertArrayEquals("int array", new int[] { 1, 2, 3 }, (int[]) properties.get("intColl")); + assertEquals("long vector", new Vector(Arrays.asList(4l, 5l, 6l, 7l)), properties.get("longColl")); + + // from metatype + assertEquals("lastname", "Doe", properties.get("lastname")); + assertEquals("spouse", "Marge Doe", properties.get("spouse")); + + // from server config + assertArrayEquals("children", new String[] { "Jon Doe", "Jane Doe" }, (String[]) properties.get("children")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerTest.java new file mode 100755 index 00000000000..549e622ce1a --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/SingletonServerTest.java @@ -0,0 +1,33 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class SingletonServerTest extends ManagedTest { + + public SingletonServerTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + assertEquals("simple attr", "abc", properties.get("simpleAttr")); + assertArrayEquals("collection attr", new String[] { "a", "b", "c" }, (String[]) properties.get("collAttr")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/Test.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/Test.java new file mode 100755 index 00000000000..c69c0fe48be --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/Test.java @@ -0,0 +1,44 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import test.server.BaseTest; + +public abstract class Test extends BaseTest { + + protected CountDownLatch latch; + protected Throwable exception; + + public Test(String name) { + this(name, 1); + } + + public Test(String name, int count) { + super(name); + this.latch = new CountDownLatch(count); + } + + public Throwable getException() { + try { + if (!latch.await(10, TimeUnit.SECONDS)) { + return new RuntimeException("Timed out"); + } + } catch (InterruptedException e) { + return new RuntimeException("Interrupted"); + } + return exception; + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/TestRunner.java new file mode 100755 index 00000000000..e889b18a9c1 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/TestRunner.java @@ -0,0 +1,119 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseHttpTest; + +public class TestRunner extends BaseHttpTest { + + private BundleContext bundleContext; + private final List tests = new ArrayList(); + + @Override + protected void activate(ComponentContext componentContext) throws Exception { + super.activate(componentContext); + + bundleContext = componentContext.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + ConfigurationAdmin configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + + addTest(new SingletonServerTest("test.config.singleton.server")); + addTest(new SingletonServerMetaTypeTest("test.config.singleton.server.metatype")); + addTest(new SingletonMetaTypeTest("test.config.singleton.metatype")); + + addTest(new FactorySimpleTest("test.config.factory.simple", 1)); + addTest(new FactoryMetaTypeTest("test.config.factory.metatype")); + + addTest(new VariableTest("test.config.variable")); + + addTest(new SingletonAliasTest("test.config.singleton.alias")); + addTest(new FactoryAliasTest("test.config.factory.alias", 2)); + + addTest(new SharedAliasTest("test.config.simpsons.alias", "Homer", "Simpson")); + addTest(new SharedAliasTest("test.config.griffins.alias", "Peter", "Griffin")); + + addTest(new NestedConfigElementTest("test.config.nested.elements", configAdmin)); + addTest(new NestedConfigComplexElementTest("test.config.complex.nested.elements", configAdmin)); + + addTest(new PasswordTypeTest("test.config.password")); + + addTest(new FinalTypeTest("test.config.final")); + + NestedSingletonTest nestedSingletonTest = new NestedSingletonTest("test.config.nested.managed", "test.config.nested.result", configAdmin); + nestedSingletonTest.setExpectedProperties(NestedSingletonTest.getExpectedProperties()); + addTest(nestedSingletonTest); + + NestedResultTest nestedResultTest = new NestedResultTest("test.config.nested.result.metatype", 2); + nestedResultTest.setExpectedProperties(NestedSingletonTest.getMetatypeExpectedProperties()); + + addTest(nestedResultTest); + + tests.add(new ConfigurationAdminTest("test.config.configAdmin", configAdmin)); + + addTest(new ConfigurationPluginTest("test.config.plugin")); + + registerServlet("/parser-test", new TestVerifierServlet(), null, null); + + System.out.println("Parser test servlet started"); + } + + private void addTest(Test test) { + Hashtable properties = new Hashtable(); + properties.put(Constants.SERVICE_PID, test.getName()); + tests.add(test); + bundleContext.registerService(test.getServiceClasses(), test, properties); + } + + class TestVerifierServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest rq, HttpServletResponse rsp) throws IOException { + int failedCount = 0; + boolean failed = false; + for (Test test : tests) { + Throwable t = test.getException(); + if (t != null) { + failed = true; + System.out.println("Test " + test.getName() + " failed:"); + t.printStackTrace(); + failedCount++; + } + } + PrintWriter pw = rsp.getWriter(); + rsp.setContentType("text/plain"); + if (failed) { + pw.println(failedCount + " of " + tests.size() + " tests " + "FAILED, check messages.log for information"); + } else { + pw.println("OK"); + } + } + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/VariableTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/VariableTest.java new file mode 100755 index 00000000000..a53cc62a741 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/VariableTest.java @@ -0,0 +1,37 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.cm.ConfigurationException; + +public class VariableTest extends ManagedTest { + + public VariableTest(String name) { + super(name); + } + + @Override + public void configurationUpdated(Dictionary properties) throws ConfigurationException { + assertEquals("lastname", "Potter", properties.get("lastname")); + assertEquals("name", "Harry Potter", properties.get("name")); + assertArrayEquals("names", new String[] { "Lisa Griffin", "Lois Griffin" }, (String[]) properties.get("names")); + assertEquals("testVariable should be the variable defined in bootstrap", "variableFromBootstrap", properties.get("testVariable")); + assertEquals("testVarNotExist should use the default from the metatype", "defaultFromMetaType", properties.get("testVarNotExist")); + assertEquals("testToken should use the default from the metatype", "default value", properties.get("testToken")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/defaults/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/defaults/TestRunner.java new file mode 100755 index 00000000000..14acf46a664 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/defaults/TestRunner.java @@ -0,0 +1,106 @@ +/* +IBM Confidential + * +OCO Source Materials + * +Copyright IBM Corp. 2011 + * +The source code for this program is not published or otherwise divested of +its trade secrets, irrespective of what has been deposited with the U.S. +Copyright Office. + */ +package test.server.config.defaults; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; + +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; +import test.server.config.dynamic.SingletonTest; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +public class TestRunner extends BaseTestRunner { + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/default-config-test", new TestDynamicConfigServlet(), null, null); + } + + public void testDefaultConfigSingleton() throws Exception { + SingletonTest parent = new SingletonTest("test.config.default.singleton"); + addTest(parent); + + Dictionary dictionary; + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate(); + assertEquals("port", Integer.valueOf(5678), dictionary.get("port")); + assertArrayEquals("hostname", new String[] { "192.168.1.1", "192.168.1.2" }, (String[]) dictionary.get("hostname")); + + ConfigWriter writer; + + // STEP 1: update singleton to disable default configuration + writer = readConfiguration(); + writer.setValue("defaultSingleton", null, XMLConfigConstants.CONFIG_ENABLED_ATTRIBUTE, "false"); + writeConfiguration(writer); + + // wait for deleted configuration + dictionary = parent.waitForUpdate(); + assertNull(dictionary); + + // STEP 2: update singleton to enable default configuration + writer = readConfiguration(); + writer.setValue("defaultSingleton", null, XMLConfigConstants.CONFIG_ENABLED_ATTRIBUTE, "true"); + writeConfiguration(writer); + + // wait for updated configuration + dictionary = parent.waitForUpdate(); + assertEquals("port", Integer.valueOf(5678), dictionary.get("port")); + assertArrayEquals("hostname", new String[] { "192.168.1.1", "192.168.1.2" }, (String[]) dictionary.get("hostname")); + } + + public void testDefaultConfigFactory() throws Exception { + + FactoryTest parent = new FactoryTest("test.config.default.factory"); + addTest(parent); + + // wait for the initial configurations to be injected. + Dictionary oneDictionary = parent.waitForUpdate("one"); + assertEquals("port", Integer.valueOf(1234), oneDictionary.get("port")); + assertArrayEquals("hostname", new String[] { "192.168.1.1", "192.168.1.2" }, (String[]) oneDictionary.get("hostname")); + + Dictionary twoDictionary = parent.waitForUpdate("two"); + assertEquals("port", Integer.valueOf(9999), twoDictionary.get("port")); + assertArrayEquals("hostname", new String[] { "localhost", "ibm.com" }, (String[]) twoDictionary.get("hostname")); + + ConfigWriter writer; + + // STEP 1: update instance two to disable default configuration + writer = readConfiguration(); + writer.setValue("defaultFactory", "two", XMLConfigConstants.CONFIG_ENABLED_ATTRIBUTE, "false"); + writeConfiguration(writer); + + // wait for instance two delete + twoDictionary = parent.waitForUpdate("two"); + assertNull(twoDictionary); + + // STEP 2: update instance two to enable default configuration + writer = readConfiguration(); + writer.setValue("defaultFactory", "two", XMLConfigConstants.CONFIG_ENABLED_ATTRIBUTE, "true"); + writeConfiguration(writer); + + // wait for instance two update + twoDictionary = parent.waitForUpdate("two"); + assertEquals("port", Integer.valueOf(9999), twoDictionary.get("port")); + assertArrayEquals("hostname", new String[] { "localhost", "ibm.com" }, (String[]) twoDictionary.get("hostname")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/ConfigWriter.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/ConfigWriter.java new file mode 100755 index 00000000000..009e72beb1e --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/ConfigWriter.java @@ -0,0 +1,182 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.dynamic; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.StringReader; +import java.io.Writer; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Result; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +public class ConfigWriter { + + private static DocumentBuilderFactory DOM_FACTORY = DocumentBuilderFactory.newInstance(); + + private final Document document; + + public ConfigWriter() throws Exception { + DocumentBuilder builder = DOM_FACTORY.newDocumentBuilder(); + document = builder.newDocument(); + document.appendChild(document.createElement("server")); + } + + public ConfigWriter(InputStream in) throws Exception { + DocumentBuilder builder = DOM_FACTORY.newDocumentBuilder(); + document = builder.parse(in); + } + + private static boolean matches(Node node, String nodeName, String id, String idAttribute) { + if (node instanceof Element && nodeName.equals(node.getNodeName())) { + if (id == null) { + return true; + } else { + Element element = (Element) node; + return id.equals(element.getAttribute(idAttribute)); + } + } + return false; + } + + private Element getConfigNode(String nodeName, String id, String idAttribute) { + Element root = document.getDocumentElement(); + NodeList children = root.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + if (matches(child, nodeName, id, idAttribute)) { + return (Element) child; + } + } + return null; + } + + private List getConfigNodes(String nodeName, String id, String idAttribute) { + Element root = document.getDocumentElement(); + NodeList children = root.getChildNodes(); + List nodes = new ArrayList(); + for (int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + if (matches(child, nodeName, id, idAttribute)) { + nodes.add((Element) child); + } + } + return nodes; + } + + public boolean deleteConfig(String nodeName, String id, boolean allInstances) { + return deleteConfig(nodeName, id, "id", allInstances); + } + + public boolean deleteConfig(String nodeName, String id, String idAttribute, boolean allInstances) { + boolean didSomething = false; + Element root = document.getDocumentElement(); + if (allInstances) { + List toRemove = getConfigNodes(nodeName, id, idAttribute); + for (Node node : toRemove) { + root.removeChild(node); + didSomething = true; + } + } else { + Node node = getConfigNode(nodeName, id, idAttribute); + if (node != null) { + root.removeChild(node); + didSomething = true; + } + } + return didSomething; + } + + public void addConfig(String element) throws Exception { + DocumentBuilder builder = DOM_FACTORY.newDocumentBuilder(); + Document doc = builder.parse(new InputSource(new StringReader(element))); + addConfig(doc.getDocumentElement()); + } + + public void addConfig(String pattern, Object... args) throws Exception { + addConfig(MessageFormat.format(pattern, args)); + } + + public void addConfig(Element element) { + Node node = document.importNode(element, true); + Element root = document.getDocumentElement(); + root.appendChild(node); + } + + public boolean setValue(String nodeName, String id, String propertyName, String value) { + return setValue(nodeName, id, "id", propertyName, value); + } + + public boolean setValue(String nodeName, String id, String idAttribute, String propertyName, String value) { + Element element = getConfigNode(nodeName, id, idAttribute); + if (element != null) { + element.setAttribute(propertyName, value); + return true; + } else { + return false; + } + } + + public boolean removeProperty(String nodeName, String id, String propertyName) { + return removeProperty(nodeName, id, "id", propertyName); + } + + public boolean removeProperty(String nodeName, String id, String idAttribute, String propertyName) { + Element element = getConfigNode(nodeName, id, idAttribute); + if (element != null) { + // TODO: check for subelement with this name + return (element.getAttributes().removeNamedItem(propertyName) != null); + } else { + return false; + } + } + + public void write(File file) throws Exception { + write(new StreamResult(file)); + } + + public void write(OutputStream out) throws Exception { + write(new StreamResult(out)); + } + + public void write(Writer writer) throws Exception { + write(new StreamResult(writer)); + } + + private void write(Result result) throws Exception { + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer transformer = tf.newTransformer(); + //transformer.setOutputProperty (OutputKeys.OMIT_XML_DECLARATION, "yes"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + + transformer.transform(new DOMSource(document), result); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryNestedTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryNestedTest.java new file mode 100755 index 00000000000..c89a8be5495 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryNestedTest.java @@ -0,0 +1,85 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.dynamic; + +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; + +import test.server.BaseTest; + +public class FactoryNestedTest extends BaseTest implements ManagedServiceFactory { + + private final Map> dictionaries; + + public FactoryNestedTest(String name) { + super(name); + dictionaries = new HashMap>(); + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedServiceFactory.class.getName() }; + } + + @Override + public void updated(String pid, Dictionary properties) throws ConfigurationException { + notify(pid, properties); + } + + @Override + public void deleted(String pid) { + notify(pid, null); + } + + private void notify(String id, Dictionary properties) { + List list = getDictionaries(id); + synchronized (list) { + list.add(properties); + list.notifyAll(); + } + } + + private List getDictionaries(String pid) { + synchronized (dictionaries) { + List updates = dictionaries.get(pid); + if (updates == null) { + updates = new ArrayList(); + dictionaries.put(pid, updates); + } + return updates; + } + } + + public Dictionary waitForUpdate(String pid) { + List list = getDictionaries(pid); + synchronized (list) { + while (list.isEmpty()) { + try { + list.wait(TIMEOUT); + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted"); + } + if (list.isEmpty()) { + throw new RuntimeException("Timed out: " + pid); + } + } + return list.remove(0); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryTest.java new file mode 100755 index 00000000000..d17d4070bf1 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/FactoryTest.java @@ -0,0 +1,141 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.dynamic; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Dictionary; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; + +import test.server.BaseTest; + +public class FactoryTest extends BaseTest implements ManagedServiceFactory { + + private final Map pid2IdMapping; + private final Map id2PidMapping; + private final Map>> dictionaries; + private final String idAttribute; + + public FactoryTest(String name) { + this(name, "id"); + } + + public FactoryTest(String name, String idAttribute) { + super(name); + this.dictionaries = new HashMap>>(); + this.pid2IdMapping = Collections.synchronizedMap(new HashMap()); + this.id2PidMapping = Collections.synchronizedMap(new HashMap()); + this.idAttribute = idAttribute; + } + + public void reset() { + synchronized (dictionaries) { + dictionaries.clear(); + } + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedServiceFactory.class.getName() }; + } + + @SuppressWarnings("unchecked") + @Override + public void updated(String pid, @SuppressWarnings("rawtypes") Dictionary properties) throws ConfigurationException { + String id = (String) properties.get(idAttribute); + pid2IdMapping.put(pid, id); + id2PidMapping.put(id, pid); + notify(id, properties); + } + + @Override + public void deleted(String pid) { + String id = pid2IdMapping.get(pid); + notify(id, null); + } + + public String getPid(String id) { + return id2PidMapping.get(id); + } + + public Set getPids() { + return pid2IdMapping.keySet(); + } + + private void notify(String id, Dictionary properties) { + List> list = getDictionaries(id); + synchronized (list) { + list.add(properties); + list.notifyAll(); + } + } + + private List> getDictionaries(String id) { + synchronized (dictionaries) { + List> updates = dictionaries.get(id); + if (updates == null) { + updates = new ArrayList>(); + dictionaries.put(id, updates); + } + return updates; + } + } + + public Dictionary waitForUpdate(String id) { + return waitForUpdate(id, TIMEOUT); + } + + /** + * @param string + * @param i + * @return + */ + public Dictionary waitForUpdate(String id, long timeToWait) { + List> list = getDictionaries(id); + synchronized (list) { + while (list.isEmpty()) { + try { + list.wait(timeToWait); + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted"); + } + if (list.isEmpty()) { + throw new RuntimeException("Timed out"); + } + } + return list.remove(0); + } + } + + /** + * @param string + * @return + */ + public boolean hasDictionary(String id) { + List> list = getDictionaries(id); + synchronized (list) { + try { + list.wait(5000); + } catch (InterruptedException e) { + //Ignore, we're just waiting five seconds to make this method more accurate + } + return !list.isEmpty(); + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/SingletonTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/SingletonTest.java new file mode 100755 index 00000000000..710a09c40c8 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/SingletonTest.java @@ -0,0 +1,81 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.dynamic; + +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; +import java.util.logging.Logger; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedService; + +import test.server.BaseTest; + +public class SingletonTest extends BaseTest implements ManagedService { + private final static String CLASS_NAME = SingletonTest.class.getName(); + private final static Logger LOGGER = Logger.getLogger(CLASS_NAME); + + private final List dictionaries; + + public SingletonTest(String name) { + super(name); + dictionaries = new ArrayList(); + } + + @Override + public String[] getServiceClasses() { + return new String[] { ManagedService.class.getName() }; + } + + @Override + public void updated(Dictionary properties) throws ConfigurationException { + synchronized (dictionaries) { + LOGGER.finest("updated - " + properties); + dictionaries.add(properties); + dictionaries.notifyAll(); + } + } + + public Dictionary waitForUpdate() { + LOGGER.entering(CLASS_NAME, "waitForUpdate"); + synchronized (dictionaries) { + while (dictionaries.isEmpty()) { + try { + LOGGER.finest("waitForUpdate - waiting"); + dictionaries.wait(TIMEOUT); + } catch (InterruptedException e) { + LOGGER.finest("waitForUpdate - interrupted"); + throw new RuntimeException("Interrupted"); + } + if (dictionaries.isEmpty()) { + LOGGER.finest("waitForUpdate - timed out"); + throw new RuntimeException("Timed out"); + } + } + Dictionary d = dictionaries.remove(0); + LOGGER.exiting(CLASS_NAME, "waitForUpdate", d); + return d; + } + } + + /** + * + */ + public void reset() { + synchronized (dictionaries) { + dictionaries.clear(); + } + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/TestRunner.java new file mode 100755 index 00000000000..7dec335997d --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/dynamic/TestRunner.java @@ -0,0 +1,300 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.dynamic; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; + +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; + +public class TestRunner extends BaseTestRunner { + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/dynamic-config-test", new TestDynamicConfigServlet(), null, null); + } + + public void testSingleton() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + SingletonTest singletonTest = new SingletonTest("test.config.dynamic.singleton"); + addTest(singletonTest); + + // step 1. wait for the initial configuration to be injected. + dictionary = singletonTest.waitForUpdate(); + assertEquals("testValue", "10", dictionary.get("testValue")); + + // step 2a. modify the configuration + writer = readConfiguration(); + writer.setValue("test.config.dynamic.singleton", null, "testValue", "15"); + writeConfiguration(writer); + // step 2b: wait for update + dictionary = singletonTest.waitForUpdate(); + assertEquals("testValue", "15", dictionary.get("testValue")); + + // step 3a. delete configuration + writer = readConfiguration(); + writer.deleteConfig("test.config.dynamic.singleton", null, false); + writeConfiguration(writer); + // step 3b. wait for update + dictionary = singletonTest.waitForUpdate(); + assertEquals("Test deleted", null, dictionary); + + // step 4a. add configuration back in + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + // step 4b. wait for update + dictionary = singletonTest.waitForUpdate(); + assertEquals("Test added", "hello", dictionary.get("message")); + } + + public void testFactory() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + FactoryTest factoryTest = new FactoryTest("test.config.dynamic.factory"); + addTest(factoryTest); + + // step 1. wait for the initial configuration to be injected. + dictionary = factoryTest.waitForUpdate("1"); + assertEquals("instance 1 testValue", "10", dictionary.get("testValue")); + + // step 2a. modify instance 1 configuration & add instance 2 configuration + writer = readConfiguration(); + writer.setValue("test.config.dynamic.factory", "1", "testValue", "15"); + writer.addConfig(""); + writeConfiguration(writer); + // step 2b: wait for updates + dictionary = factoryTest.waitForUpdate("1"); + assertEquals("instance 1 testValue", "15", dictionary.get("testValue")); + dictionary = factoryTest.waitForUpdate("2"); + assertEquals("instance 2 message", "bye", dictionary.get("message")); + + // step 3a. delete instance 1 configuration & modify instance 2 configuration + writer = readConfiguration(); + writer.deleteConfig("test.config.dynamic.factory", "1", false); + writer.setValue("test.config.dynamic.factory", "2", "message", "what's up"); + writeConfiguration(writer); + // step 3b. wait for updates + dictionary = factoryTest.waitForUpdate("1"); + assertEquals("instance 1 deleted", null, dictionary); + dictionary = factoryTest.waitForUpdate("2"); + assertEquals("instance 2 message", "what's up", dictionary.get("message")); + + // step 4a. add instance 1 configuration back in & delete instance 2 + writer = readConfiguration(); + writer.addConfig(""); + writer.deleteConfig("test.config.dynamic.factory", "2", false); + writeConfiguration(writer); + // step 4b. wait for updates + dictionary = factoryTest.waitForUpdate("1"); + assertEquals("instance 1 added", "hello", dictionary.get("message")); + dictionary = factoryTest.waitForUpdate("2"); + assertEquals("instance 2 deleted", null, dictionary); + } + + public void testSingletonMetatype() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + SingletonTest singletonMetatypeTest = new SingletonTest("test.config.dynamic.singleton.metatype"); + addTest(singletonMetatypeTest); + + // step 1. wait for the initial configuration to be injected. + // This singleton was not configured in server.xml -- It's created because all of its required + // fields have defaults + dictionary = singletonMetatypeTest.waitForUpdate(); + // Make sure auto-added singletons use the alias for the display id + assertEquals("singletonMetatype", dictionary.get("config.displayId")); + + // step 2a. modify the configuration using an alias + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + // step 2b: wait for update + dictionary = singletonMetatypeTest.waitForUpdate(); + assertEquals("version", "2.0", dictionary.get("version")); + assertEquals("threads", new Integer(100), dictionary.get("threads")); + + // step 3a. delete configuration using an alias + writer = readConfiguration(); + writer.deleteConfig("singletonMetatype", null, false); + writeConfiguration(writer); + // step 3b. wait for update - defaults should be injected + dictionary = singletonMetatypeTest.waitForUpdate(); + assertEquals("version", "1.0", dictionary.get("version")); + assertEquals("threads", new Integer(100), dictionary.get("threads")); + + // step 4a. add configuration back in + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + // step 4b. wait for update + dictionary = singletonMetatypeTest.waitForUpdate(); + assertEquals("version", "1.0", dictionary.get("version")); + assertEquals("threads", new Integer(500), dictionary.get("threads")); + } + + public void testFactoryMetatype() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + FactoryTest factoryTest = new FactoryTest("test.config.dynamic.factory.metatype"); + addTest(factoryTest); + + // step 1. wait for the initial configuration to be injected. + dictionary = factoryTest.waitForUpdate("one"); + + // step 2a. modify instance 1 configuration & add instance 2 configuration + // The timeout value is of type duration(s), so the value is in seconds instead of milliseconds + writer = readConfiguration(); + writer.setValue("test.config.dynamic.factory.metatype", "one", "timeout", "123m"); + writer.addConfig(""); + writeConfiguration(writer); + // step 2b: wait for updates + dictionary = factoryTest.waitForUpdate("one"); + assertEquals("instance one timeout", new Long(123 * 60), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(10), dictionary.get("minSize")); + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance two timeout", new Long(100), dictionary.get("timeout")); + assertEquals("instance two minSize", new Integer(456), dictionary.get("minSize")); + + // step 3a. delete instance 1 configuration & modify instance 2 configuration + writer = readConfiguration(); + writer.deleteConfig("test.config.dynamic.factory.metatype", "one", false); + writer.setValue("factoryMetatype", "two", "timeout", "7890ms"); + writeConfiguration(writer); + // step 3b. wait for updates + dictionary = factoryTest.waitForUpdate("one"); + assertEquals("instance one deleted", null, dictionary); + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance two timeout", new Long(7), dictionary.get("timeout")); + assertEquals("instance two minSize", new Integer(456), dictionary.get("minSize")); + + // step 4a. add instance 1 configuration back in & delete instance 2 + writer = readConfiguration(); + writer.addConfig(""); + writer.deleteConfig("factoryMetatype", "two", false); + writeConfiguration(writer); + // step 4b. wait for updates + dictionary = factoryTest.waitForUpdate("one"); + assertEquals("instance one timeout", new Long(100), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(91011), dictionary.get("minSize")); + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance 2 deleted", null, dictionary); + } + + public void testFactoryOptionalId() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + String idAttribute = "name"; + + FactoryTest factoryTest = new FactoryTest("test.config.dynamic.factory.optional.metatype", idAttribute); + addTest(factoryTest); + + // step 1a. wait for initial configuration of first instance + dictionary = factoryTest.waitForUpdate("one"); + assertEquals("instance one timeout", new Long(100), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(10), dictionary.get("minSize")); + assertNull(dictionary.get("id")); + + // step 1b. wait for initial configuration of second instance + dictionary = factoryTest.waitForUpdate("four"); + assertEquals("instance one timeout", new Long(5000), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(10), dictionary.get("minSize")); + assertNull(dictionary.get("id")); + + assertEquals(2, factoryTest.getPids().size()); + + // step 2a. modify default instance & add another instance + writer = readConfiguration(); + writer.setValue("factoryOptionalMetatype", "one", idAttribute, "timeout", "123"); + writer.addConfig(""); + writeConfiguration(writer); + + // step 2b. wait for updates on default instance + dictionary = factoryTest.waitForUpdate("one"); + assertEquals("instance one timeout", new Long(123), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(10), dictionary.get("minSize")); + assertNull(dictionary.get("id")); + + // step 2c. wait for updates on second instance + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance one timeout", new Long(100), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(456), dictionary.get("minSize")); + assertEquals("two", dictionary.get("id")); + + assertEquals(3, factoryTest.getPids().size()); + + // step 3a. delete the default instance + writer = readConfiguration(); + writer.deleteConfig("factoryOptionalMetatype", "one", idAttribute, false); + writeConfiguration(writer); + + // step 3a. wait for the update + dictionary = factoryTest.waitForUpdate("one"); + assertNull("default instance deleted", dictionary); + + assertEquals(3, factoryTest.getPids().size()); + + // step 4a. add a new default instance & update the second instance + writer = readConfiguration(); + writer.addConfig(""); + writer.setValue("factoryOptionalMetatype", "two", idAttribute, "timeout", "789"); + writeConfiguration(writer); + + // step 4b. wait for updates on the default instance + dictionary = factoryTest.waitForUpdate("three"); + assertEquals("instance one timeout", new Long(222), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(111), dictionary.get("minSize")); + assertNull(dictionary.get("id")); + + // step 4c. wait for updates on the two instance + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance one timeout", new Long(789), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(456), dictionary.get("minSize")); + assertEquals("two", dictionary.get("id")); + + assertEquals(4, factoryTest.getPids().size()); + + // step 5a. delete two & three, update four + writer = readConfiguration(); + writer.deleteConfig("factoryOptionalMetatype", "two", idAttribute, false); + writer.deleteConfig("factoryOptionalMetatype", "three", idAttribute, false); + writer.setValue("factoryOptionalMetatype", "four", idAttribute, "timeout", "6000"); + writeConfiguration(writer); + + // step 5b. wait for updates + dictionary = factoryTest.waitForUpdate("two"); + assertEquals("instance 2 deleted", null, dictionary); + + // step 5c. wait for updates + dictionary = factoryTest.waitForUpdate("three"); + assertEquals("instance 2 deleted", null, dictionary); + + // step 5d. wait for updates + dictionary = factoryTest.waitForUpdate("four"); + assertEquals("instance one timeout", new Long(6000), dictionary.get("timeout")); + assertEquals("instance one minSize", new Integer(10), dictionary.get("minSize")); + assertNull(dictionary.get("id")); + + assertEquals(4, factoryTest.getPids().size()); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/AttributeCopyTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/AttributeCopyTestRunner.java new file mode 100755 index 00000000000..b80a7a5dad8 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/AttributeCopyTestRunner.java @@ -0,0 +1,255 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.Dictionary; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +/** + * + */ +public class AttributeCopyTestRunner extends BaseTestRunner { + + String parentName = "com.ibm.ws.config.attributeCopy"; + String childName = "com.ibm.ws.config.attributeCopy.child"; + String child2Name = "com.ibm.ws.config.attributeCopy.grandchild"; + String subTypeName = "com.ibm.ws.config.attributeCopy.subType"; + + private FactoryTest parent; + private FactoryTest child; + private FactoryTest child2; + private FactoryTest subType; + + private ConfigurationAdmin configAdmin; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/attribute-copy", new TestDynamicConfigServlet(), null, null); + + this.parent = new FactoryTest(parentName); + this.child = new FactoryTest(childName); + this.child2 = new FactoryTest(child2Name); + this.subType = new FactoryTest(subTypeName); + + addTest(parent); + addTest(child); + addTest(child2); + addTest(subType); + + BundleContext bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + this.configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + } + + public void testSimpleAttributeCopy() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + assertEquals("Bob", dictionary.get("copiedName")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("copyTest", "a", false); + writeConfiguration(writer); + } + } + + public void testSimpleAttributeCopyArray() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + String[] hobbies = (String[]) dictionary.get("hobbies"); + assertTrue("copiedHobbies should be the same as hobbies", Arrays.equals(hobbies, (String[]) dictionary.get("copiedHobbies"))); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("copyTest", "a", false); + writeConfiguration(writer); + } + } + + public void testNestedAttributeCopy() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + * + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("" + + "" + + ""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + assertEquals("Bob", dictionary.get("copiedName")); + assertEquals("Eleanor", dictionary.get("copiedChild")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("copyTest", "a", false); + writeConfiguration(writer); + } + } + + public void testDoubleNestedAttributeCopy() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + * + * + * + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("" + + "" + + "" + + "" + + ""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + assertEquals("Bob", dictionary.get("copiedName")); + assertEquals("Eleanor", dictionary.get("copiedChild")); + assertEquals("Ringo", dictionary.get("copiedGrandchild")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("copyTest", "a", false); + writeConfiguration(writer); + } + } + + public void testExtendsAttributeCopy() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = subType.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + assertEquals("subType value", dictionary.get("value")); + assertEquals("subType value", dictionary.get("valueCopy")); + assertEquals("supertype name", dictionary.get("name")); + assertEquals("supertype name", dictionary.get("nameCopy")); + assertEquals("supertype name", dictionary.get("superNameCopy")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("acSubType", "a", false); + writeConfiguration(writer); + } + } + + /** + * Reset factories to avoid test contamination + */ + private void resetFactoryTests() { + parent.reset(); + child.reset(); + child2.reset(); + subType.reset(); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/ChildFirstExtendsTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/ChildFirstExtendsTestRunner.java new file mode 100755 index 00000000000..83e7bb3556b --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/ChildFirstExtendsTestRunner.java @@ -0,0 +1,140 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Dictionary; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +/** + * + */ +public class ChildFirstExtendsTestRunner extends BaseTestRunner { + + String parentName = "com.ibm.example.topLevelElement"; + String childName = "com.ibm.example.child.a"; + String child2Name = "com.ibm.example.child.b"; + String child3Name = "com.ibm.example.child.c"; + String topName = "com.ibm.example.top.d"; + String abstractName = "com.ibm.example.supertype"; + + private FactoryTest parent; + private FactoryTest child; + private FactoryTest child2; + private FactoryTest child3; + private FactoryTest top; + + private ConfigurationAdmin configAdmin; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/child-first-extends", new TestDynamicConfigServlet(), null, null); + + this.parent = new FactoryTest(parentName); + this.child = new FactoryTest(childName); + this.child2 = new FactoryTest(child2Name); + this.child3 = new FactoryTest(child3Name); + this.top = new FactoryTest(topName); + + addTest(parent); + addTest(child); + addTest(child2); + addTest(child3); + addTest(top); + + BundleContext bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + this.configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + } + + public void testChildFirstExtends() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("" + + "" + + ""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + + dictionary = child.waitForUpdate("child.a"); + assertEquals("a1", dictionary.get("attrA1")); + assertEquals("The child should inherit from the supertype", "value", dictionary.get("commonAttribute")); + + Configuration[] superTypes = configAdmin.listConfigurations("(service.factoryPid=" + abstractName + ")"); + assertNotNull(superTypes); + assertEquals(1, superTypes.length); + dictionary = superTypes[0].getProperties(); + assertEquals("value", dictionary.get("commonAttribute")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("topLevelElement", "a", false); + writeConfiguration(writer); + } + } + + /** + * Reset factories to avoid test contamination + */ + private void resetFactoryTests() { + parent.reset(); + child.reset(); + child2.reset(); + child3.reset(); + top.reset(); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/HiddenTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/HiddenTestRunner.java new file mode 100755 index 00000000000..14b340927b7 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/HiddenTestRunner.java @@ -0,0 +1,320 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; + +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +/** + * + */ +public class HiddenTestRunner extends BaseTestRunner { + private final String grandparentName = "test.config.hidden.grandparent"; + private final String parentName = "test.config.hidden.parent"; + private final String childName = "test.config.hidden.child"; + private final String childExtended = "test.config.hidden.child.extended"; + + private FactoryTest grandparent; + private FactoryTest parent; + private FactoryTest child; + private FactoryTest extendedChild; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/hidden-test", new TestDynamicConfigServlet(), null, null); + + this.grandparent = new FactoryTest(grandparentName); + this.parent = new FactoryTest(parentName); + this.child = new FactoryTest(childName); + this.extendedChild = new FactoryTest(childExtended); + + addTest(grandparent); + addTest(parent); + addTest(child); + addTest(extendedChild); + } + + public void testHiddenChildWithExtends() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + grandparent.reset(); + parent.reset(); + extendedChild.reset(); + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = grandparent.waitForUpdate("grandparent"); + assertEquals("name should be \"hidden grandparent\"", + "hidden grandparent", dictionary.get("name")); + + dictionary = parent.waitForUpdate("parent"); + assertEquals("name should be \"hidden parent\"", + "hidden parent", dictionary.get("name")); + + dictionary = extendedChild.waitForUpdate("child"); + assertEquals("The name for the child should be I am an extended element", "I am an extended element", dictionary.get("name")); + assertEquals("The child should inherit from the supertype", "inheritedProperty", dictionary.get("abstractProperty")); + + // *** STEP 2 *** + // Update child + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + dictionary = extendedChild.waitForUpdate("child"); + assertEquals("The child name should be Updated extended element", "Updated extended element", dictionary.get("name")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + // *** STEP 3 *** + // Update parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child wasn't updated + assertFalse("The child should not be updated", extendedChild.hasDictionary("child")); + + // Check parent update + dictionary = parent.waitForUpdate("parent"); + assertEquals("name should be \"hidden parent updated\"", + "hidden parent updated", dictionary.get("name")); + + // Check grandparent update + dictionary = grandparent.waitForUpdate("grandparent"); + assertEquals("name should be \"hidden grandparent\"", + "hidden grandparent", dictionary.get("name")); + + // *** STEP 4 *** + // Delete child -- This should not result in an update to the parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child was deleted + assertNull("The child dictionary should be null", extendedChild.waitForUpdate("child")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + // *** STEP 5 *** + // Put the child back -- This should not result in an update to the parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child was updated + dictionary = extendedChild.waitForUpdate("child"); + assertEquals("The name for the child should be Returned extended element", "Returned extended element", dictionary.get("name")); + assertEquals("The child should inherit from the supertype", "inheritedProperty", dictionary.get("abstractProperty")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writeConfiguration(writer); + try { + grandparent.waitForUpdate("grandparent"); + } catch (Exception ex) { + ex.printStackTrace(); + // We don't care. Just waiting to make sure server update has gone through. If something went wrong earlier, that might not happen. + } + } + } + + public void testHiddenChild() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + + // Reset to avoid contamination + grandparent.reset(); + parent.reset(); + child.reset(); + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = grandparent.waitForUpdate("grandparent"); + assertEquals("name should be \"hidden grandparent\"", + "hidden grandparent", dictionary.get("name")); + + dictionary = parent.waitForUpdate("parent"); + assertEquals("name should be \"hidden parent\"", + "hidden parent", dictionary.get("name")); + + dictionary = child.waitForUpdate("child"); + assertEquals("The name for the child should be I am stealthy!", "I am stealthy!", dictionary.get("name")); + + // *** STEP 2 *** + // Update child + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + dictionary = child.waitForUpdate("child"); + assertEquals("The child name should be You can't see me.", "You can't see me.", dictionary.get("name")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + // *** STEP 3 *** + // Update parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child wasn't updated + assertFalse("The child should not be updated", child.hasDictionary("child")); + + // Check parent update + dictionary = parent.waitForUpdate("parent"); + assertEquals("name should be \"hidden parent updated\"", + "hidden parent updated", dictionary.get("name")); + + // Check grandparent update + dictionary = grandparent.waitForUpdate("grandparent"); + assertEquals("name should be \"hidden grandparent\"", + "hidden grandparent", dictionary.get("name")); + + // *** STEP 4 *** + // Delete child -- This should not result in an update to the parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child wasn't updated + assertNull("The child dictionary should be null", child.waitForUpdate("child")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + // *** STEP 5 *** + // Put the child back -- This should not result in an update to the parent + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writer.addConfig("" + + " " + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the child was updated + dictionary = child.waitForUpdate("child"); + assertEquals("The name for the child should be I'm back!", "I'm back!", dictionary.get("name")); + + // Check that the parent dictionary isn't updated + assertFalse("There should not be an update to the parent", parent.hasDictionary("parent")); + + // Check that the grandparent dictionary isn't updated + assertFalse("There should not be an update to the grandparent", grandparent.hasDictionary("grandparent")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("grandparentOfHiddenElement", "grandparent", false); + writeConfiguration(writer); + try { + grandparent.waitForUpdate("grandparent"); + parent.waitForUpdate("parent"); + } catch (Exception ex) { + ex.printStackTrace(); + // We don't care. Just waiting to make sure server update has gone through. If something went wrong earlier, that might not happen. + } + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedDefaultsTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedDefaultsTestRunner.java new file mode 100755 index 00000000000..666503ac363 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedDefaultsTestRunner.java @@ -0,0 +1,117 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; +import java.util.Vector; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +public class NestedDefaultsTestRunner extends BaseTestRunner { + + private final String parentName = "test.config.nested.defaults"; + private FactoryTest parent; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/nested-defaults-test", new TestDynamicConfigServlet(), null, null); + + this.parent = new FactoryTest(parentName); + addTest(parent); + } + + public void testRemoveAttribute() throws Exception { + testNestedDefaults("cardPos"); + } + + public void testRemoveAttributeNegativeCardinality() throws Exception { + testNestedDefaults("cardNeg"); + } + + public void testRemoveAttributeZeroCardinality() throws Exception { + testNestedDefaults("cardZero"); + } + + private void testNestedDefaults(String childName) throws Exception { + + Dictionary dictionary; + ConfigWriter writer; + String[] pids = new String[] {}; + + try { + parent.reset(); + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("<{0} id=\"parent\" someAttribute=\"empty attributes test\">" + + " <{1} hello=\"hello\" enabled=\"true\"/>" + + "", parentName, childName); + writeConfiguration(writer); + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate("parent"); + assertEquals("someAttribute should be \"empty attributes test\"", + "empty attributes test", dictionary.get("someAttribute")); + + // *** STEP 2 *** + // Remove attribute from child + writer = readConfiguration(); + writer.deleteConfig(parentName, "parent", false); + writer.addConfig("<{0} id=\"parent\" someAttribute=\"empty attributes test\">" + + " <{1}/>" + + "", parentName, childName); + writeConfiguration(writer); + + dictionary = parent.waitForUpdate("parent"); + assertEquals("someAttribute should be \"empty attributes test\"", + "empty attributes test", dictionary.get("someAttribute")); + + Object children = dictionary.get(childName); + if (children instanceof String) { + pids = new String[] { (String) children }; + } else if (children instanceof Vector) { + Vector v = (Vector) children; + pids = v.toArray(pids); + } else { + pids = (String[]) dictionary.get(childName); + } + + assertNotNull("There should be a child element", pids); + assertEquals("There should be only one child element", 1, pids.length); + + Configuration childConfig = configAdmin.getConfiguration(pids[0]); + + assertEquals("Enabled attribute should be true", Boolean.TRUE, childConfig.getProperties().get("enabled")); + assertNull("The attribute hello should be null", childConfig.getProperties().get("hello")); + assertEquals("The parent's child pid should equal the child's service.pid value", pids[0], childConfig.getProperties().get(XMLConfigConstants.CFG_SERVICE_PID)); + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig(parentName, "parent", false); + writeConfiguration(writer); + } + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedMergeRulesTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedMergeRulesTestRunner.java new file mode 100755 index 00000000000..4c907ea98e8 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedMergeRulesTestRunner.java @@ -0,0 +1,595 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.http.HttpService; + +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +/** + * + */ +@Component(service = NestedMergeRulesTestRunner.class, + name = "test.server.config.nestedMergeRules", + immediate = true, + property = { "service.vendor=IBM" }) +public class NestedMergeRulesTestRunner extends BaseTestRunner { + + private FactoryTest parentFactoryONE; + private FactoryTest parentFactoryMULTIPLE; + + private static final String parentName = "test.nestedmerge.parent"; + + private static final String XML_NEW_LINE = "\r\n"; + + private ConfigWriter writer; + + private ConfigurationAdmin configAdmin; + + @Override + @Reference(name = "locationService", service = WsLocationAdmin.class) + protected void setLocationService(WsLocationAdmin ref) { + this.locationService = ref; + } + + @Override + protected void unsetLocationService(WsLocationAdmin ref) { + if (ref == this.locationService) { + this.locationService = null; + } + } + + @Override + @Reference(name = "http", service = HttpService.class) + protected void setHttp(HttpService ref) { + this.http = ref; + } + + @Override + protected void unsetHttp(HttpService ref) { + if (ref == this.http) { + this.http = null; + } + } + + @Override + @Activate + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/nested-merge-rules", new TestDynamicConfigServlet(), null, null); + + this.parentFactoryONE = new FactoryTest(parentName + ".ONE"); + this.parentFactoryMULTIPLE = new FactoryTest(parentName + ".MULTIPLE"); + addTest(parentFactoryONE); + addTest(parentFactoryMULTIPLE); + + BundleContext bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + this.configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + + } + + private static class Child { + + Map attributes = new HashMap(); + + void addAttribute(String name, String value) { + attributes.put(name, value); + } + + void validateAttributes(Dictionary values) { + for (Map.Entry entry : attributes.entrySet()) { + if (!"id".equals(entry.getKey())) { + assertEquals(entry.getValue(), values.get(entry.getKey())); + } + } + } + + protected String getAlias() { + return "child"; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append('<'); + builder.append(getAlias()); + for (Map.Entry entry : attributes.entrySet()) { + builder.append(' '); + builder.append(entry.getKey()); + builder.append('='); + builder.append('"'); + builder.append(entry.getValue()); + builder.append('"'); + } + builder.append("/>"); + return builder.toString(); + } + + /** + * @return + */ + protected String getId() { + return attributes.get("id"); + } + + } + + private static class DefaultChild extends Child { + @Override + protected String getAlias() { + return "defaultChild"; + } + + @Override + protected String getId() { + return "childId"; + } + } + + private class Parent { + List children = new ArrayList(); + private final String id; + private final Cardinality cardinality; + private final String parentAliasName; + + public Parent(String id, Cardinality cardinality) { + this.id = id; + this.cardinality = cardinality; + parentAliasName = "nmrParent." + cardinality; + } + + void addChild(Child child) { + children.add(child); + } + + public String getId() { + return this.id; + } + + void validateAttributes(Dictionary values, Result expected) throws IOException { + assertEquals("id should be " + getId(), + getId(), values.get("id")); + + validateChildren(values, expected); + + } + + void validateChildren(Dictionary values, Result expected) throws IOException { + String childAliasName = "child"; + Object childValue = values.get(childAliasName); + assertNotNull(childValue); + + if (expected.getNumberOfChildren() == 1) { + if (cardinality == Cardinality.ONE) { + assertTrue("There should be one child pid", childValue instanceof String); + validateSingleChild((String) childValue); + } else { + assertEquals("There should be one child pid", 1, ((String[]) childValue).length); + validateChildren((String[]) childValue); + } + } else { + String[] childValues = (String[]) childValue; + assertEquals("The number of children should equal the number of evaluated pids", + expected.getNumberOfChildren(), childValues.length); + validateChildren(childValues); + } + + } + + /** + * @param childValue + * @throws IOException + */ + private void validateChildren(String[] childValues) throws IOException { + for (String pid : childValues) { + Configuration cfg = configAdmin.getConfiguration(pid); + Dictionary dictionary = cfg.getProperties(); + Child child = getChild(dictionary); + child.validateAttributes(dictionary); + } + + } + + /** + * @param object + * @return + */ + private Child getChild(Dictionary dictionary) { + String id = (String) dictionary.get("id"); + if (id == null) { + return null; + } else { + for (Child child : children) { + if (id.equals(child.getId())) { + return child; + } else if (id.contains("default-")) { + Enumeration keys = dictionary.keys(); + String key = keys.nextElement(); + if ("id".equals(key)) + key = keys.nextElement(); + if (child.attributes.containsKey(key)) + return child; + } + } + return null; + } + } + + /** + * @param childValue + * @throws IOException + */ + private void validateSingleChild(String childValue) throws IOException { + Configuration cfg = configAdmin.getConfiguration(childValue); + for (Child child : children) { + child.validateAttributes(cfg.getProperties()); + } + + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append('<'); + builder.append(parentAliasName); + builder.append(" id="); + builder.append('"'); + builder.append(id); + builder.append('"'); + builder.append('>'); + + for (Child child : children) { + builder.append(XML_NEW_LINE); + builder.append(child); + } + builder.append(XML_NEW_LINE); + builder.append('<'); + builder.append('/'); + builder.append(parentAliasName); + builder.append('>'); + return builder.toString(); + } + + public void addChildren(Child... children) { + for (Child child : children) { + addChild(child); + } + } + + /** + * + */ + public void write() throws Exception { + writer = readConfiguration(); + writer.addConfig(toString()); + writeConfiguration(writer); + } + + public void delete(Result expected) throws Exception { + // Clean up + writer = readConfiguration(); + writer.deleteConfig(parentAliasName, getId(), false); + writeConfiguration(writer); + if (expected.shouldSucceed()) + assertNull(getFactory().waitForUpdate(getId())); + else + assertFalse(getFactory().hasDictionary(getId())); + + } + + /** + * @throws IOException + * + */ + public void validate(Result expected) throws IOException { + if (expected.shouldSucceed()) { + Dictionary dictionary = getFactory().waitForUpdate(getId()); + validateAttributes(dictionary, expected); + } else { + assertFalse(getFactory().hasDictionary(getId())); + } + } + + /** + * @return + */ + private FactoryTest getFactory() { + if (cardinality == Cardinality.ONE) + return parentFactoryONE; + else + return parentFactoryMULTIPLE; + } + + /** + * + */ + public void test(Result result) throws Exception { + + try { + clean(); + write(); + validate(result); + } finally { + delete(result); + } + + } + + /** + * + */ + private void clean() { + parentFactoryONE.reset(); + parentFactoryMULTIPLE.reset(); + } + } + + /** + * Multiple children with null IDs should be merged when cardinality is zero + */ + public void testNullIDsCardinalityZero() throws Exception { + + Parent parent = new Parent("parent", Cardinality.ONE); + Child c1 = new Child(); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 1); + parent.test(r); + + } + + /** + * Multiple children with distinct IDs should be merged. This makes no sense to me whatsoever, but it was the + * resolution of the design issue. + * + * @throws Exception + */ + public void testMultipleIDsCardinalityZero() throws Exception { + Parent parent = new Parent("parent", Cardinality.ONE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("id", "id2"); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 1); + parent.test(r); + } + + /** + * Multiple children with the same ID should be merged when cardinality is zero. + * + * @throws Exception + */ + public void testSingleIDCardinalityZero() throws Exception { + Parent parent = new Parent("parent", Cardinality.ONE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("id", "id1"); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 1); + parent.test(r); + } + + /** + * Multiple distinct IDs with multiple cardinality should result in multiple children. + * + * @throws Exception + */ + public void testMultipleIDsCardinalityMultiple() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("id", "id2"); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 2); + parent.test(r); + } + + /** + * Multiple null IDs with multiple cardinality should result in multiple children. + * + * @throws Exception + */ + public void testNullIDsCardinalityMultiple() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + Child c1 = new Child(); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 2); + parent.test(r); + } + + /** + * Multiple children with the same ID should result in one merged element + * + * @throws Exception + */ + public void testSingleIDCardinalityMultiple() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + Child c2 = new Child(); + c2.addAttribute("id", "id1"); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 1); + parent.test(r); + } + + public void testMixedIDsCardinalityMultiple() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + + Child c2 = new Child(); + c2.addAttribute("id", "id1"); + c2.addAttribute("attr2", "a2"); + + Child c3 = new Child(); + c3.addAttribute("id", "id2"); + c3.addAttribute("attr1", "b1"); + + parent.addChildren(c1, c2, c3); + + Result r = new Result(true, 2); + parent.test(r); + } + + public void testMultipleParentsNullIDsCardinalityZero() throws Exception { + Parent parent = new Parent("parent", Cardinality.ONE); + Child c1 = new Child(); + c1.addAttribute("attr1", "a1"); + parent.addChild(c1); + + Parent parent2 = new Parent("parent2", Cardinality.ONE); + Child c2 = new Child(); + c2.addAttribute("attr2", "a2"); + parent2.addChild(c2); + + Result r = new Result(true, 1); + parent.test(r); + parent2.test(r); + } + + public void testMultipleParentsSingleIDCardinalityZero() throws Exception { + Parent parent = new Parent("parent", Cardinality.ONE); + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + parent.addChild(c1); + + Parent parent2 = new Parent("parent2", Cardinality.ONE); + Child c2 = new Child(); + c2.addAttribute("id", "id1"); + c2.addAttribute("attr2", "a2"); + parent2.addChild(c2); + + Result r = new Result(true, 1); + parent.test(r); + parent2.test(r); + } + + public void testMultipleParentsMixedIDsCardinalityMultiple() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + Parent parent2 = new Parent("parent2", Cardinality.MULTIPLE); + + Child c1 = new Child(); + c1.addAttribute("id", "id1"); + c1.addAttribute("attr1", "a1"); + + Child c2 = new Child(); + c2.addAttribute("id", "id1"); + c2.addAttribute("attr2", "a2"); + + Child c3 = new Child(); + c3.addAttribute("id", "id2"); + c3.addAttribute("attr1", "b1"); + + parent.addChildren(c1, c2, c3); + + Child c4 = new Child(); + c4.addAttribute("id", "id1"); + c4.addAttribute("attr4", "a4"); + + Child c5 = new Child(); + c5.addAttribute("id", "id2"); + c5.addAttribute("attr5", "attr5"); + + parent2.addChildren(c4, c5); + + Result r = new Result(true, 2); + + parent.test(r); + } + + public void testDefaultIDMerging() throws Exception { + Parent parent = new Parent("parent", Cardinality.MULTIPLE); + DefaultChild c1 = new DefaultChild(); + c1.addAttribute("attr1", "a1"); + DefaultChild c2 = new DefaultChild(); + c2.addAttribute("attr2", "a2"); + parent.addChildren(c1, c2); + + Result r = new Result(true, 1); + parent.test(r); + } + + private static class Result { + + private final int numberOfElements; + private final boolean shouldWork; + + public Result(boolean shouldWork, int elements) { + this.shouldWork = shouldWork; + this.numberOfElements = elements; + } + + public boolean shouldSucceed() { + return shouldWork; + } + + public int getNumberOfChildren() { + return numberOfElements; + } + } + + private static enum Cardinality { + ONE, MULTIPLE + }; +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedSingletonTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedSingletonTestRunner.java new file mode 100755 index 00000000000..cd909085bc7 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/NestedSingletonTestRunner.java @@ -0,0 +1,179 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import org.osgi.service.cm.Configuration; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.SingletonTest; + +/** + * + */ +public class NestedSingletonTestRunner extends BaseTestRunner { + + private SingletonTest child; + private final String parentName = "test.config.nested.managed.metatype"; + private final String parentAlias = "singletonNested"; + private final String childName = "test.singleton.under.singleton"; + private final String nestedElementTwo = "resultTwo"; + private final String singletonElement = "singletonResult"; + private final String nestedElement = "testResult"; + private SingletonTest parent; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/nested-singleton-test", new TestDynamicConfigServlet(), null, null); + + this.child = new SingletonTest(childName); + this.parent = new SingletonTest(parentName); + addTest(child); + addTest(parent); + } + + public static Map> getMetatypeExpectedProperties() { + Map map1 = new HashMap(); + map1.put("pass", Integer.valueOf(9999)); + map1.put("fail", Integer.valueOf(7777)); + + Map map2 = new HashMap(); + map2.put("pass", Integer.valueOf(100)); + map2.put("fail", Integer.valueOf(0)); + + Map> expectedProperties = new Hashtable>(); + expectedProperties.put("one", map1); + expectedProperties.put("two", map2); + + return expectedProperties; + } + + /* + * Test that the initial configuration is parsed and transformed correctly. Moved from TestRunner + * because it can be affected by testUpdateReceived(). Both should be called from the same test. + */ + public void testInitialConfiguration() throws Exception { + Dictionary properties = parent.waitForUpdate(); + + String[] singleton = (String[]) properties.get(singletonElement); + if (singleton != null) { + Configuration singletonConfig = configAdmin.getConfiguration(singleton[0]); + Dictionary singletonProps = singletonConfig.getProperties(); + String singletonString = (String) singletonProps.get("someString"); + String[] singletonArray = (String[]) singletonProps.get("someArray"); + assertEquals("aSingleton", singletonString); + assertEquals(3, singletonArray.length); + } + String[] resultsTwo = (String[]) properties.get(nestedElementTwo); + assertNotNull(resultsTwo); + assertEquals("There should be three nested results", 3, resultsTwo.length); + for (int i = 0; i < resultsTwo.length; i++) { + Configuration config = configAdmin.getConfiguration(resultsTwo[i]); + Dictionary prop = config.getProperties(); + String someString = (String) prop.get("someString"); + String[] someArray = (String[]) prop.get("someArray"); + if ("notDefault".equals(someString)) { + assertEquals(3, someArray.length); + } else if ("zzz".equals(someString)) { + if (someArray.length == 2) { + assertEquals("Incorrect defined value for array", "ten", someArray[0]); + assertEquals("Incorrect defined value for array", "eleven", someArray[1]); + } else if (someArray.length == 3) { + assertEquals("Incorrect default value for array", "four", someArray[0]); + assertEquals("Incorrect default value for array", "five", someArray[1]); + assertEquals("Incorrect default value for array", "six", someArray[2]); + } else { + fail("Incorrect number of entries for someArray attribute: " + someArray.length); + } + + } else { + fail("Incorrect value for attribute someString: " + someString); + } + } + + String[] testResults = (String[]) properties.get(nestedElement); + assertNotNull(testResults); + assertEquals(2, testResults.length); + + Map> expectedProperties = getMetatypeExpectedProperties(); + for (int i = 0; i < testResults.length; i++) { + Configuration config = configAdmin.getConfiguration(testResults[i]); + Dictionary prop = config.getProperties(); + String innerName = (String) prop.get("name"); + Map expectedProps = expectedProperties.remove(innerName); + assertNotNull("Unexpected name: " + innerName, expectedProps); + for (Map.Entry entry : expectedProps.entrySet()) { + assertEquals("property " + entry.getKey() + " mismatch", entry.getValue(), prop.get(entry.getKey())); + } + } + + assertEquals(0, expectedProperties.size()); + } + + /** + * Make sure a cross bundle nested singleton update causes the ManagedService to be updated + * + * @throws Exception + */ + public void testUpdateReceived() throws Exception { + + ConfigWriter writer; + Dictionary dictionary; + + // *** STEP 1 *** + // Clear any previous updates + child.reset(); + + // Delete any existing elements + writer = readConfiguration(); + boolean updated = writer.deleteConfig(parentName, null, true); + updated |= writer.deleteConfig(parentAlias, null, true); + if (updated) { + // The update check here is just a convenience for debugging. When the test is run, there should + // always be an element to delete. + writeConfiguration(writer); + assertNotNull("Singleton deletion should result in a configuration with all default properties", child.waitForUpdate()); + } + + // Write initial configuration + writer = readConfiguration(); + writer.addConfig("<{0} name=\"Jane Doe\">" + + " <{1} someString=\"hello\"/>" + + "", parentName, childName); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + + dictionary = child.waitForUpdate(); + assertEquals("someString should be \"hello\"", "hello", dictionary.get("someString")); + + // Clean up + writer = readConfiguration(); + writer.deleteConfig(parentName, null, true); + writer.deleteConfig(parentAlias, null, true); + writeConfiguration(writer); + assertNull("Singleton deletion should result in a null dictionary", child.waitForUpdate()); + + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/TestRunner.java new file mode 100755 index 00000000000..4a86375e42a --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/nested/TestRunner.java @@ -0,0 +1,650 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.nested; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.Arrays; +import java.util.Dictionary; +import java.util.HashSet; +import java.util.Set; + +import org.osgi.framework.Constants; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryNestedTest; +import test.server.config.dynamic.FactoryTest; +import test.server.config.dynamic.SingletonTest; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +public class TestRunner extends BaseTestRunner { + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/nested-config-test", new TestDynamicConfigServlet(), null, null); + } + + public void testNested() throws Exception { + testNested("test.config.nested.singleton", "test.config.nested.singleton", + "test.config.nested.child", "test.config.nested.child"); + } + + public void testNestedMetatype() throws Exception { + testNested("nestedSingleton", "test.config.nested.singleton.metatype", + "nestedChildOne", "test.config.nested.child.one.metatype"); + } + + @SuppressWarnings("unchecked") + private void testNested(String parentName, String parentPid, String childName, String childPid) throws Exception { + Dictionary dictionary; + ConfigWriter writer; + String[] pids; + + SingletonTest parent = new SingletonTest(parentPid); + addTest(parent); + + FactoryNestedTest child = new FactoryNestedTest(childPid); + addTest(child); + + // *** STEP 1 *** + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate(); + + // *** STEP 2 *** + // add first nested child + writer = readConfiguration(); + writer.deleteConfig(parentName, null, false); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} name=\"myNestedChildOne\" a=\"b\" value=\"10\"/>" + + "", parentName, childName); + writeConfiguration(writer); + + // parent gets injected with the first child pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + String parentServicePid = (String) dictionary.get(XMLConfigConstants.CFG_SERVICE_PID); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + String firstChildPid = pids[0]; + + // first child instance is created + dictionary = child.waitForUpdate(firstChildPid); + assertEquals("name property", "myNestedChildOne", dictionary.get("name")); + assertEquals("value property", "10", dictionary.get("value")); + assertEquals("a property", "b", dictionary.get("a")); + + assertEquals("Nested Child config.parentPID should be equal to parent's service.pid", parentServicePid, + dictionary.get(XMLConfigConstants.CFG_PARENT_PID)); + + // *** STEP 3 *** + // add second nested child + writer = readConfiguration(); + writer.deleteConfig(parentName, null, false); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} name=\"myNestedChildOne\" a=\"b\" value=\"10\"/>" + + " <{1} name=\"myNestedChildTwo\" b=\"c\" value=\"20\"/>" + + "", parentName, childName); + writeConfiguration(writer); + + // parent gets injected with the second child pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 2, pids.length); + Set pidSet = toSet(pids); + assertTrue("first child pid", pidSet.contains(firstChildPid)); + pidSet.remove(firstChildPid); + String secondChildPid = pidSet.iterator().next(); + + // second child instance is created + dictionary = child.waitForUpdate(secondChildPid); + assertEquals("name property", "myNestedChildTwo", dictionary.get("name")); + assertEquals("value property", "20", dictionary.get("value")); + assertEquals("b property", "c", dictionary.get("b")); + + // *** STEP 4 *** + // update second child and remove first + writer = readConfiguration(); + writer.deleteConfig(parentName, null, false); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} name=\"myNestedChildTwo\" b=\"c\" value=\"40\"/>" + + "", parentName, childName); + writeConfiguration(writer); + + // parent gets updated with a single pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + + String deletedPid = null; + String updatedPid = null; + + if (firstChildPid.equals(pids[0])) { + updatedPid = firstChildPid; + deletedPid = secondChildPid; + } else if (secondChildPid.equals(pids[0])) { + updatedPid = secondChildPid; + deletedPid = firstChildPid; + } else { + fail("Unexpected child pid: " + pids[0]); + } + + // one child instance is removed + dictionary = child.waitForUpdate(deletedPid); + assertNull("child removed", dictionary); + + // one child instance is updated + dictionary = child.waitForUpdate(updatedPid); + assertEquals("name property", "myNestedChildTwo", dictionary.get("name")); + assertEquals("value property", "40", dictionary.get("value")); + assertNull("a property", dictionary.get("a")); + assertEquals("b property", "c", dictionary.get("b")); + + // *** STEP 5 *** + // delete parent configuration + writer = readConfiguration(); + writer.deleteConfig(parentName, null, false); + writeConfiguration(writer); + + // remaining child instance is removed + dictionary = child.waitForUpdate(updatedPid); + assertNull("child was not removed", dictionary); + + // parent is removed + dictionary = parent.waitForUpdate(); + assertNull("parent was not removed", dictionary); + } + + @SuppressWarnings("unchecked") + public void testNestedReferences() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + String[] pids; + + String parentName = "test.config.nested.singleton.ref"; + SingletonTest parent = new SingletonTest(parentName); + addTest(parent); + + String childName = "test.config.nested.child.ref.1"; + FactoryNestedTest child = new FactoryNestedTest(childName); + addTest(child); + + // *** STEP 1 *** + // wait for the initial configuration to be injected. + dictionary = parent.waitForUpdate(); + + // *** STEP 2 *** + // add first nested child + writer = readConfiguration(); + writer.addConfig("<{0} id=\"1\" name=\"myNestedChildOne\" a=\"b\" value=\"10\"/>", childName); + writer.deleteConfig(parentName, null, false); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} ref=\"1\" />" + + "", parentName, childName); + writeConfiguration(writer); + + // parent gets injected with the first child pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + String firstChildPid = pids[0]; + + // first child instance is created + dictionary = child.waitForUpdate(firstChildPid); + assertEquals("name property", "myNestedChildOne", dictionary.get("name")); + assertEquals("value property", "10", dictionary.get("value")); + assertEquals("a property", "b", dictionary.get("a")); + + // *** STEP 3 *** + // add second nested child + writer = readConfiguration(); + writer.addConfig("<{0} id=\"2\" name=\"myNestedChildTwo\" b=\"c\" value=\"20\"/>", childName); + writer.deleteConfig(parentName, null, false); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} ref=\"1\" />" + + " <{1} ref=\"2\" />" + + "", parentName, childName); + writeConfiguration(writer); + + // parent gets injected with the second child pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 2, pids.length); + Set pidSet = toSet(pids); + assertTrue("first child pid", pidSet.contains(firstChildPid)); + pidSet.remove(firstChildPid); + String secondChildPid = pidSet.iterator().next(); + + // second child instance is created + dictionary = child.waitForUpdate(secondChildPid); + assertEquals("name property", "myNestedChildTwo", dictionary.get("name")); + assertEquals("value property", "20", dictionary.get("value")); + assertEquals("b property", "c", dictionary.get("b")); + + // *** STEP 4 *** + // update second child and remove first + writer = readConfiguration(); + writer.deleteConfig(childName, "1", false); + writer.setValue(childName, "2", "value", "40"); + writeConfiguration(writer); + + // parent gets updated with a single pid + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + + String deletedPid = null; + String updatedPid = null; + + if (firstChildPid.equals(pids[0])) { + updatedPid = firstChildPid; + deletedPid = secondChildPid; + } else if (secondChildPid.equals(pids[0])) { + updatedPid = secondChildPid; + deletedPid = firstChildPid; + } else { + fail("Unexpected child pid: " + pids[0]); + } + + // one child instance is removed + dictionary = child.waitForUpdate(deletedPid); + assertNull("child removed", dictionary); + + // one child instance is updated + dictionary = child.waitForUpdate(updatedPid); + assertEquals("name property", "myNestedChildTwo", dictionary.get("name")); + assertEquals("value property", "40", dictionary.get("value")); + assertNull("a property", dictionary.get("a")); + assertEquals("b property", "c", dictionary.get("b")); + + // *** STEP 5 *** + // delete parent configuration + writer = readConfiguration(); + writer.deleteConfig(parentName, null, false); + writeConfiguration(writer); + + // parent is removed + dictionary = parent.waitForUpdate(); + assertNull("parent was not removed", dictionary); + + // remaining child is still there + Configuration[] configs = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + updatedPid + ")"); + assertNotNull(configs); + assertEquals(1, configs.length); + } + + public void testNestedFactoryReferences() throws Exception { + testNestedFactoryReferences("test.config.nested.factory.ref", "test.config.nested.factory.ref", + "test.config.nested.child.ref.2", "test.config.nested.child.ref.2"); + } + + public void testNestedMetatypeFactoryReferences() throws Exception { + testNestedFactoryReferences("nestedFactory", "test.config.nested.factory.metatype", + "nestedChildTwo", "test.config.nested.child.two.metatype"); + } + + @SuppressWarnings("unchecked") + private void testNestedFactoryReferences(String parentName, String parentPid, String childName, String childPid) throws Exception { + Dictionary dictionary; + ConfigWriter writer; + String[] pids; + + FactoryTest parent = new FactoryTest(parentPid); + addTest(parent); + + FactoryNestedTest child = new FactoryNestedTest(childPid); + addTest(child); + + // *** STEP 1 *** + // add initial configurations + writer = readConfiguration(); + writer.addConfig("<{0} id=\"1\" name=\"myNestedChildOne\" a=\"b\" value=\"10\"/>", childName); + writer.deleteConfig(parentName, null, true); + writer.addConfig("<{0} id=\"one\" name=\"myNestedFactoryOne\">" + + " <{1} ref=\"1\" />" + + "", parentName, childName); + writer.addConfig("<{0} id=\"two\" name=\"myNestedFactoryTwo\">" + + " <{1} ref=\"1\" />" + + "", parentName, childName); + writeConfiguration(writer); + + // parents get injected with the first child pid + Dictionary dictionaryOne = parent.waitForUpdate("one"); + assertEquals("name property", "myNestedFactoryOne", dictionaryOne.get("name")); + String[] onePids = (String[]) dictionaryOne.get(childName); + assertNotNull("child pids", onePids); + assertEquals("child pids", 1, onePids.length); + + Dictionary dictionaryTwo = parent.waitForUpdate("two"); + assertEquals("name property", "myNestedFactoryTwo", dictionaryTwo.get("name")); + String[] twoPids = (String[]) dictionaryTwo.get(childName); + assertNotNull("child pids", twoPids); + assertEquals("child pids", 1, twoPids.length); + + // both pids should be the same + assertEquals("child pids are not the same", onePids[0], twoPids[0]); + + // child "1" is created + dictionary = child.waitForUpdate(onePids[0]); + assertEquals("name property", "myNestedChildOne", dictionary.get("name")); + assertEquals("value property", "10", dictionary.get("value")); + assertEquals("a property", "b", dictionary.get("a")); + + // *** STEP 2 *** + // add "2" child, modify "1" child, and add reference to "2" child to "one" parent + writer = readConfiguration(); + writer.addConfig("<{0} id=\"2\" name=\"myNestedChildTwo\" b=\"c\" value=\"20\"/>", childName); + writer.setValue(childName, "1", "value", "40"); + writer.deleteConfig(parentName, "one", false); + writer.addConfig("<{0} id=\"one\" name=\"myNestedFactoryOne\">" + + " <{1} ref=\"1\" />" + + " <{1} ref=\"2\" />" + + "", parentName, childName); + writeConfiguration(writer); + + // "two" parent should be notified and have no changes + dictionary = parent.waitForUpdate("two"); + dictionaryEquals(dictionaryTwo, dictionary); + + // "one" parent should be notified and have 2 pids + dictionary = parent.waitForUpdate("one"); + assertEquals("name property", "myNestedFactoryOne", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 2, pids.length); + Set pidSet = toSet(pids); + assertTrue(pidSet.contains(onePids[0])); + pidSet.remove(onePids[0]); + String child2Pid = pidSet.iterator().next(); + + // child "1" is updated + dictionary = child.waitForUpdate(onePids[0]); + assertEquals("name property", "myNestedChildOne", dictionary.get("name")); + assertEquals("value property", "40", dictionary.get("value")); + assertEquals("a property", "b", dictionary.get("a")); + + // child "2" is created + dictionary = child.waitForUpdate(child2Pid); + assertEquals("name property", "myNestedChildTwo", dictionary.get("name")); + assertEquals("value property", "20", dictionary.get("value")); + assertEquals("b property", "c", dictionary.get("b")); + + // *** STEP 3 **** + // delete "1" child + writer = readConfiguration(); + writer.deleteConfig(childName, "1", false); + writeConfiguration(writer); + + // child "1" is deleted + dictionary = child.waitForUpdate(onePids[0]); + assertNull(dictionary); + + // parent "two" has no pids + dictionary = parent.waitForUpdate("two"); + assertEquals("name property", "myNestedFactoryTwo", dictionary.get("name")); + assertEquals(Arrays.asList(), Arrays.asList((String[]) dictionary.get(childName))); + + // parent "one" has one pid + dictionary = parent.waitForUpdate("one"); + assertEquals("name property", "myNestedFactoryOne", dictionary.get("name")); + pids = (String[]) dictionary.get(childName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + assertEquals(child2Pid, pids[0]); + } + + @SuppressWarnings("unchecked") + public void testNestedNonUniqueReferences() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + String[] pids; + + String parentName = "test.config.nested.singleton.1"; + SingletonTest parent = new SingletonTest(parentName); + addTest(parent); + + String childOneName = "test.config.nested.child.ref.3"; + FactoryNestedTest childOne = new FactoryNestedTest(childOneName); + addTest(childOne); + + String childTwoName = "test.config.nested.child.ref.4"; + FactoryNestedTest childTwo = new FactoryNestedTest(childTwoName); + addTest(childTwo); + + dictionary = parent.waitForUpdate(); + + // *** STEP 1 *** + // add initial configurations - the references use the same id + writer = readConfiguration(); + writer.addConfig("<{0} id=\"1\" name=\"myChildOne\" a=\"b\" value=\"10\"/>", childOneName); + writer.addConfig("<{0} id=\"1\" name=\"myChildTwo\" a=\"b\" strValue=\"bob\"/>", childTwoName); + writer.deleteConfig(parentName, null, true); + writer.addConfig("<{0} name=\"myNestedSingleton\">" + + " <{1} ref=\"1\" />" + + " <{2} ref=\"1\" />" + + "", parentName, childOneName, childTwoName); + writeConfiguration(writer); + + // parent gets injected with the children pids + dictionary = parent.waitForUpdate(); + assertEquals("name property", "myNestedSingleton", dictionary.get("name")); + + pids = (String[]) dictionary.get(childOneName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + String childOnePid = pids[0]; + + pids = (String[]) dictionary.get(childTwoName); + assertNotNull("child pids", pids); + assertEquals("child pids", 1, pids.length); + String childTwoPid = pids[0]; + + assertFalse("pids are the same: " + childOnePid, childOnePid.equals(childTwoPid)); + } + + @SuppressWarnings("unchecked") + public void testFactoryOptionalId() throws Exception { + ConfigWriter writer; + + FactoryTest parent = new FactoryTest("test.config.nested.factory.optional.metatype", "name"); + addTest(parent); + + FactoryNestedTest child = new FactoryNestedTest("test.config.nested.factory.optional.child.1"); + addTest(child); + + FactoryNestedTest childChild = new FactoryNestedTest("test.config.nested.factory.optional.child.2"); + addTest(childChild); + + String parentName = "nestedOptionalFactory"; + String firstChildName = "nestedOptionalChildOne"; + String secondChildName = "nestedOptionalChildTwo"; + + // write initial configuration + writer = readConfiguration(); + writer.addConfig("<{0} name=\"myOptionalFactory\">" + + " <{1} name=\"myNestedChild\" a=\"b\" value=\"10\">" + + " <{2} name=\"myDoubleNestedChild\" threads=\"15\"/>" + + " " + + "", parentName, firstChildName, secondChildName); + writeConfiguration(writer); + + // parent get injected with the child + Dictionary dictionaryOne = parent.waitForUpdate("myOptionalFactory"); + assertEquals(Short.valueOf("5"), dictionaryOne.get("poolSize")); + String[] onePids = (String[]) dictionaryOne.get(firstChildName); + assertNotNull("child pids", onePids); + assertEquals("child pids", 1, onePids.length); + + // first child is updated + Dictionary dictionaryTwo = child.waitForUpdate(onePids[0]); + assertEquals("name property", "myNestedChild", dictionaryTwo.get("name")); + assertEquals("value property", "10", dictionaryTwo.get("value")); + assertEquals("a property", "b", dictionaryTwo.get("a")); + assertEquals(Long.valueOf("5000"), dictionaryTwo.get("idleTime")); + String[] twoPids = (String[]) dictionaryTwo.get(secondChildName); + assertNotNull("child pids", twoPids); + assertEquals("child pids", 1, twoPids.length); + + // second child is updated + Dictionary dictionaryThree = childChild.waitForUpdate(twoPids[0]); + assertEquals("name property", "myDoubleNestedChild", dictionaryThree.get("name")); + assertEquals("value property", "15", dictionaryThree.get("threads")); + assertEquals(Integer.valueOf("1000"), dictionaryThree.get("timeout")); + + // update double nested configuration + writer = readConfiguration(); + writer.deleteConfig(parentName, "myOptionalFactory", "name", false); + writer.addConfig("<{0} name=\"myOptionalFactory\">" + + " <{1} name=\"myNestedChild\" a=\"b\" value=\"10\">" + + " <{2} name=\"myDoubleNestedChild\" threads=\"20\"/>" + + " " + + "", parentName, firstChildName, secondChildName); + writeConfiguration(writer); + + Dictionary dictionary = null; + + // top parent should be notified of the changes but have no differences + dictionary = parent.waitForUpdate("myOptionalFactory"); + dictionaryEquals(dictionaryOne, dictionary); + + // first child should be notified of the changes but have no differences + dictionary = child.waitForUpdate(onePids[0]); + dictionaryEquals(dictionaryTwo, dictionary); + + // second child should be notified of the changes + dictionary = childChild.waitForUpdate(twoPids[0]); + assertEquals("name property", "myDoubleNestedChild", dictionary.get("name")); + assertEquals("value property", "20", dictionary.get("threads")); + assertEquals(Integer.valueOf("1000"), dictionary.get("timeout")); + } + + public static class TimestampFactoryTest extends FactoryTest { + + private long sleep = -1; + + public TimestampFactoryTest(String name) { + super(name); + } + + public void setSleep(long sleep) { + this.sleep = sleep; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void updated(String pid, Dictionary properties) throws ConfigurationException { + properties.put("timestamp", System.currentTimeMillis()); + if (sleep > 0) { + try { + Thread.sleep(sleep); + } catch (InterruptedException e) { + // ignore + } + } + super.updated(pid, properties); + } + } + + @SuppressWarnings("unchecked") + public void testUpdateOrder() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + TimestampFactoryTest a = new TimestampFactoryTest("test.config.order.a"); + TimestampFactoryTest b = new TimestampFactoryTest("test.config.order.b"); + TimestampFactoryTest c = new TimestampFactoryTest("test.config.order.c"); + TimestampFactoryTest d = new TimestampFactoryTest("test.config.order.d"); + TimestampFactoryTest e = new TimestampFactoryTest("test.config.order.e"); + + addTest(a); + addTest(b); + addTest(c); + addTest(d); + addTest(e); + + // *** STEP 1 *** + // wait for the initial configuration to be injected. + dictionary = a.waitForUpdate("a"); + assertEquals("a", dictionary.get("name")); + dictionary = b.waitForUpdate("b"); + assertEquals("b", dictionary.get("name")); + dictionary = c.waitForUpdate("c"); + assertEquals("c", dictionary.get("name")); + dictionary = d.waitForUpdate("d"); + assertEquals("d", dictionary.get("name")); + dictionary = e.waitForUpdate("e"); + assertEquals("e", dictionary.get("name")); + + // *** STEP 2 *** + // update e and check for updates in right order + long timeout = 1000; + a.setSleep(timeout); + b.setSleep(timeout); + c.setSleep(timeout); + d.setSleep(timeout); + e.setSleep(timeout); + + writer = readConfiguration(); + writer.setValue("test.config.order.e", "e", "name", "ee"); + writeConfiguration(writer); + + long aTimeout, bTimeout, cTimeout, dTimeout, eTimeout; + + dictionary = a.waitForUpdate("a"); + assertEquals("a", dictionary.get("name")); + aTimeout = (Long) dictionary.get("timestamp"); + dictionary = b.waitForUpdate("b"); + assertEquals("b", dictionary.get("name")); + bTimeout = (Long) dictionary.get("timestamp"); + dictionary = c.waitForUpdate("c"); + assertEquals("c", dictionary.get("name")); + cTimeout = (Long) dictionary.get("timestamp"); + dictionary = d.waitForUpdate("d"); + assertEquals("d", dictionary.get("name")); + dTimeout = (Long) dictionary.get("timestamp"); + dictionary = e.waitForUpdate("e"); + assertEquals("ee", dictionary.get("name")); + eTimeout = (Long) dictionary.get("timestamp"); + + // expected update order, e, d, c, b, a + assertTrue(dTimeout > eTimeout); + assertTrue(cTimeout > dTimeout); + assertTrue(bTimeout > cTimeout); + assertTrue(aTimeout > bTimeout); + } + + private static Set toSet(String[] array) { + return new HashSet(Arrays.asList(array)); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/reference/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/reference/TestRunner.java new file mode 100755 index 00000000000..324c233c618 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/reference/TestRunner.java @@ -0,0 +1,403 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.config.reference; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; +import java.util.Vector; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryNestedTest; +import test.server.config.dynamic.FactoryTest; +import test.server.config.dynamic.SingletonTest; + +public class TestRunner extends BaseTestRunner { + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/reference-config-test", new TestDynamicConfigServlet(), null, null); + + BundleContext bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + this.configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + + } + + public void testTwoReferencesOnePid() throws Exception { + + String id = "testTwoReferencesOnePid"; + + FactoryTest parent = new FactoryTest("test.config.reference.parent"); + addTest(parent); + + ConfigWriter writer = readConfiguration(); + + writer.addConfig("" + + " " + + " " + + ""); + writeConfiguration(writer); + + Dictionary dictionary = parent.waitForUpdate(id); + assertNotNull(dictionary.get("widget")); + assertNotNull(dictionary.get("part")); + + // Update a widget + + writer = readConfiguration(); + writer.deleteConfig("test.config.reference.parent", id, true); + writer.addConfig("" + + " " + + " " + + ""); + writeConfiguration(writer); + + dictionary = parent.waitForUpdate(id); + assertNotNull(dictionary.get("widget")); + assertNotNull(dictionary.get("part")); + + // Update a part + writer = readConfiguration(); + writer.deleteConfig("test.config.reference.parent", id, true); + writer.addConfig("" + + " " + + " " + + ""); + writeConfiguration(writer); + + // Check that the final configuration is ok + dictionary = parent.waitForUpdate(id); + String[] widgets = (String[]) dictionary.get("widget"); + String[] parts = (String[]) dictionary.get("part"); + + assertNotNull(widgets); + assertNotNull(parts); + + assertEquals(1, widgets.length); + assertEquals(1, parts.length); + + String widgetPid = widgets[0]; + String partPid = parts[0]; + + Configuration[] widgetConfigs = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + widgetPid + ")"); + Configuration[] partConfigs = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + partPid + ")"); + assertNotNull(widgetConfigs); + assertNotNull(partConfigs); + + assertEquals("There should be one widget in CA", 1, widgetConfigs.length); + assertEquals("There should be one part in CA", 1, partConfigs.length); + + Dictionary widgetDictionary = widgetConfigs[0].getProperties(); + Dictionary partDictionary = partConfigs[0].getProperties(); + assertEquals("widget 2", widgetDictionary.get("someProperty")); + assertEquals("widget 2", partDictionary.get("someProperty")); + + } + + public void testReferenceAttribute() throws Exception { + SingletonTest parent = new SingletonTest("test.config.reference.attribute"); + addTest(parent); + + FactoryNestedTest child = new FactoryNestedTest("test.config.reference.attribute.child"); + addTest(child); + + // wait for the initial configuration to be injected. + Dictionary parentDictionary = parent.waitForUpdate(); + assertEquals("version property", "3.0", parentDictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(100), parentDictionary.get("maxThreads")); + String pid = (String) parentDictionary.get("reference"); + assertNotNull("reference pid", pid); + + // check the child info + Dictionary childDictionary = child.waitForUpdate(pid); + assertEquals("name property", "one", childDictionary.get("name")); + assertEquals("threads property", Integer.valueOf(100), childDictionary.get("threads")); + + Dictionary dictionary; + ConfigWriter writer; + + // STEP 1: update child and check if parent is updated + writer = readConfiguration(); + writer.setValue("childAttributeReference", "ref1", "threads", "500"); + writeConfiguration(writer); + + // check updated child info + dictionary = child.waitForUpdate(pid); + assertEquals("name property", "one", dictionary.get("name")); + assertEquals("threads property", Integer.valueOf(500), dictionary.get("threads")); + + // check parent got updated + dictionary = parent.waitForUpdate(); + dictionaryEquals(parentDictionary, dictionary); + + // STEP 2: delete child and check if parent is updated + writer = readConfiguration(); + writer.deleteConfig("childAttributeReference", "ref1", false); + writeConfiguration(writer); + + // check updated child info + dictionary = child.waitForUpdate(pid); + assertNull(dictionary); + + // check parent got updated + dictionary = parent.waitForUpdate(); + assertEquals("version property", "3.0", dictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(100), dictionary.get("maxThreads")); + assertNull(dictionary.get("reference")); + + // STEP 3: add child back up and check if parent is updated + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + parentDictionary = parent.waitForUpdate(); + assertEquals("version property", "3.0", parentDictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(100), parentDictionary.get("maxThreads")); + pid = (String) parentDictionary.get("reference"); + assertNotNull("reference pid", pid); + + // check updated child info + dictionary = child.waitForUpdate(pid); + assertEquals("name property", "noname", dictionary.get("name")); + assertEquals("threads property", Integer.valueOf(300), dictionary.get("threads")); + } + + public void testReferenceElement() throws Exception { + + SingletonTest parent = new SingletonTest("test.config.reference.element"); + addTest(parent); + + FactoryNestedTest child = new FactoryNestedTest("test.config.reference.element.child"); + addTest(child); + + // wait for the initial configuration to be injected. + Dictionary parentDictionary = parent.waitForUpdate(); + assertEquals("version property", "4.0", parentDictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(200), parentDictionary.get("maxThreads")); + // check pids in references + String[] pids = (String[]) parentDictionary.get("references"); + assertNotNull("reference pids", pids); + assertEquals("child pids", 4, pids.length); + // check pids in referenceList + Vector pidList = (Vector) parentDictionary.get("referenceList"); + assertNotNull("reference pids", pidList); + assertEquals("child pids", 4, pidList.size()); + assertEquals(pids[0], pidList.get(0)); + assertEquals(pids[1], pidList.get(2)); + assertEquals(pids[2], pidList.get(1)); + // check pids in childRef + String[] pids2 = (String[]) parentDictionary.get("childRef"); + assertNotNull(pids2); + assertEquals(2, pids2.length); + assertEquals(pids[0], pids2[1]); + assertEquals(pids[1], pids2[0]); + // these elements should not be in the dictionary + assertNull(parentDictionary.get("referencesRef")); + assertNull(parentDictionary.get("referenceListRef")); + assertNull(parentDictionary.get("child")); + + // check the first reference info + Dictionary childOneDictionary = child.waitForUpdate(pids[0]); + assertEquals("name property", "five", childOneDictionary.get("name")); + assertEquals("threads property", Integer.valueOf(5), childOneDictionary.get("threads")); + + // check the first reference info + Dictionary childTwoDictionary = child.waitForUpdate(pids[1]); + assertEquals("name property", "unavailable", childTwoDictionary.get("name")); + assertEquals("threads property", Integer.valueOf(300), childTwoDictionary.get("threads")); + + // check the second reference info + Dictionary childThreeDictionary = child.waitForUpdate(pids[2]); + assertEquals("name property", "two", childThreeDictionary.get("name")); + assertEquals("threads property", Integer.valueOf(200), childThreeDictionary.get("threads")); + + // check the nested reference from "references" + Dictionary childFourDictionary = child.waitForUpdate(pids[3]); + assertEquals("name property", "nested-one", childFourDictionary.get("name")); + assertEquals("threads property", Integer.valueOf(5000), childFourDictionary.get("threads")); + + // check the nested reference from "referenceList" + Dictionary childFiveictionary = child.waitForUpdate(pidList.get(3)); + assertEquals("name property", "nested-two", childFiveictionary.get("name")); + assertEquals("threads property", Integer.valueOf(6000), childFiveictionary.get("threads")); + + Dictionary dictionary; + ConfigWriter writer; + + // STEP 1: update child and check if parent is updated + writer = readConfiguration(); + writer.setValue("childElementReference", "ref2", "threads", "444"); + writeConfiguration(writer); + + // check updated child info + dictionary = child.waitForUpdate(pids[2]); + assertEquals("name property", "two", dictionary.get("name")); + assertEquals("threads property", Integer.valueOf(444), dictionary.get("threads")); + + // check parent got updated + dictionary = parent.waitForUpdate(); + dictionaryEquals(parentDictionary, dictionary); + + // STEP 2: delete child two and check if parent is updated + writer = readConfiguration(); + writer.deleteConfig("childElementReference", "ref3", false); + writeConfiguration(writer); + + // check updated child info + dictionary = child.waitForUpdate(pids[1]); + assertNull(dictionary); + + // check parent got updated + parentDictionary = parent.waitForUpdate(); + assertEquals("version property", "4.0", parentDictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(200), parentDictionary.get("maxThreads")); + // check pids in references + String[] newPids = (String[]) parentDictionary.get("references"); + assertNotNull("reference pids", newPids); + assertEquals("child pids", 3, newPids.length); + assertEquals(pids[0], newPids[0]); + assertEquals(pids[2], newPids[1]); + assertEquals(pids[3], newPids[2]); + // check pids in referenceList + Vector newPidList = (Vector) parentDictionary.get("referenceList"); + assertNotNull("reference pids", newPidList); + assertEquals("child pids", 3, newPidList.size()); + assertEquals(pidList.get(0), newPidList.get(0)); + assertEquals(pids[2], newPidList.get(1)); + assertEquals(pidList.get(3), newPidList.get(2)); + // check pids in childRef + String[] newPids2 = (String[]) parentDictionary.get("childRef"); + assertNotNull(newPids2); + assertEquals(1, newPids2.length); + assertEquals(pids[0], newPids2[0]); + // these elements should not be in the dictionary + assertNull(parentDictionary.get("referencesRef")); + assertNull(parentDictionary.get("referenceListRef")); + assertNull(parentDictionary.get("child")); + + // STEP 3: add child two back up and check if parent is updated + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // check parent got updated + parentDictionary = parent.waitForUpdate(); + assertEquals("version property", "4.0", parentDictionary.get("version")); + assertEquals("maxThreads property", Integer.valueOf(200), parentDictionary.get("maxThreads")); + // check pids in references + pids = (String[]) parentDictionary.get("references"); + assertNotNull("reference pids", pids); + assertEquals("child pids", 4, pids.length); + assertEquals(newPids[0], pids[0]); + assertEquals(newPids[1], pids[2]); + assertEquals(newPids[2], pids[3]); + // check pids in referenceList + pidList = (Vector) parentDictionary.get("referenceList"); + assertNotNull("reference pids", pidList); + assertEquals("child pids", 4, pidList.size()); + assertEquals(pids[0], pidList.get(0)); + assertEquals(pids[1], pidList.get(2)); + assertEquals(pids[2], pidList.get(1)); + assertEquals(newPidList.get(2), pidList.get(3)); + // check pids in childRef + pids2 = (String[]) parentDictionary.get("childRef"); + assertNotNull(pids2); + assertEquals(2, pids2.length); + assertEquals(pids[0], pids2[1]); + assertEquals(pids[1], pids2[0]); + // these elements should not be in the dictionary + assertNull(parentDictionary.get("referencesRef")); + assertNull(parentDictionary.get("referenceListRef")); + assertNull(parentDictionary.get("child")); + + // check updated child info + dictionary = child.waitForUpdate(pids[1]); + assertEquals("name property", "noname", dictionary.get("name")); + assertEquals("threads property", Integer.valueOf(666), dictionary.get("threads")); + } + + public void testReferenceUpdates() throws Exception { + + FactoryTest nodeA = new FactoryTest("test.config.reference.node.a", "uniqueName"); + addTest(nodeA); + + FactoryTest nodeB = new FactoryTest("test.config.reference.node.b"); + addTest(nodeB); + + FactoryTest nodeC = new FactoryTest("test.config.reference.node.c"); + addTest(nodeC); + + Dictionary nodeADictionary = nodeA.waitForUpdate("foo"); + String nodeBOnePid = (String) nodeADictionary.get("nodeRef"); + assertNotNull(nodeBOnePid); + + Dictionary nodeCDictionary = nodeC.waitForUpdate("three"); + assertEquals("ford", nodeCDictionary.get("name")); + String nodeCPid = nodeC.getPid("three"); + + Dictionary nodeBOneDictionary = nodeB.waitForUpdate("one"); + assertEquals(Integer.valueOf(100), nodeBOneDictionary.get("value")); + assertEquals(nodeBOnePid, nodeB.getPid("one")); + assertEquals(nodeCPid, nodeBOneDictionary.get("nodeRef")); + + Dictionary nodeBTwoDictionary = nodeB.waitForUpdate("two"); + assertEquals(Integer.valueOf(200), nodeBTwoDictionary.get("value")); + assertEquals(nodeBOnePid, nodeB.getPid("one")); + assertEquals(nodeCPid, nodeBTwoDictionary.get("nodeRef")); + + ConfigWriter writer; + Dictionary dictionary; + + // Test 1: Update nodeB one - that should update nodeA + writer = readConfiguration(); + writer.setValue("nodeB", "one", "value", "5555"); + writeConfiguration(writer); + + nodeBOneDictionary = nodeB.waitForUpdate("one"); + assertEquals(Integer.valueOf(5555), nodeBOneDictionary.get("value")); + assertEquals(nodeBOnePid, nodeB.getPid("one")); + assertEquals(nodeCPid, nodeBOneDictionary.get("nodeRef")); + + dictionary = nodeA.waitForUpdate("foo"); + dictionaryEquals(nodeADictionary, dictionary); + + // Test 2: Update nodeC - that should update everything! + writer = readConfiguration(); + writer.setValue("nodeC", "three", "name", "honda"); + writeConfiguration(writer); + + nodeCDictionary = nodeC.waitForUpdate("three"); + assertEquals("honda", nodeCDictionary.get("name")); + + dictionary = nodeB.waitForUpdate("one"); + dictionaryEquals(nodeBOneDictionary, dictionary); + + dictionary = nodeB.waitForUpdate("two"); + dictionaryEquals(nodeBTwoDictionary, dictionary); + + dictionary = nodeA.waitForUpdate("foo"); + dictionaryEquals(nodeADictionary, dictionary); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/soc/ServiceObjectClassTestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/soc/ServiceObjectClassTestRunner.java new file mode 100755 index 00000000000..6dd69492b77 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/soc/ServiceObjectClassTestRunner.java @@ -0,0 +1,198 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.soc; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.Dictionary; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +/** + * + */ +public class ServiceObjectClassTestRunner extends BaseTestRunner { + + String simpleSOCPID = "com.ibm.ws.config.soc.simple"; + String applePID = "com.ibm.ws.config.soc.apple"; + String orangePID = "com.ibm.ws.config.soc.orange"; + + private FactoryTest simpleSOCTest; + + private ConfigurationAdmin configAdmin; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/serviceObjectClass-test", new TestDynamicConfigServlet(), null, null); + + this.simpleSOCTest = new FactoryTest(simpleSOCPID); + + addTest(simpleSOCTest); + + BundleContext bundleContext = context.getBundleContext(); + ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); + this.configAdmin = (ConfigurationAdmin) bundleContext.getService(ref); + } + + public void testSimpleServiceObjectClass() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + * + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig(""); + writer.addConfig(""); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = simpleSOCTest.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + + String referencePid = (String) dictionary.get("fruitRef"); + + Configuration[] references = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + referencePid + ")"); + assertNotNull(references); + assertEquals("There should be one reference", 1, references.length); + + Dictionary appleDictionary = references[0].getProperties(); + assertEquals("id should be apple", "apple", appleDictionary.get("id")); + assertNull("apple should not contain properties from orange metatype", appleDictionary.get("orangeType")); + assertEquals("apple should have properties from apple metatype", "macintosh", appleDictionary.get("appleType")); + + // *** STEP 2 *** + // Update apple->orange + writer = readConfiguration(); + writer.setValue("serviceObjectClassTest", "a", "fruitRef", "orange"); + writeConfiguration(writer); + + // wait for the dictionary update + dictionary = simpleSOCTest.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + referencePid = (String) dictionary.get("fruitRef"); + + references = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + referencePid + ")"); + assertNotNull(references); + assertEquals("There should be one reference", 1, references.length); + + Dictionary orangeDictionary = references[0].getProperties(); + assertEquals("id should be orange", "orange", orangeDictionary.get("id")); + assertNull("orange should not contain properties from apple metatype", orangeDictionary.get("appleType")); + assertEquals("orange should have properties from orange metatype", "clementine", orangeDictionary.get("orangeType")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("serviceObjectClassTest", "a", true); + writer.deleteConfig("apple", "apple", true); + writer.deleteConfig("orange", "orange", true); + writeConfiguration(writer); + } + } + + public void testServiceObjectClassConflict() throws Exception { + Dictionary dictionary; + ConfigWriter writer; + + try { + // Reset to avoid contamination + resetFactoryTests(); + + /* + * + * + * + */ + + // *** STEP 1 *** + // Write initial configuration + writer = readConfiguration(); + writer.addConfig(""); + writer.addConfig(""); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the initial configuration to be injected. + dictionary = simpleSOCTest.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + + // fruitRef should be null because we can't distinguish between apple/orange + assertNull(dictionary.get("fruitRef")); + + // *** STEP 2 *** + // Update apple->orange to eliminate conflict + writer = readConfiguration(); + writer.deleteConfig("orange", "apple", true); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for the dictionary update + dictionary = simpleSOCTest.waitForUpdate("a"); + assertEquals("id should be \"a\"", + "a", dictionary.get("id")); + + String referencePid = (String) dictionary.get("fruitRef"); + + Configuration[] references = configAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + referencePid + ")"); + assertNotNull(references); + assertEquals("There should be one reference", 1, references.length); + + Dictionary appleDictionary = references[0].getProperties(); + assertEquals("id should be apple", "apple", appleDictionary.get("id")); + assertNull("apple should not contain properties from orange metatype", appleDictionary.get("orangeType")); + assertEquals("apple should have properties from apple metatype", "macintosh", appleDictionary.get("appleType")); + + } finally { + // Clean up + writer = readConfiguration(); + writer.deleteConfig("serviceObjectClassTest", "a", false); + writer.deleteConfig("apple", "apple", true); + writer.deleteConfig("orange", "orange", true); + writer.deleteConfig("orange", "apple", true); + writeConfiguration(writer); + } + } + + /** + * Reset factories to avoid test contamination + */ + private void resetFactoryTests() { + simpleSOCTest.reset(); + + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/variable/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/variable/TestRunner.java new file mode 100755 index 00000000000..a65b5720988 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/config/variable/TestRunner.java @@ -0,0 +1,90 @@ +/* +IBM Confidential + * +OCO Source Materials + * +Copyright IBM Corp. 2011 + * +The source code for this program is not published or otherwise divested of +its trade secrets, irrespective of what has been deposited with the U.S. +Copyright Office. + */ +package test.server.config.variable; + +import static org.junit.Assert.assertEquals; + +import java.util.Dictionary; + +import org.osgi.service.component.ComponentContext; + +import test.server.BaseTestRunner; +import test.server.config.dynamic.ConfigWriter; +import test.server.config.dynamic.FactoryTest; + +public class TestRunner extends BaseTestRunner { + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + registerServlet("/variable-config-test", new TestDynamicConfigServlet(), null, null); + } + + public void testVariableChange() throws Exception { + + FactoryTest parent = new FactoryTest("test.config.variable.factory"); + addTest(parent); + + // wait for the initial configurations to be injected. + Dictionary oneDictionary = parent.waitForUpdate("one"); + assertEquals("port", Integer.valueOf(1234), oneDictionary.get("port")); + assertEquals("host", "localhost", oneDictionary.get("host")); + assertEquals("ipAddress", "${localIpAddress}", oneDictionary.get("ipAddress")); + + Dictionary twoDictionary = parent.waitForUpdate("two"); + assertEquals("port", Integer.valueOf(5678), twoDictionary.get("port")); + assertEquals("host", "127.0.0.1", twoDictionary.get("host")); + assertEquals("ipAddress", "${localIpAddress}", twoDictionary.get("ipAddress")); + + ConfigWriter writer; + + // STEP 1: change hostname variable + writer = readConfiguration(); + writer.setValue("variable", "hostname", "name", "value", "ibm.com"); + writeConfiguration(writer); + + // wait for instance one to update + oneDictionary = parent.waitForUpdate("one"); + assertEquals("port", Integer.valueOf(1234), oneDictionary.get("port")); + assertEquals("host", "ibm.com", oneDictionary.get("host")); + assertEquals("ipAddress", "${localIpAddress}", oneDictionary.get("ipAddress")); + + // STEP 2: add localIpAdress variable + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for instance one update + oneDictionary = parent.waitForUpdate("one"); + assertEquals("port", Integer.valueOf(1234), oneDictionary.get("port")); + assertEquals("host", "ibm.com", oneDictionary.get("host")); + assertEquals("ipAddress", "192.168.1.1", oneDictionary.get("ipAddress")); + + // wait for instance two update + twoDictionary = parent.waitForUpdate("two"); + assertEquals("port", Integer.valueOf(5678), twoDictionary.get("port")); + assertEquals("host", "127.0.0.1", twoDictionary.get("host")); + assertEquals("ipAddress", "192.168.1.1", twoDictionary.get("ipAddress")); + + // STEP 3: set localHostNames variable + writer = readConfiguration(); + writer.addConfig(""); + writeConfiguration(writer); + + // wait for instance two update + twoDictionary = parent.waitForUpdate("two"); + assertEquals("port", Integer.valueOf(5678), twoDictionary.get("port")); + assertEquals("host", "w3.ibm.com", twoDictionary.get("host")); + assertEquals("ipAddress", "192.168.1.1", twoDictionary.get("ipAddress")); + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/SchemaGeneratorActivator.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/SchemaGeneratorActivator.java new file mode 100755 index 00000000000..6469831a933 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/SchemaGeneratorActivator.java @@ -0,0 +1,108 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.schema; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.Writer; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import test.server.BaseHttpTest; + +import com.ibm.websphere.metatype.SchemaGenerator; +import com.ibm.websphere.metatype.SchemaGeneratorOptions; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; +import com.ibm.wsspi.kernel.service.location.WsResource; + +public class SchemaGeneratorActivator extends BaseHttpTest { + + private BundleContext bundleContext; + private SchemaGenerator schemaGenerator; + private WsLocationAdmin locationService; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + this.bundleContext = context.getBundleContext(); + registerServlet("/schema", new SchemaGeneratorServlet(), null, null); + System.out.println("Schema generator servlet started"); + } + + protected void setSchemaGenerator(SchemaGenerator ref) { + this.schemaGenerator = ref; + } + + protected void unsetSchemaGenerator(SchemaGenerator ref) { + if (ref == this.schemaGenerator) { + this.schemaGenerator = null; + } + } + + protected void setLocationService(WsLocationAdmin ref) { + this.locationService = ref; + } + + protected void unsetLocationService(WsLocationAdmin ref) { + if (ref == this.locationService) { + this.locationService = null; + } + } + + class SchemaGeneratorServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest rq, HttpServletResponse rsp) throws IOException { + Bundle[] bundles = bundleContext.getBundles(); + + SchemaGeneratorOptions options = new SchemaGeneratorOptions(); + options.setEncoding("UTF-8"); + options.setBundles(bundles); + + if ("file".equals(rq.getParameter("output"))) { + // generate schema and output it to a file + WsResource resource = locationService.resolveResource("${server.config.dir}/schema.xsd"); + Writer writer = new OutputStreamWriter(resource.putStream(), "UTF-8"); + PrintWriter pw = rsp.getWriter(); + try { + schemaGenerator.generate(writer, options); + + // Generation didn't die, woohoo! + rsp.setContentType("text/plain"); + pw.println("OK. Wrote: " + resource.toExternalURI()); + } catch (Throwable t) { + System.err.println("Exception " + t); + t.printStackTrace(); + pw.println("ERROR. Exception occurred: " + t.toString()); + } finally { + writer.close(); + pw.close(); + } + } else { + // generate schema and output it back + rsp.setContentType("text/xml"); + rsp.setCharacterEncoding("UTF-8"); + PrintWriter pw = rsp.getWriter(); + schemaGenerator.generate(pw, options); + } + } + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/TestRunner.java b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/TestRunner.java new file mode 100755 index 00000000000..4bc24906d36 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt-bundle/src/test/server/schema/TestRunner.java @@ -0,0 +1,115 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.server.schema; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; + +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.w3c.dom.Document; + +import test.server.BaseHttpTest; + +import com.ibm.websphere.metatype.SchemaGenerator; +import com.ibm.websphere.metatype.SchemaGeneratorOptions; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; +import com.ibm.wsspi.kernel.service.location.WsLocationConstants; +import com.ibm.wsspi.kernel.service.location.WsResource; + +public class TestRunner extends BaseHttpTest { + + private BundleContext bundleContext; + private SchemaGenerator schemaGenerator; + private WsLocationAdmin locationService; + + @Override + protected void activate(ComponentContext context) throws Exception { + super.activate(context); + + bundleContext = context.getBundleContext(); + + registerServlet("/schema-test", new TestVerifierServlet(), null, null); + } + + protected void setSchemaGenerator(SchemaGenerator ref) { + this.schemaGenerator = ref; + } + + protected void unsetSchemaGenerator(SchemaGenerator ref) { + if (ref == this.schemaGenerator) { + this.schemaGenerator = null; + } + } + + protected void setLocationService(WsLocationAdmin ref) { + this.locationService = ref; + } + + protected void unsetLocationService(WsLocationAdmin ref) { + if (ref == this.locationService) { + this.locationService = null; + } + } + + class TestVerifierServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest rq, HttpServletResponse rsp) throws IOException { + PrintWriter pw = rsp.getWriter(); + rsp.setContentType("text/plain"); + + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + SchemaGeneratorOptions options = new SchemaGeneratorOptions(); + options.setEncoding("UTF-8"); + options.setBundles(bundleContext.getBundles()); + schemaGenerator.generate(out, options); + out.flush(); + + SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + Schema schema = schemaFactory.newSchema(new StreamSource(new ByteArrayInputStream(out.toByteArray()))); + + DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); + domFactory.setNamespaceAware(true); + DocumentBuilder domBuilder = domFactory.newDocumentBuilder(); + + WsResource resource = locationService.resolveResource(WsLocationConstants.SYMBOL_SERVER_CONFIG_DIR + "test.xml"); + + Document document = domBuilder.parse(resource.get()); + + schema.newValidator().validate(new DOMSource(document)); + + pw.println("OK"); + } catch (Exception e) { + pw.println("FAILED"); + e.printStackTrace(pw); + } + } + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/FeatureListMBeanTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/FeatureListMBeanTest.java new file mode 100755 index 00000000000..f4e67ebccb1 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/FeatureListMBeanTest.java @@ -0,0 +1,149 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.bvt; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedLocationManager; + +import com.ibm.websphere.config.mbeans.FeatureListMBean; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; + +/** + * This test tests basic functionality of the com.ibm.websphere.config.mbeans.FeatureListMBean, + * i.e. whether a non-empty file is generated by the MBean + */ +public class FeatureListMBeanTest { + + private static Class logClass = FeatureListMBeanTest.class; + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + final String methodName = "setUpBeforeClass"; + Log.entering(logClass, methodName); + + String installDir = System.getProperty("install.dir"); + WsLocationAdmin locMgr = (WsLocationAdmin) SharedLocationManager.createDefaultLocations(installDir, getProfile()); + + outputDir = locMgr.resolveString("${server.output.dir}"); + Log.info(logClass, methodName, "serverRoot=" + outputDir); + + // Set up the trust store + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + HostnameVerifier hv = new HostnameVerifier() { + @Override + public boolean verify(String urlHostName, SSLSession session) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(hv); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + Log.info(logClass, methodName, "JMXServiceURL: " + url); + jmxConnector = JMXConnectorFactory.connect(url, environment); + connection = jmxConnector.getMBeanServerConnection(); + assertNotNull("MBeanServerConnection should not be null", connection); + } + + @Test + public void testFeatureListMBean() throws Exception { + String methodName = "testFeatureListMBean"; + Log.entering(logClass, methodName); + + //Invoke feature list generation + ObjectName name = new ObjectName(FeatureListMBean.OBJECT_NAME); + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String" }; + Object[] params = new String[] { "UTF-8", Locale.getDefault().toString(), null }; + @SuppressWarnings("unchecked") + Map returnedMap = (Map) connection.invoke(name, "generate", params, signature); + Log.info(logClass, methodName, returnedMap.toString()); + Log.info(logClass, methodName, "Return code from Returned Map should not be 0: " + returnedMap.get(FeatureListMBean.KEY_RETURN_CODE)); + + //Check return code + assertTrue("Return code is not 0", (Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = (String) returnedMap.get(FeatureListMBean.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/featurelist.xml"; + Log.info(logClass, methodName, "sourcePath: " + sourcePath + "targetPath " + targetPath); + + signature = new String[] { "java.lang.String", "java.lang.String" }; + params = new Object[] { sourcePath, targetPath }; + ObjectName objName = new ObjectName(FileTransferMBean.OBJECT_NAME); + connection.invoke(objName, "downloadFile", params, signature); + + //Check that file is not empty + File file = new File(targetPath); + Log.info(logClass, methodName, "Returned file (targetPath): " + file.length()); + assertTrue("Returned file is empty", file.length() > 0); + Log.exiting(logClass, methodName); + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } + + private static String getProfile() { + return System.getProperty("profile", "com.ibm.ws.config.bvt.schema"); + + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaMBeanTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaMBeanTest.java new file mode 100755 index 00000000000..ca159601a55 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaMBeanTest.java @@ -0,0 +1,156 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.bvt; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.HashMap; +import java.util.Map; + +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedLocationManager; +import test.common.SharedOutputManager; + +import com.ibm.websphere.config.mbeans.FeatureListMBean; +import com.ibm.websphere.config.mbeans.ServerSchemaGenerator; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; + +/** + * + */ +public class SchemaMBeanTest { + + private static Class logClass = SchemaMBeanTest.class; + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + private static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestRule managerRule = outputMgr; + + @BeforeClass + public static void setUp() throws Exception { + final String methodName = "setUp"; + Log.entering(logClass, methodName); + + String installDir = System.getProperty("install.dir"); + WsLocationAdmin locMgr = (WsLocationAdmin) SharedLocationManager.createDefaultLocations(installDir, getProfile()); + + outputDir = locMgr.resolveString("${server.output.dir}"); + Log.info(logClass, methodName, "serverRoot=" + outputDir); + + // Set up the trust store + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + HostnameVerifier hv = new HostnameVerifier() { + @Override + public boolean verify(String urlHostName, SSLSession session) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(hv); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + Log.info(logClass, methodName, "JMXServiceURL: " + url); + jmxConnector = JMXConnectorFactory.connect(url, environment); + connection = jmxConnector.getMBeanServerConnection(); + assertNotNull("MBeanServerConnection should not be null", connection); + } + + @Test + public void testSchemaMBean() throws Exception { + String methodName = "testSchemaMBean"; + Log.entering(logClass, methodName); + + //Invoke schema generation + ObjectName name = new ObjectName(ServerSchemaGenerator.OBJECT_NAME); + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String" }; + Object[] params = new String[] { null, null, null, null }; + @SuppressWarnings("unchecked") + Map returnedMap = (Map) connection.invoke(name, "generateInstallSchema", params, signature); + Log.info(logClass, methodName, returnedMap.toString()); + Log.info(logClass, methodName, "Return code from Returned Map should not be 0: " + returnedMap.get(FeatureListMBean.KEY_RETURN_CODE)); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/schema.xsd"; + Log.info(logClass, methodName, "sourcePath: " + sourcePath + "targetPath " + targetPath); + + signature = new String[] { "java.lang.String", "java.lang.String" }; + params = new Object[] { sourcePath, targetPath }; + ObjectName objName = new ObjectName(FileTransferMBean.OBJECT_NAME); + connection.invoke(objName, "downloadFile", params, signature); + + //Ensure the file is bigger than 1 MB + File file = new File(targetPath); + Log.info(logClass, methodName, "Returned file (targetPath): " + file.length()); + assertTrue("Returned file is empty", file.length() > 1000000); + Log.exiting(logClass, methodName); + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } + + private static String getProfile() { + return System.getProperty("profile", "com.ibm.ws.config.bvt.schema"); + + } + +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaTest.java new file mode 100755 index 00000000000..36fde20df4c --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/SchemaTest.java @@ -0,0 +1,68 @@ +package com.ibm.ws.config.bvt; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; + +public class SchemaTest { + + private static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestRule outputRule = outputMgr; + + private String getPort() { + return System.getProperty("HTTP_default", "8000"); + } + + private String read(InputStream in) throws IOException { + InputStreamReader isr = new InputStreamReader(in); + BufferedReader br = new BufferedReader(isr); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + return builder.toString(); + } + + @Test + public void testSchemaGeneratorAll() throws Exception { + test("/schema?output=file", "testSchemaGeneratorAll"); + } + + private void test(String testUri, String testName) throws Exception { + HttpURLConnection con = null; + try { + URL url = new URL("http://localhost:" + getPort() + testUri); + con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + assertNotNull(is); + + String output = read(is); + System.out.println(output); + assertTrue("Response should start with OK", output.trim().startsWith("OK")); + } finally { + if (con != null) { + con.disconnect(); + } + } + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/ServerXMLConfigurationMBeanTest.java b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/ServerXMLConfigurationMBeanTest.java new file mode 100755 index 00000000000..e4233b9f935 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/bvt/src/com/ibm/ws/config/bvt/ServerXMLConfigurationMBeanTest.java @@ -0,0 +1,113 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.bvt; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedLocationManager; +import test.common.SharedOutputManager; + +import com.ibm.websphere.config.mbeans.ServerXMLConfigurationMBean; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; + +/** + * This test tests the basic functionality of the com.ibm.websphere.config.mbeans.ServerXMLConfigurationMBean. + * It verifies that fetchConfigurationFilePaths() returns the expected collection of file paths and then checks + * that the files can be downloaded using the FileTransferMBean from those paths. + */ +public class ServerXMLConfigurationMBeanTest { + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + private static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestRule managerRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + String installDir = System.getProperty("install.dir"); + WsLocationAdmin locMgr = (WsLocationAdmin) SharedLocationManager.createDefaultLocations(installDir, getProfile()); + + outputDir = locMgr.resolveString("${server.output.dir}"); + + // Set up the trust store + System.setProperty("javax.net.ssl.trustStore", outputDir + "/resources/security/key.jks"); + System.setProperty("javax.net.ssl.trustStorePassword", "Liberty"); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + jmxConnector = JMXConnectorFactory.connect(url, environment); + connection = jmxConnector.getMBeanServerConnection(); + } + + @Test + public void testServerXMLConfigurationMBean() throws Exception { + ObjectName name = new ObjectName(ServerXMLConfigurationMBean.OBJECT_NAME); + @SuppressWarnings("unchecked") + Collection configFilePaths = (Collection) connection.invoke(name, "fetchConfigurationFilePaths", new Object[] {}, new String[] {}); + + // Check that the collection contains the expected file paths. + assertEquals("Config file path collection size is not 2.", 2, configFilePaths.size()); + assertTrue("server.xml is missing from the collection.", + configFilePaths.contains("${server.config.dir}/server.xml")); + assertTrue("bvtTestPorts.xml is missing from the collection.", + configFilePaths.contains("${shared.config.dir}/bvtTestPorts.xml")); + + // Download configuration files. + for (String sourcePath : configFilePaths) { + String targetPath = outputDir + "/download_target/" + + sourcePath.substring(sourcePath.lastIndexOf('/') + 1); + + String[] signature = new String[] { "java.lang.String", "java.lang.String" }; + Object[] params = new Object[] { sourcePath, targetPath }; + ObjectName objName = new ObjectName(FileTransferMBean.OBJECT_NAME); + connection.invoke(objName, "downloadFile", params, signature); + + // Check that file is not empty + File file = new File(targetPath); + assertTrue("Returned file is empty", file.length() > 0); + } + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } + + private static String getProfile() { + return System.getProperty("profile", "com.ibm.ws.config.bvt.schema"); + } +} diff --git a/dev/com.ibm.ws.config_bvt.schema/delivery.sets b/dev/com.ibm.ws.config_bvt.schema/delivery.sets new file mode 100755 index 00000000000..9a2dcf02d11 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/delivery.sets @@ -0,0 +1 @@ +SLE \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/osgitck-bvt.xml.disabled b/dev/com.ibm.ws.config_bvt.schema/osgitck-bvt.xml.disabled new file mode 100755 index 00000000000..f73b8e4b4fa --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/osgitck-bvt.xml.disabled @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_bvt.schema/publish/features/testschema-1.0.mf b/dev/com.ibm.ws.config_bvt.schema/publish/features/testschema-1.0.mf new file mode 100755 index 00000000000..dffbf68043b --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/publish/features/testschema-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:testschema-1.0 +Subsystem-SymbolicName: testschema-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.server.schema; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/.gitignore b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/.gitignore new file mode 100644 index 00000000000..7f52d8f632f --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/.gitignore @@ -0,0 +1 @@ +/download_target diff --git a/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/bootstrap.properties b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/bootstrap.properties new file mode 100755 index 00000000000..dee20e162ff --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/bootstrap.properties @@ -0,0 +1,4 @@ +com.ibm.ws.logging.trace.specification=*=event=enabled:config=all=enabled +com.ibm.ws.logging.max.file.size=0 + +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/jvm.options b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/jvm.options new file mode 100755 index 00000000000..32354345ade --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/jvm.options @@ -0,0 +1 @@ +-Xmx256M \ No newline at end of file diff --git a/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/server.xml b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/server.xml new file mode 100755 index 00000000000..d55c4a4e967 --- /dev/null +++ b/dev/com.ibm.ws.config_bvt.schema/publish/servers/com.ibm.ws.config.bvt.schema/server.xml @@ -0,0 +1,15 @@ + + + + + + httpservice-2.2 + testschema-1.0 + restConnector-1.0 + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/.classpath b/dev/com.ibm.ws.config_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/.classpath.gradle b/dev/com.ibm.ws.config_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/.gitignore b/dev/com.ibm.ws.config_fat/.gitignore new file mode 100644 index 00000000000..27e131e35a6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.config_fat/.project b/dev/com.ibm.ws.config_fat/.project new file mode 100755 index 00000000000..c33ca1c04e7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.config_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.config_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..f48ecd6cc60 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c92277a371a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.config_fat/bnd.bnd b/dev/com.ibm.ws.config_fat/bnd.bnd new file mode 100644 index 00000000000..abe08945c20 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/bnd.bnd @@ -0,0 +1,14 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.filetransfer;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.config_fat/bnd.bnd.gradle b/dev/com.ibm.ws.config_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..abe08945c20 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/bnd.bnd.gradle @@ -0,0 +1,14 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.filetransfer;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.config;version=latest diff --git a/dev/com.ibm.ws.config_fat/build-test.xml b/dev/com.ibm.ws.config_fat/build-test.xml new file mode 100755 index 00000000000..d42ad757442 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/build-test.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/build.gradle b/dev/com.ibm.ws.config_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.config_fat/delivery.sets b/dev/com.ibm.ws.config_fat/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/BadConfigTests.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/BadConfigTests.java new file mode 100755 index 00000000000..05ffbca817e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/BadConfigTests.java @@ -0,0 +1,124 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.List; + +import org.junit.Test; + +import componenttest.annotation.ExpectedFFDC; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class BadConfigTests { + + @Test + public void testBadPortConfig() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.bad"); + server.startServer("badconfig.log"); + + try { + // Start the server with bad configuration + assertNotNull("There should be an error during server start", server.waitForStringInLog("CWWKG0075E.*missingbvt.prop.HTTP_default.*")); + assertNotNull("The server should start", server.waitForStringInLog("CWWKF0011I.*")); + assertNull("There should not be a cached instance used", server.waitForStringInLog("CWWKG0076W", 1000)); + + // Update the configuration to good values + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("badconfig/goodConfig.xml"); + + assertNotNull("The config should be updated", server.waitForStringInLogUsingMark("CWWKG0017I.*")); + assertNull("There should not be a validation error", server.waitForStringInLogUsingMark("CWWKG0075E", 1000)); + + // Update at runtime to an invalid configuration. The cached values should still be used + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("badconfig/badHttp.xml"); + + assertNotNull("There should be an error during server start", server.waitForStringInLogUsingMark("CWWKG0075E.*missingbvt.prop.HTTP_default.*")); + assertNotNull("There should be a cached instance used", server.waitForStringInLogUsingMark("CWWKG0076W")); + assertNotNull("The config should be updated", server.waitForStringInLogUsingMark("CWWKG0017I.*")); + + // Update a singleton () at runtime. The cached values should still be used + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("badconfig/badLogging.xml"); + + assertNotNull("There should be a warning during server start", server.waitForStringInLogUsingMark("CWWKG0083W.*maxFiles.*-1.*2.*")); + assertNotNull("The config should be updated", server.waitForStringInLogUsingMark("CWWKG0017I.*")); + + } finally { + server.stopServer(); + } + + } + + @Test + public void testUniqueValueConflictConfig() throws Exception { + + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.uniquevalueconflict"); + server.startServer("uniquevalueconflict.log"); + try { + // Update the configuration to good values + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("badconfig/UniqueValueConflict.xml"); + + assertNotNull(" Distinct values specified for the attribute", server.waitForStringInLogUsingMark("CWWKG0031E.*")); + assertNotNull(" ConfigUpdateException does not occur", server.waitForStringInLogUsingMark("CWWKG0074E.*")); + } + + finally { + server.stopServer(); + } + + } + + @Test + public void testInvalidOptionInJDBCConfig() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.invalidJDBCoption"); + server.startServer("invalidJDBCoption.log"); + + assertNotNull("The server should start", server.waitForStringInLog("CWWKF0011I.*")); + + // Clear log offsets so we can search for all warning messages + server.resetLogOffsets(); + + try { + List matches = server.findStringsInLogs("CWWKG0032W.*createDatabase.*whatever.*"); + // Start the server with invalid configuration and ensure that the warning is printed exactly once + assertEquals("There should be exactly one (1) warning for createDatabase", 1, matches.size()); + } finally { + server.stopServer(); + } + + } + + @Test + @ExpectedFFDC("java.net.MalformedURLException") + public void testInvalidOptionalInclude() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.invalidOptionalInclude"); + server.startServer("invalidOptionalInclude.log"); + + try { + // Start the server, skipping the optional include with a bad protocol - ensure warning message is printed + assertNotNull("There should be an error during server start", server.waitForStringInLog("CWWKG0084W.*bogus.*")); + } finally { + server.stopServer(); + } + + } +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ChildAliasTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ChildAliasTest.java new file mode 100755 index 00000000000..c518137022b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ChildAliasTest.java @@ -0,0 +1,236 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ChildAliasTest { + + /** + * Utility to set the method name as a String before the test + */ + @Rule + public TestName name = new TestName(); + + public String testName = ""; + + @Before + public void setTestName() { + // set the current test name + testName = name.getMethodName(); + } + + private static final String CONTEXT_ROOT = "/childalias"; + + private static LibertyServer testServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.childalias"); + + @BeforeClass + public static void setUpForConfigExtensionsTests() throws Exception { + //copy the extensions tests features into the server features location + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/childAliasTest-1.0.mf"); + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/childAliasTestB-1.0.mf"); + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/childAliasTestC-1.0.mf"); + + // Copy the config fat internal feature + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + //copy the extensions tests bundles into the server lib location + testServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.childalias_1.0.0.jar"); + testServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.childalias.b_1.0.0.jar"); + testServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.childalias.c_1.0.0.jar"); + + testServer.startServer(); + //make sure the URL is available + assertNotNull(testServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(testServer.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + testServer.stopServer(); + testServer.deleteFileFromLibertyInstallRoot("lib/features/childAliasTest-1.0.mf"); + testServer.deleteFileFromLibertyInstallRoot("lib/features/childAliasTestB-1.0.mf"); + testServer.deleteFileFromLibertyInstallRoot("lib/features/childAliasTestC-1.0.mf"); + testServer.deleteFileFromLibertyInstallRoot("lib/test.config.childalias_1.0.0.jar"); + testServer.deleteFileFromLibertyInstallRoot("lib/test.config.childalias.b_1.0.0.jar"); + testServer.deleteFileFromLibertyInstallRoot("lib/test.config.childalias.c_1.0.0.jar"); + + testServer.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + } + + @Test + public void testChildAlias1() throws Exception { + test(testServer); + } + + @Test + public void testChildAlias2() throws Exception { + test(testServer); + } + + @Test + public void testChildAliasSingleton1() throws Exception { + test(testServer); + } + + @Test + public void testChildAliasSingleton2() throws Exception { + test(testServer); + } + + @Test + public void testBundleOrdering1() throws Exception { + // Because this test ensures bundle ordering with config elements defined + // in different bundles, a fresh start of the server with the config is needed + // so that this test can run in any order while simulating bundle start ordering. + testServer.stopServer(); + testServer.setServerConfigurationFile("childalias/server.xml"); + testServer.startServer(); + + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverB.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testBundleOrdering2() throws Exception { + // Because this test ensures bundle ordering with config elements defined + // in different bundles, a fresh start of the server with the config is needed + // so that this test can run in any order while simulating bundle start ordering. + testServer.stopServer(); + testServer.setServerConfigurationFile("childalias/serverB.xml"); + testServer.startServer(); + + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testBundleOrderingAliasConflict() throws Exception { + // Because this test ensures bundle ordering with config elements defined + // in different bundles, a fresh start of the server with the config is needed + // so that this test can run in any order while simulating bundle start ordering. + testServer.stopServer(); + testServer.setServerConfigurationFile("childalias/serverB.xml"); + testServer.startServer(); + + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testRemoveChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC2.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testAddNewChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC3.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testUpdateChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC4.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testRemoveSingletonChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC5.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testAddNewSingletonChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC6.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + @Test + public void testUpdateSingletonChild() throws Exception { + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile("childalias/serverC7.xml"); + testServer.waitForConfigUpdateInLogUsingMark(null); + test(testServer); + } + + private void test(LibertyServer server) throws Exception { + HttpURLConnection con = null; + try { + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + + CONTEXT_ROOT + "/child-alias-test?" + "testName=" + testName); + con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + assertNotNull(is); + + String output = read(is); + System.out.println(output); + assertTrue(output, output.trim().startsWith("OK")); + } finally { + if (con != null) { + con.disconnect(); + } + } + } + + private static String read(InputStream in) throws IOException { + InputStreamReader isr = new InputStreamReader(in); + BufferedReader br = new BufferedReader(isr); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + return builder.toString(); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigExtensionsTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigExtensionsTest.java new file mode 100755 index 00000000000..87a0274de05 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigExtensionsTest.java @@ -0,0 +1,298 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +/** + * + */ +public class ConfigExtensionsTest { + + /** + * Utility to set the method name as a String before the test + */ + @Rule + public TestName name = new TestName(); + + public String testName = ""; + private static final String servicePidName = "service.pid"; + + @Before + public void setTestName() { + // set the current test name + testName = name.getMethodName(); + } + + private static final String CONTEXT_ROOT = "/config-extensions-test"; + private static final String PID_PASS = "PASSED: test bundle was called with properties for ID"; + private static LibertyServer extensionsServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.extensions"); + + @BeforeClass + public static void setUpForConfigExtensionsTests() throws Exception { + //copy the extensions tests features into the server features location + extensionsServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configExtensionsTest-1.0.mf"); + extensionsServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configExtensionsTestB-1.0.mf"); + //copy the extensions tests bundles into the server lib location + extensionsServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.extensions_1.0.0.jar"); + extensionsServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.extensions.b_1.0.0.jar"); + extensionsServer.copyFileToLibertyInstallRoot("lib", "bundles/test.config.extensions.schema.generator_1.0.0.jar"); + + //use our default server.xml to start with + extensionsServer.setServerConfigurationFile("extensions/server.xml"); + extensionsServer.startServer(); + //make sure the URL is available + extensionsServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT); + } + + @AfterClass + public static void shutdown() throws Exception { + extensionsServer.stopServer(); + // Delete the files we copied over + extensionsServer.deleteFileFromLibertyInstallRoot("lib/features/configExtensionsTest-1.0.mf"); + extensionsServer.deleteFileFromLibertyInstallRoot("lib/features/configExtensionsTestB-1.0.mf"); + + extensionsServer.deleteFileFromLibertyInstallRoot("lib/test.config.extensions_1.0.0.jar"); + extensionsServer.deleteFileFromLibertyInstallRoot("lib/test.config.extensions.b_1.0.0.jar"); + extensionsServer.deleteFileFromLibertyInstallRoot("lib/test.config.extensions.schema.generator_1.0.0.jar"); + + } + + /** + * Tests whether the ibm:extends works at runtime. + * The test verifies that the delegating factory service registered by the ExtendedMetatypeManager + * does make a call to the factory service that is provided by the super type + */ + @Test + public void testExtendsBasic() throws Exception { + String servicePid = servicePidName + "=test.config.extensions.super"; + //verify that the MSF was called with config for the correct id as expected + //If the ID property was incorrect, the delegating listener forwarded the wrong information or was provided the wrong information by config + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.config1&" + servicePid, PID_PASS); + } + + /** + * Tests whether the ibm:rename works at runtime. + * The test verifies that an attribute specified in the server.xml using an ibm:rename + * gets converted to the original name before being passed back to the super type. + */ + @Test + public void testExtendsRename() throws Exception { + String servicePid = servicePidName + "=test.config.extensions.super"; + //check that the renamed property came from test.config.extensions.sub configuration + //If the renamed property value was not correct, the delegating listener did not pass the value back to the original key name or did not detect the rename + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.config1&prop=testAttribute1&" + servicePid, "renamed value"); + } + + /** + * This is the same as testExtendsBasic, but for a sub type that ibm:extends another + * sub type, so it checks that the service factory call gets delegated all the way back to the + * top of the stack. + */ + @Test + public void testExtendsHierarchy() throws Exception { + String servicePid = servicePidName + "=test.config.extensions.super"; + //check that the properties supplied for next go through the hierarchy to the top parent + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.sub.config1&" + servicePid, PID_PASS); + + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.sub.config1&prop=testAttribute1&" + servicePid, "rqd"); + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.sub.config1&prop=testAttribute2&" + servicePid, "2"); + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.sub.config1&prop=testAttr3RenameSub&" + servicePid, "3"); + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.sub.sub.config1&prop=testAttribute4&" + servicePid, "four"); + } + + /** + * This tests the error scenario where someone tries to use the ibm:extends + * attribute on a non-factory PID + */ + @Test + public void testExtendsNonFactory() throws Exception { + String id = "CWWKG0061E"; + assertNotNull("The error message " + id + " for trying to use ibm:extends on a non-factory PID was not found", + extensionsServer.waitForStringInLog(id + ".*test\\.config\\.extensions\\.sub\\.non\\.factorypid.*test\\.config\\.extensions\\.sub")); + } + + /** + * This tests the error scenario where someone tries uses the ibm:extends + * attribute on a factory PID, but the specified super is a non-factory PID + */ + @Test + public void testExtendsNonFactorySuper() { + String id = "CWWKG0062E"; + assertNotNull("The error message " + id + " for trying to use ibm:extends with a non-factory super was not found", + extensionsServer.waitForStringInLog(id + ".*test\\.config\\.extensions\\.parent\\.non\\.factorypid.*test\\.config\\.extensions\\.extends\\.non\\.factorypid")); + } + + /** + * This tests the scenario where ibm:extends provides a value that does not exist + */ + @Test + public void testInvalidSuper() { + String id = "CWWKG0059E"; + assertNotNull("The error message " + id + " for invalid super was not found", + extensionsServer.waitForStringInLog(id + ".*test\\.config\\.extensions\\.sub\\.error\\.no\\.parent\\.pid.*test\\.config\\.extensions\\.invalid\\.parent")); + } + + /** + * This tests the scenario where ibm:extends provides a value that does not exist + */ + @Test + public void testInvalidRename() { + String id = "CWWKG0067E"; + assertNotNull( + "The error message " + id + " for invalid rename was not found", + extensionsServer.waitForStringInLog(id + + ".*testInvalidAttribute.*testInvalidAttrRename.*test\\.config\\.extensions\\.sub\\.error\\.no\\.parent\\.override\\.attr")); + } + + @Test + public void testRequiredAttributes() { + String id = "CWWKG0058E"; + //[ERROR ] CWWKG0058E: test.config.extensions.extends.attr.required is missing required attribute testAttr4 + assertNotNull("The error message " + id + " for a missing required attribute defined on a sub type was not found", + extensionsServer.waitForStringInLog(id + ".*" + + "test\\.config\\.extensions\\.extends\\.attr\\.required" + + ".*" + + "testAttr4")); + + assertNotNull("The error message " + id + " for a missing required attribute defined on a super type was not found", + extensionsServer.waitForStringInLog(id + ".*" + + "test\\.config\\.extensions\\.extends\\.attr\\.required\\.parent" + + ".*" + + "testAttribute2")); + } + + @Test + public void testAttemptToOverrideFinalMeta() { + String id = "CWWKG0060E"; + assertNotNull("The error message " + id + " for attempting to re-assign a final value was not found", + extensionsServer.waitForStringInLog(id + ".*" + "testOverrideFinal" + ".*" + "test.config.extensions.override.final" + ".*" + "test.config.extensions.super")); + } + + /** + * This tests the scenario where ibm:extends is used on an OCD when the super type does not exist. + * A feature is then installed that provides the super. + * After the feature is installed it should be possible to use the sub type. + * + * This test requires a different server configuration, so it must restore + * the original that other tests rely upon. + */ + @Test + public void testLateArrivingSecondBundleSuper() throws Exception { + try { + //stop the server, collecting logs from any previous tests + //and switch to the alternate serverB1.xml config + extensionsServer.stopServer(true); + extensionsServer.setServerConfigurationFile("extensions/serverB1.xml"); + extensionsServer.startServer(); + String id = "CWWKG0059E"; + assertNotNull("The error message " + id + " for invalid super was not found", + extensionsServer.waitForStringInLog(id + ".*test\\.config\\.extensions\\.different\\.bundle.*test\\.config\\.extensions\\.super")); + //now switch on the bundle providing the super (and our test system wab) + //by setting the serverB2.xml config + extensionsServer.setMarkToEndOfLog(); + extensionsServer.setServerConfigurationFile("extensions/serverB2.xml"); + //wait for our test app to be available + extensionsServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT); + String servicePid = servicePidName + "=test.config.extensions.super"; + //now check that the super got a call for the sub defined in the other bundle + HttpUtils.findStringInUrl(extensionsServer, CONTEXT_ROOT + "/test?id=test.config.extensions.different.bundle.config&" + servicePid, PID_PASS); + } finally { + //stop and package up this server + extensionsServer.stopServer(true); + //restore the original server.xml + //by setting our original server.xml back again + extensionsServer.setServerConfigurationFile("extensions/server.xml"); + //and finally restart the server + extensionsServer.startServer(); + //make sure the URL is available + extensionsServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT); + } + } + + /** + * This test requires a different server configuration, so it must restore + * the original that other tests rely upon. + * + * @throws Exception + */ + @Test + public void testSchemaGeneratorErrorMessages() throws Exception { + try { + extensionsServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configExtensionsSchemaGeneratorTest-1.0.mf"); + extensionsServer.stopServer(true); + extensionsServer.setServerConfigurationFile("extensions/serverSchemaGenerator.xml"); + extensionsServer.startServer(); + + String msgId = "CWWKG0063E"; + assertNotNull("Expected message " + msgId + " not found in log.", extensionsServer.waitForStringInLog(msgId + ".*testInvalidAttribute")); + + msgId = "CWWKG0064E"; + assertNotNull("Expected message " + msgId + " not found in log.", extensionsServer.waitForStringInLog(msgId + ".*testAttr2Rename")); + + msgId = "CWWKG0065E"; + assertNotNull("Expected message " + msgId + " not found in log.", extensionsServer.waitForStringInLog(msgId + ".*test.config.extensions.parent.non.factorypid")); + + msgId = "CWWKG0066E"; + assertNotNull("Expected message " + msgId + " not found in log.", extensionsServer.waitForStringInLog(msgId + ".*test.config.extensions.sub.error.no.parent.pid")); + } finally { + //stop and package up this server + extensionsServer.stopServer(true); + //restore the original server.xml + //by setting our original server.xml back again + extensionsServer.setServerConfigurationFile("extensions/server.xml"); + //and finally restart the server + extensionsServer.startServer(); + //make sure the URL is available + extensionsServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT); + } + } + + /** + * This tests the scenario where a PID that extends another PID that has a name=internal attr, is configured correctly. + */ + @Test + public void testInternalExtension() throws Exception { + + String servicePid = servicePidName + "=test.config.extensions.internal.super"; + + //check that the required attribute has been set on the internal super class + HttpUtils.findStringInUrl(extensionsServer, + CONTEXT_ROOT + "/test?pid=test.config.extensions.internal.sub1&id=internal1&prop=internalAttr1&" + servicePid, + "sub1Attr1"); + } + + /** + * This tests the scenario where a PID that extends another PID that has a name=internal attr, and is missing a required attr, issues the + * expected error message. + */ + @Test + public void testInternalExtensionWithMissingRequiredAttribute() throws Exception { + + String id = "CWWKG0058E"; + assertNotNull( + "The error message " + id + " for internal required attribute was not found", + extensionsServer.waitForStringInLog(id + ".*internalsub2.*internalAttr1")); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigValidatorTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigValidatorTest.java new file mode 100755 index 00000000000..a84ea7cb8ac --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ConfigValidatorTest.java @@ -0,0 +1,112 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import componenttest.annotation.ExpectedFFDC; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Tests the XML signing and validation functions, ensuring correct behavior when signing is enforced + * and invalid documents are encountered. + */ +public class ConfigValidatorTest { + + // Since we have tracing enabled give server longer timeout to start up. + private static final long SERVER_START_TIMEOUT = 30 * 1000; + + @Test + @ExpectedFFDC({ "com.ibm.websphere.config.ConfigValidationException", "java.lang.ClassNotFoundException" }) + public void testValidator() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.validator"); + String jarName = "com.ibm.ws.config.ext_1.0." + server.getMicroVersion() + ".jar"; + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + // Backup fragment and bring in embedder validation fragment + LibertyFileManager.renameLibertyFile(server.getMachine(), + server.getInstallRoot() + "/lib/" + jarName, + server.getInstallRoot() + "/lib/" + jarName + ".bak"); + server.copyFileToLibertyInstallRoot("lib", "validator/" + jarName); + + try { + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + server.startServer("goodSignature.log", true, true, false); + assertNotNull("Configuration validation should be issued", + server.waitForStringInLog("CWWKG0043I:.*EmbeddedXMLConfigValidator")); + + // Copy in invalid server.xml, trigger refresh + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("validator/bad-signature.xml"); + assertNotNull("An error message should be issued with invalid config refresh", + server.waitForStringInLog("CWWKG0047E:.*")); + assertNotNull("A warning message should be issued with invalid config refresh", + server.waitForStringInLog("CWWKG0057W:.*")); + assertTrue(server.isStarted()); + + // Stop server, don't clean up. + server.stopServer(false); + + try { + server.startServerExpectFailure("badSignature.log", false, false); + } catch (Exception e) { + System.out.println("Caught exception of type " + e.getClass()); + } + assertNotNull("An error message should be issued on invalid config startup", + server.waitForStringInLog("CWWKG0047E:.*")); + assertNotNull("A fatal message should be issued on invalid config startup", + server.waitForStringInLog("CWWKG0044E:.*")); + assertNotNull("The server should be stopped after invalid config startup", + server.waitForStringInLog("CWWKE0036I:.*")); + + // Stop server, don't clean up. + server.stopServer(false); + + // Copy in invalid server.xml + server.setServerConfigurationFile("validator/dropins-enabled.xml"); + + try { + server.startServerExpectFailure("dropinsEnabled.log", false, false); + } catch (Exception e) { + System.out.println("Caught exception of type " + e.getClass()); + } + assertNotNull("There should be a message about a valid signature", + server.waitForStringInLog("CWWKG0055I:.*")); + assertNotNull("There should be a fatal message because dropins are enabled", + server.waitForStringInLog("CWWKG0056E:.*")); + assertNotNull("The server should be stopped after invalid config startup", + server.waitForStringInLog("CWWKE0036I:.*")); + + } finally { + // Just in case one of the conditions above failed, make sure the server + // stops. Skip the server archive here (it would get skipped for already stopped) + server.stopServer(false); + + // Make sure we *do* capture the data for these attempts + server.postStopServerArchive(); + + // Restore default validation fragment + LibertyFileManager.deleteLibertyFile(server.getMachine(), + server.getInstallRoot() + "/lib/" + jarName); + LibertyFileManager.renameLibertyFile(server.getMachine(), + server.getInstallRoot() + "/lib/" + jarName + ".bak", + server.getInstallRoot() + "/lib/" + jarName); + } + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DelayedVariableTests.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DelayedVariableTests.java new file mode 100755 index 00000000000..bc10c617f11 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DelayedVariableTests.java @@ -0,0 +1,56 @@ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class DelayedVariableTests extends ServletRunner { + + private static final String CONTEXT_ROOT = "varmergedconfig"; + + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + @Override + protected String getServletMapping() { + return "delayedVarTests"; + } + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.delayedVar"); + + @Test + public void testVariableDelay() throws Exception { + test(server); + } + + @BeforeClass + public static void setUpForMergedConfigTests() throws Exception { + //copy the config feature into the server features location + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/delayedVariable-1.0.mf"); + + //copy the bundle into the server lib location + server.copyFileToLibertyInstallRoot("lib", "bundles/test.config.variables_1.0.0.jar"); + + server.startServer("delayedVariables.log"); + //make sure the URL is available + assertNotNull(server.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(server.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + server.deleteFileFromLibertyInstallRoot("lib/test.config.variables_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/features/delayedVariable-1.0.mf"); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DropinsTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DropinsTest.java new file mode 100755 index 00000000000..bcb4ce55d85 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/DropinsTest.java @@ -0,0 +1,240 @@ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.annotation.ExpectedFFDC; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class DropinsTest extends ServletRunner { + + private static final String CONTEXT_ROOT = "configdropins"; + + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + @Override + protected String getServletMapping() { + return "dropinsTest"; + } + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.dropins"); + + @Test + public void testNonXmlFile() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple.notxml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple.notxml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + @ExpectedFFDC("com.ibm.websphere.config.ConfigParserException") + public void testBrokenDropin() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple.xml"); + server.addDropinDefaultConfiguration("dropins/aBrokenFile.xml"); + server.addDropinOverrideConfiguration("dropins/aBrokenFile.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + assertEquals("There should be two CWWKG0014E errors", 2, server.waitForMultipleStringsInLog(2, "CWWKG0014E")); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple.xml"); + server.deleteDropinDefaultConfiguration("aBrokenFile.xml"); + server.deleteDropinOverrideConfiguration("aBrokenFile.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testSimpleDefaults() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testSimpleOverrides() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testSimpleOverrides2() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testDefaultsOrdering() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testOverridesOrdering() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("simple2.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testNoServerValue1() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testNoServerValue2() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @Test + public void testNoServerValue3() throws Exception { + try { + server.setMarkToEndOfLog(); + server.addDropinDefaultConfiguration("dropins/alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.addDropinOverrideConfiguration("dropins/blibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } finally { + server.setMarkToEndOfLog(); + server.deleteDropinDefaultConfiguration("alibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + server.setMarkToEndOfLog(); + server.deleteDropinOverrideConfiguration("blibrary.xml"); + server.waitForConfigUpdateInLogUsingMark(null); + } + } + + @BeforeClass + public static void setUpForDropinsTests() throws Exception { + //copy the feature into the server features location + + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + // Delete dropin configurations just in case + server.deleteAllDropinConfigurations(); + + server.startServer("configDropins.log"); + + //make sure the URL is available + assertNotNull(server.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(server.waitForStringInLog("CWWKF0011I")); + + } + + @AfterClass + public static void shutdown() throws Exception { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FATSuite.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FATSuite.java new file mode 100755 index 00000000000..845f3c16802 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FATSuite.java @@ -0,0 +1,39 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ + ServerConfigTest.class, + ConfigExtensionsTest.class, + ConfigValidatorTest.class, + ChildAliasTest.class, + ProductExtensionsTest.class, + BadConfigTests.class, + MergedConfigTests.class, + VariableMergeTests.class, + MetatypeProviderTest.class, + WSConfigurationHelperTest.class, + SchemaGeneratorMBeanTest.class, + FeaturelistGeneratorMBeanTest.class, + ServerXMLConfigurationMBeanTest.class, + DropinsTest.class, + DelayedVariableTests.class + +}) +public class FATSuite { + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeatureUpdateTests.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeatureUpdateTests.java new file mode 100755 index 00000000000..64da2e209a9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeatureUpdateTests.java @@ -0,0 +1,107 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Collections; +import java.util.Set; + +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class FeatureUpdateTests { + private void test(LibertyServer server, String testUri) throws Exception { + HttpURLConnection con = null; + try { + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + testUri); + con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + assertNotNull(is); + + String output = read(is); + System.out.println(output); + assertTrue(output, output.trim().startsWith("Test Passed")); + } finally { + if (con != null) { + con.disconnect(); + } + } + } + + private static String read(InputStream in) throws IOException { + InputStreamReader isr = new InputStreamReader(in); + BufferedReader br = new BufferedReader(isr); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + return builder.toString(); + } + + private final Set emptySet = Collections.emptySet(); + + // Just make sure we don't get an FFDC when we remove a feature that something else has a reference to. + // In this test, the reference is also ibm:flat + @Test + public void testFeatureRemovalFlat() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.features"); + server.startServer("removeJDBCFeature.log"); + + try { + // switch to new configuration to remove jdbc-4.0 feature + server.setServerConfigurationFile("featureRemove/serverRemoveJDBC.xml"); + assertNotNull("The server configuration update should complete", + server.waitForConfigUpdateInLogUsingMark(emptySet)); + } finally { + server.stopServer(); + } + + } + + // Just make sure we don't get an FFDC when we remove a feature that something else has a reference to. + // In this test, the reference is not marked ibm:flat + // We're also removing the configuration that the OpenID feature config points to. + @Test + public void testFeatureRemoval() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.features"); + server.startServer("removeOpenIDFeature.log"); + + try { + // switch to new configuration to remove jdbc-4.0 feature + server.setServerConfigurationFile("featureRemove/serverRemoveOpenID.xml"); + assertNotNull("The server configuration update should complete", + server.waitForConfigUpdateInLogUsingMark(emptySet)); + } finally { + server.stopServer(); + } + + } +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeaturelistGeneratorMBeanTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeaturelistGeneratorMBeanTest.java new file mode 100755 index 00000000000..08210a096c2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/FeaturelistGeneratorMBeanTest.java @@ -0,0 +1,376 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import javax.management.JMX; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.config.mbeans.FeatureListMBean; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * FAT-Tests to test the functionality of com.ibm.websphere.config.mbeans.FeatureListMBean + */ +public class FeaturelistGeneratorMBeanTest { + + private static Class logClass = FeaturelistGeneratorMBeanTest.class; + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.schemaGen.mbean"); + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + + private static ObjectName featurelistGenObjName; + private static ObjectName fileTranObjectName; + + @BeforeClass + public static void setUp() throws Exception { + final String methodName = "setUp"; + Log.entering(logClass, methodName); + + outputDir = server.getServerRoot(); + Log.info(logClass, methodName, "serverRoot=" + outputDir); + + Log.info(logClass, methodName, "Starting server=" + server.getServerName()); + server.startServer(); + + Log.info(logClass, methodName, "Waiting for 'CWWKT0016I.*IBMJMXConnectorREST'"); + assertNotNull("'CWWKT0016I.*IBMJMXConnectorREST' was not received on server", + server.waitForStringInLog("CWWKT0016I.*IBMJMXConnectorREST")); + + Log.info(logClass, methodName, "Waiting for 'CWWKO0219I.*ssl'"); + assertNotNull("'CWWKO0219I.*ssl' was not recieved on server", + server.waitForStringInLog("CWWKO0219I.*ssl")); + + Log.info(logClass, methodName, "Waiting for 'CWPKI0803A.*ssl'"); + assertNotNull("'CWPKI0803A.*ssl' was not generated on server", + server.waitForStringInLog("CWPKI0803A")); + + Log.info(logClass, methodName, "Waiting for 'CWWKS0008I: The security service is ready'"); + assertNotNull("'CWWKS0008I: The security service is ready' was not generated on server", + server.waitForStringInLog("CWWKS0008I")); + + Log.info(logClass, methodName, "Waiting for 'CWWKS4105I: LTPA configuration is ready'"); + assertNotNull("'CWWKS4105I: LTPA configuration is ready' was not generated on server", + server.waitForStringInLog("CWWKS4105I")); + + // Set up the trust store + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + HostnameVerifier hv = new HostnameVerifier() { + @Override + public boolean verify(String urlHostName, SSLSession session) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(hv); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + Log.info(logClass, methodName, "JMXServiceURL=" + url.toString()); + jmxConnector = JMXConnectorFactory.connect(url, environment); + assertNotNull("JMXConnector should not be null", jmxConnector); + connection = jmxConnector.getMBeanServerConnection(); + assertNotNull("MBeanServerConnection should not be null", connection); + + featurelistGenObjName = new ObjectName(FeatureListMBean.OBJECT_NAME); + fileTranObjectName = new ObjectName(FileTransferMBean.OBJECT_NAME); + + Log.exiting(logClass, "setUp"); + } + + @AfterClass + public static void cleanUp() throws Exception { + String methodName = "tearDown"; + Log.entering(logClass, methodName); + + if (server != null && server.isStarted()) { + Log.finer(logClass, methodName, "Server is up, stopping it"); + jmxConnector.close(); + server.stopServer(); + } + Log.exiting(logClass, methodName); + } + + /** + * Invoke FeaturelistMBean.generate method + * + * @param params + * @return response from MBean invoke + * @throws Exception + */ + private Map invokeFeatureListMBeanGenerate(Object[] params) throws Exception { + Log.entering(logClass, "invokeFeatureListMBeanGenerate", params); + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String" }; + + @SuppressWarnings("unchecked") + Map returnedMap = (Map) connection.invoke(featurelistGenObjName, "generate", params, signature); + Log.info(logClass, "invokeFeatureListMBeanGenerate", returnedMap.toString()); + Log.exiting(logClass, "invokeFeatureListMBeanGenerate", returnedMap); + return returnedMap; + } + + /** + * Invoke FileTransferMBean.downloadFile method + * + * @param params + * @throws Exception + */ + private void invokeFileTransferMBeanDownloadFile(Object[] params) throws Exception { + Log.entering(logClass, "invokeFileTransferMBeanDownloadFile", params); + String[] signature = new String[] { "java.lang.String", "java.lang.String" }; + connection.invoke(fileTranObjectName, "downloadFile", params, signature); + Log.exiting(logClass, "invokeFileTransferMBeanDownloadFile"); + } + + /** + * Invoke FileTransferMBean.deleteFile method + * + * @param params + * @throws Exception + */ + private void invokeFileTransferMBeanDeleteFile(Object[] params) throws Exception { + Log.entering(logClass, "invokeFileTransferMBeanDeleteFile", params); + String[] signature = new String[] { "java.lang.String" }; + connection.invoke(fileTranObjectName, "deleteFile", params, signature); + Log.exiting(logClass, "invokeFileTransferMBeanDeleteFile"); + } + + /** + * Invoke FeaturelistMBean.generate method + * + * @param encoding, locale, productExtension is empty + * @throws Exception + */ + @Test + public void testEmptyStrings() throws Exception { + //Invoke featureList generation + Object[] params = new String[] { "", "", "" }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue((Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Ensure generated file is bigger than 0.1 MB + String filePath = returnedMap.get(FeatureListMBean.KEY_FILE_PATH).toString(); + File file = new File(filePath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath(), file.length() > 100000); + } + + /** + * Invoke FeaturelistMBean.generate method + * + * @param encoding, locale, productExtension is empty + * @throws Exception + */ + @Test + public void testInvalidEncoding() throws Exception { + final String encodingValue = "en-Test"; + + Object[] params = new String[] { encodingValue, null, null }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue("Return Code should be 21 and not 0", (Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) != 0); + + //Retrieve output + String output = (String) returnedMap.get(FeatureListMBean.KEY_OUTPUT); + assertTrue("Output does not contain expected UnsupportedEncodingException. output=" + output, output.contains("java.io.UnsupportedEncodingException: " + encodingValue)); + } + + /** + * Invoke FeaturelistMBean.generate method + * + * @param encoding, locale is invalid, productExtension + * @throws Exception + */ + @Test + public void testInvalidLocale() throws Exception { + final String localeValue = "localeTest"; + + Object[] params = new String[] { null, localeValue, null }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue("Return Code should be 0", (Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Ensure generated file is bigger than 0.1 MB + String filePath = returnedMap.get(FeatureListMBean.KEY_FILE_PATH).toString(); + File file = new File(filePath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath(), file.length() > 100000); + } + + /** + * Invoke FeaturelistMBean.generate method + * + * @param encoding, locale, productExtension is invalid + * @throws Exception + */ + @Test + public void testInvalidProductExt() throws Exception { + final String productExtValue = "productExt"; + + Object[] params = new String[] { null, null, productExtValue }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue("Return Code should be 21 and not 0", (Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 21); + + //Retrieve output + String output = (String) returnedMap.get(FeatureListMBean.KEY_OUTPUT); + assertTrue("Output does not contain expected CWWKG0080E. output=" + output, + output.contains("CWWKG0080E")); + } + + /** + * Invoke FeaturelistMBean.generate method and using FileTransferMBean remotely to download + * feature list file and deletes it + * + * @param encoding, locale, productExtension is empty + * @throws Exception + */ + @Test + public void testGenerateDownloadAndDelete() throws Exception { + Object[] params = new String[] { "UTF-16", "fr", "" }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue((Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = returnedMap.get(FeatureListMBean.KEY_FILE_PATH).toString(); + String targetPath = outputDir + "/download_target/featurelistNonDefault.xml"; + + params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than 0.1 MB + File file = new File(targetPath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath(), file.length() > 100000); + + // Remotely delete the generated featurelist file + RemoteFile remoteFile = server.getMachine().getFile(sourcePath); + + //first check if the file exists + assertTrue("Generated featurelist file should exist at this point. remoteFile=" + remoteFile.getAbsolutePath(), remoteFile.exists()); + + params = new Object[] { remoteFile.getAbsolutePath() }; + invokeFileTransferMBeanDeleteFile(params); + + //Verify the file is deleted + assertFalse("Generated featurelist file should have been deleted. remoteFile=" + remoteFile.getAbsolutePath(), remoteFile.exists()); + } + + /** + * Invoke FeaturelistMBean.generate method with correct parameters + * + * @param encoding, locale, productExtension + * @throws Exception + */ + @Test + public void testGenerateSuccessfulFeaturelist() throws Exception { + Object[] params = new String[] { "UTF-8", Locale.getDefault().toString(), null }; //encoding, locale, productExtension + Map returnedMap = invokeFeatureListMBeanGenerate(params); + + //Check return code + assertTrue((Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Ensure generated file is bigger than 0.1 MB + String filePath = returnedMap.get(FeatureListMBean.KEY_FILE_PATH).toString(); + File file = new File(filePath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath(), file.length() > 100000); + + } + + /** + * Invoke FeaturelistMBean.generate method using the JMX MBean API + * downloads the feature list and transfers it over using FileTransfer MBean + * + * @param encoding, locale, productExtension + * @throws Exception + */ + @Test + public void testFeaturelistGenMBeanCallAPI() throws Exception { + FeatureListMBean featurelistGenMbean = JMX.newMBeanProxy(connection, featurelistGenObjName, FeatureListMBean.class); + assertNotNull("We should have got access to the FeatureListMBean API", featurelistGenMbean); + + Map returnedMap = featurelistGenMbean.generate(null, null, null); //encoding, locale, productExtension + + //Check return code + assertTrue((Integer) returnedMap.get(FeatureListMBean.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = returnedMap.get(FeatureListMBean.KEY_FILE_PATH).toString(); + String targetPath = outputDir + "/download_target/featurelistNonDefault.xml"; + + Object[] params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than 0.1 MB + File file = new File(targetPath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath(), file.length() > 100000); + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MergedConfigTests.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MergedConfigTests.java new file mode 100755 index 00000000000..2d490b5b590 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MergedConfigTests.java @@ -0,0 +1,141 @@ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class MergedConfigTests extends ServletRunner { + + private static final String CONTEXT_ROOT = "mergedconfig"; + private static final String ALL_IN_ONE_SERVER = "merge/allInOne.xml"; + private static final String IGNORE_SERVER = "merge/ignore.xml"; + private static final String REPLACE_SERVER = "merge/replace.xml"; + private static final String MERGE_SERVER = "merge/merge.xml"; + private static final String IGNORE_REPLACE_SERVER = "merge/ignoreReplace.xml"; + private static final String FOUR_LEVEL_REPLACE_SERVER = "merge/fourLevelReplace.xml"; + private static final String FOUR_LEVEL_IGNORE_SERVER = "merge/fourLevelIgnore.xml"; + + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + @Override + protected String getServletMapping() { + return "mergedConfigTest"; + } + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.merging"); + + @Test + public void testMergedConfig() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(ALL_IN_ONE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + + } + + @Test + public void testMergedIncludesReplace() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(REPLACE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesIgnore() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(IGNORE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesMerge() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(MERGE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesIgnoreReplace() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(IGNORE_REPLACE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesFourLevelReplace() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(FOUR_LEVEL_REPLACE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesFourLevelIgnore() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(FOUR_LEVEL_IGNORE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testDefaultInstances1() throws Exception { + // Test that a normal defaultInstances file was read. This works with any of the server.xml files, so no need to + // update. + test(server); + } + + @Test + public void testDefaultInstances2() throws Exception { + // Verify onConflict="merge_when_exists". Works with any server.xml from these tests, so no need to update it. + test(server); + } + + @Test + public void testDefaultInstances3() throws Exception { + // Verify onConflict="merge_when_does_not_exist". Works with any server.xml from these tests, so no need to update it. + test(server); + } + + @BeforeClass + public static void setUpForMergedConfigTests() throws Exception { + //copy the feature into the server features location + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/mergedConfigTest-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + //copy the bundle into the server lib location + server.copyFileToLibertyInstallRoot("lib", "bundles/test.merged.config_1.0.0.jar"); + + server.startServer("mergedConfig.log"); + //make sure the URL is available + assertNotNull(server.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(server.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/features/mergedConfigTest-1.0.mf"); + server.deleteFileFromLibertyInstallRoot("lib/test.merged.config_1.0.0.jar"); + server.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MetatypeProviderTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MetatypeProviderTest.java new file mode 100755 index 00000000000..702bbe38371 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/MetatypeProviderTest.java @@ -0,0 +1,88 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +//@Mode(TestMode.FULL) +public class MetatypeProviderTest extends ServletRunner { + + private static final String CONTEXT_ROOT = "metatypeprovider"; + private static final String NO_METATYPE_SERVER = "metatype/noMetatypeServer.xml"; + private static final String ORIGINAL_SERVER = "metatype/server.xml"; + + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + @Override + protected String getServletMapping() { + return "providerTest"; + } + + private static LibertyServer testServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.metatype.provider"); + + @BeforeClass + public static void setUpForMetatypeProviderTests() throws Exception { + //copy the feature into the server features location + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/metatypeProviderTest-1.0.mf"); + testServer.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + //copy the bundle into the server lib location + testServer.copyFileToLibertyInstallRoot("lib", "bundles/test.metatype.provider_1.0.0.jar"); + + testServer.startServer(); + //make sure the URL is available + assertNotNull(testServer.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(testServer.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + testServer.stopServer(); + testServer.deleteFileFromLibertyInstallRoot("lib/features/metatypeProviderTest-1.0.mf"); + testServer.deleteFileFromLibertyInstallRoot("lib/test.metatype.provider_1.0.0.jar"); + testServer.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + } + + @Test + public void testMetatypeProvider1() throws Exception { + test(testServer); + } + + @Test + public void testMetatypeProvider2() throws Exception { + test(testServer); + } + + @Test + public void testMetatypeProvider3() throws Exception { + + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile(NO_METATYPE_SERVER); + testServer.waitForConfigUpdateInLogUsingMark(null); + + test(testServer); + + testServer.setMarkToEndOfLog(); + testServer.setServerConfigurationFile(ORIGINAL_SERVER); + testServer.waitForConfigUpdateInLogUsingMark(null); + } +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ProductExtensionsTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ProductExtensionsTest.java new file mode 100755 index 00000000000..314891cd122 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ProductExtensionsTest.java @@ -0,0 +1,384 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +/** + * Schema product extension tests. + */ +public class ProductExtensionsTest { + public static final Class c = ProductExtensionsTest.class; + public static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.product.extension"); + public static String javaExc; + public static String installRoot; + + // Product extension variables. + public static final String PRODUCT_FEATURE_PATH = "producttest/lib/features/"; + public static final String PRODUCT_BUNDLE_PATH = "producttest/lib/"; + public static final String PRODUCT_EXTENSIONS_PATH = "etc/extensions/"; + public static final String PRODUCT_EXT_NAME = "testproduct"; + public static final String PRODUCT_FEATURE_PROPERTIES_FILE = "productExtensions/propertiesFiles/testproduct.properties"; + public static final String PRODUCT_FEATURE_PRODTEST_MF = "productExtensions/features/prodtest1-1.0.mf"; + public static final String PRODUCT_FEATURE_PRODTEST_JAR = "bundles/test.prod.extensions_1.0.0.jar"; + public static final String PROD_EXT_CONTEXT_ROOT = "/product1-extensions-test"; + public static final String PRODUCT_CONFIG_ALIAS = "prodtest1Config"; + public static final String PRODUCT_SERVER_XML_INVALID = "productExtensions/config/prod.ext.invalid.server.xml"; + public static final String PRODUCT_SERVER_XML_VALID = "productExtensions/config/prod.ext.valid.server.xml"; + public static final String PRODUCT_SERVER_XML_USING_FACTORY_PID = "productExtensions/config/prod.ext.factory.pid.server.xml"; + + // User product extension variables. + public static final String USER_FEATURE_PATH = "usr/extension/lib/features/"; + public static final String USER_BUNDLE_PATH = "usr/extension/lib/"; + public static final String USER_FEATURE_PRODTEST_MF = "productExtensions/features/userProdtest1-1.0.mf"; + public static final String USER_BUNDLE_JAR = "bundles/test.user.prod.extensions_1.0.0.jar"; + public static final String USER_CONFIG_ALIAS = "userProdtest1Config"; + public static final String USER_PRODUCT_SERVER_XML_INVALID = "productExtensions/config/user.prod.ext.invalid.server.xml"; + public static final String USER_PRODUCT_SERVER_XML_VALID = "productExtensions/config/user.prod.ext.valid.server.xml"; + public static final String USER_PRODUCT_SERVER_XML_USING_FACTORY_PID = "productExtensions/config/user.prod.ext.factory.pid.server.xml"; + private static final String USER_PROD_EXT_CONTEXT_ROOT = "/user.product1-extensions-test"; + + // Other variables. + public static final String CORE_PRODUCT_NAME = "core"; + public static final String USR_PRODUCT_NAME = "usr"; + private static final String PASS_STRING = "TEST_PASSED"; + + /** + * Setup the environment. + * + * @param svr The server instance. + * + * @throws Exception + */ + @BeforeClass + public static void setupEnv() throws Exception { + final String METHOD_NAME = "setup"; + Log.entering(c, METHOD_NAME); + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.product.extension"); + installRoot = server.getInstallRoot(); + javaExc = System.getProperty("java.home") + "/bin/java"; + Log.info(c, METHOD_NAME, "java: " + javaExc); + Log.info(c, METHOD_NAME, "installRoot: " + installRoot); + + // Install product extensions. + installProductExtension(); + installUserProductExtension(); + + // Create a directory to store the output files. + File toolsOutputDir = new File(installRoot + "/tool.output.dir"); + toolsOutputDir.mkdir(); + } + + /** + * Cleans up the installation from any files that may have been left around. + * + * @throws Exception + */ + @AfterClass + public static void AfterClassCleanup() throws Exception { + final String METHOD_NAME = "cleanup"; + Log.entering(c, METHOD_NAME); + + tidyup(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests that the ws-schema.jar tool accounts for product extensions. + * The test is expected successfully complete and the product names must be tagged appropriately in the + * serverType section of the generated schema. + * + * @throws Exception + */ + @Test + public void testSchemaGeneratorToolOutputForTaggedProdExtEntries() throws Exception { + final String METHOD_NAME = "testFeatureToolWithProdExtArgument"; + Log.entering(c, METHOD_NAME); + + String[] parms = new String[] { "-jar", installRoot + "/bin/tools/ws-schemagen.jar", installRoot + "/tool.output.dir/schema.xml" }; + ProgramOutput po = server.getMachine().execute(javaExc, parms, installRoot); + logInfo(po, "tool.output.dir/prodExtFeaturelist.xml"); + + RemoteFile rf = server.getFileFromLibertyInstallRoot("tool.output.dir/schema.xml"); + + InputStream in = rf.openForReading(); + DataInputStream dis = new DataInputStream(in); + BufferedReader br = new BufferedReader(new InputStreamReader(dis)); + String line; + + boolean foundUsrConfigElement = false; + boolean foundProdConfigElement = false; + int prefixedElementsCount = 0; + boolean foundServerTypeElement = false; + while ((line = br.readLine()) != null) { + if (!foundServerTypeElement && line.contains("name=\"serverType\"")) { + foundServerTypeElement = true; + } + + if (foundServerTypeElement) { + if (line.contains("name=\"" + USR_PRODUCT_NAME + "_" + USER_CONFIG_ALIAS + "\"")) { + prefixedElementsCount++; + foundUsrConfigElement = true; + } else if (line.contains("name=\"" + PRODUCT_EXT_NAME + "_" + PRODUCT_CONFIG_ALIAS + "\"")) { + prefixedElementsCount++; + foundProdConfigElement = true; + } + } + } + + assertTrue("There should have been only 2 elements prefixed with _", (prefixedElementsCount == 2)); + assertTrue("There should have been a " + USR_PRODUCT_NAME + "_" + USER_CONFIG_ALIAS + " element in the schemaOutput.", foundUsrConfigElement); + assertTrue("There should have been a " + PRODUCT_EXT_NAME + "_" + PRODUCT_CONFIG_ALIAS + " element in the schemaOutput.", foundProdConfigElement); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Test a product extension installation with metatype configuration. + * The test is expected to successfully complete. + * + * @throws Exception + */ + @Test + public void testProductInstallWithMetatypeConfig() throws Exception { + String method = "testProductInstallWithMetatypeConfig"; + Log.entering(c, method); + + server.setServerConfigurationFile(PRODUCT_SERVER_XML_VALID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, PROD_EXT_CONTEXT_ROOT + "/test", PASS_STRING); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Test a product extension installation with the an invalid OCD alias configuration. + * + * @throws Exception + */ + @Test + public void testProductInstallWithInvalidAliasConfig() throws Exception { + String method = "testProductInstallWithInvalidAliasConfig"; + Log.entering(c, method); + + server.setServerConfigurationFile(PRODUCT_SERVER_XML_INVALID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, PROD_EXT_CONTEXT_ROOT + "/test", "TEST_FAILED: getAttribute1 returned: null"); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Test a user product extension installation with metatype configuration. + * The test is expected to successfully complete. + * + * @throws Exception + */ + @Test + public void testUserProductInstallWithMetatypeConfig() throws Exception { + String method = "testUserProductInstallWithMetatypeConfig"; + Log.entering(c, method); + + server.setServerConfigurationFile(USER_PRODUCT_SERVER_XML_VALID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + USER_PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, USER_PROD_EXT_CONTEXT_ROOT + "/test", PASS_STRING); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Test a product extension installation with the an invalid OCD alias configuration. + * + * @throws Exception + */ + @Test + public void testUserProductInstallWithInvalidAliasConfig() throws Exception { + String method = "testUserProductInstallWithInvalidAliasConfig"; + Log.entering(c, method); + + server.setServerConfigurationFile(USER_PRODUCT_SERVER_XML_INVALID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + USER_PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, USER_PROD_EXT_CONTEXT_ROOT + "/test", "TEST_FAILED: getAttribute1 returned: null"); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Test a product extension installation with metatype configuration using the factory pid + * The test is expected to successfully complete. + * + * @throws Exception + */ + @Test + public void testProductInstallWithMetatypeConfigUsingFactoryPid() throws Exception { + String method = "testProductInstallWithMetatypeConfigUsingFactoryPid"; + Log.entering(c, method); + + server.setServerConfigurationFile(PRODUCT_SERVER_XML_USING_FACTORY_PID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, PROD_EXT_CONTEXT_ROOT + "/test", PASS_STRING); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Test a user product extension installation with metatype configuration using the factory pid. + * The test is expected to successfully complete. + * + * @throws Exception + */ + @Test + public void testUserProductInstallWithMetatypeConfigUsingFactoryPid() throws Exception { + String method = "testUserProductInstallWithMetatypeConfigUsingFactoryPid"; + Log.entering(c, method); + + server.setServerConfigurationFile(USER_PRODUCT_SERVER_XML_USING_FACTORY_PID); + server.startServer(); + try { + server.waitForStringInLog("CWWKT0016I.*" + USER_PROD_EXT_CONTEXT_ROOT); + HttpUtils.findStringInUrl(server, USER_PROD_EXT_CONTEXT_ROOT + "/test", PASS_STRING); + } finally { + server.stopServer(); + } + + Log.exiting(c, method); + } + + /** + * Prints an extended debug output. + * + * @param po The programOutput + * @param fileName + * @throws Exception + */ + public void logInfo(ProgramOutput po, String fileName) throws Exception { + String methodName = "logInfo"; + Log.info(c, methodName, "Return Code: " + po.getReturnCode() + ". STDOUT: " + po.getStdout()); + + if (po.getReturnCode() != 0) { + Log.info(c, methodName, "STDERR: " + po.getStderr()); + RemoteFile rf = server.getFileFromLibertyInstallRoot(fileName); + BufferedReader br = new BufferedReader(new InputStreamReader(rf.openForReading())); + StringBuffer sb = new StringBuffer(); + String line = null; + while ((line = br.readLine()) != null) { + sb.append(line); + sb.append("\n"); + } + Log.info(c, methodName, "File " + fileName + " content:\n" + sb.toString()); + br.close(); + } + } + + /** + * Installs a specific product extension. + * + * @throws Exception + */ + public static void installProductExtension() throws Exception { + String method = "installProductExtension"; + Log.entering(c, method, "Intalling product extension: " + PRODUCT_EXT_NAME + "."); + + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, PRODUCT_FEATURE_PRODTEST_MF); + assertTrue("Product feature: " + PRODUCT_FEATURE_PRODTEST_MF + " should have been copied to: " + PRODUCT_FEATURE_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_FEATURE_PATH + "prodtest1-1.0.mf")); + + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, PRODUCT_FEATURE_PRODTEST_JAR); + assertTrue("Product bundle: " + PRODUCT_FEATURE_PRODTEST_JAR + " should have been copied to: " + PRODUCT_BUNDLE_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_BUNDLE_PATH + "test.prod.extensions_1.0.0.jar")); + + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, PRODUCT_FEATURE_PROPERTIES_FILE); + assertTrue("Product extension props file: " + PRODUCT_FEATURE_PROPERTIES_FILE + " should have been copied to: " + PRODUCT_EXTENSIONS_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + "testproduct.properties")); + + Log.exiting(c, method, "Product extension: " + PRODUCT_EXT_NAME + " has been installed."); + + } + + /** + * Installs a specific product extension if the default USR location. + * + * @throws Exception + */ + public static void installUserProductExtension() throws Exception { + String method = "installUserProductExtension"; + Log.entering(c, method, "Intalling user product extension."); + + server.copyFileToLibertyInstallRoot(USER_FEATURE_PATH, USER_FEATURE_PRODTEST_MF); + assertTrue("User product feature: " + USER_FEATURE_PRODTEST_MF + " should have been copied to: " + USER_FEATURE_PATH, + server.fileExistsInLibertyInstallRoot(USER_FEATURE_PATH + "userProdtest1-1.0.mf")); + + server.copyFileToLibertyInstallRoot(USER_BUNDLE_PATH, USER_BUNDLE_JAR); + assertTrue("User product bundle: " + USER_BUNDLE_JAR + " should have been copied to: " + USER_BUNDLE_PATH, + server.fileExistsInLibertyInstallRoot(USER_BUNDLE_PATH + "test.user.prod.extensions_1.0.0.jar")); + + Log.exiting(c, method, "User product extension using feature: " + USER_FEATURE_PRODTEST_MF + " has been installed."); + } + + /** + * Cleans up the installation from any dirs/files that this test may have created. + * + * @throws Exception + */ + public static void tidyup() throws Exception { + if (server.isStarted()) + server.stopServer(); + + server.deleteDirectoryFromLibertyInstallRoot("producttest"); + server.deleteDirectoryFromLibertyInstallRoot("etc/extensions"); + server.deleteDirectoryFromLibertyInstallRoot("usr/extension/"); + server.deleteDirectoryFromLibertyInstallRoot("tool.output.dir"); + } +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/SchemaGeneratorMBeanTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/SchemaGeneratorMBeanTest.java new file mode 100755 index 00000000000..b89083a69bc --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/SchemaGeneratorMBeanTest.java @@ -0,0 +1,455 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import javax.management.JMX; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HttpsURLConnection; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.config.mbeans.ServerSchemaGenerator; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import componenttest.annotation.ExpectedFFDC; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +/** + * FAT-Tests to test the functionality of com.ibm.websphere.config.mbeans.ServerSchemaGenerator MBean + */ +public class SchemaGeneratorMBeanTest { + + private static Class logClass = SchemaGeneratorMBeanTest.class; + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.schemaGen.mbean"); + + private static final String SUCCESS_MESSAGE = "Setup completed successfully."; + private static final long MIN_FILE_SIZE = 500000; + private static final long SERVER_FILE_SIZE = 5000; + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + + private static ObjectName schemaGenObjName; + private static ObjectName fileTranObjectName; + + @BeforeClass + public static void setUp() throws Exception { + final String methodName = "setUp"; + Log.entering(logClass, methodName); + + outputDir = server.getServerRoot(); + Log.info(logClass, methodName, "serverRoot=" + outputDir); + + Log.info(logClass, methodName, "Starting server=" + server.getServerName()); + server.startServer(); + + Log.info(logClass, methodName, "Waiting for 'CWWKT0016I.*IBMJMXConnectorREST'"); + assertNotNull("'CWWKT0016I.*IBMJMXConnectorREST' was not received on server", + server.waitForStringInLog("CWWKT0016I.*IBMJMXConnectorREST")); + + Log.info(logClass, methodName, "Waiting for 'CWWKO0219I.*ssl'"); + assertNotNull("'CWWKO0219I.*ssl' was not recieved on server", + server.waitForStringInLog("CWWKO0219I.*ssl")); + + // Set up the trust store + System.setProperty("javax.net.ssl.trustStore", outputDir + "/resources/security/key.jks"); + System.setProperty("javax.net.ssl.trustStorePassword", "Liberty"); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + Log.info(logClass, methodName, "JMXServiceURL=" + url.toString()); + jmxConnector = JMXConnectorFactory.connect(url, environment); + assertNotNull("JMXConnector should not be null", jmxConnector); + connection = jmxConnector.getMBeanServerConnection(); + assertNotNull("MBeanServerConnection should not be null", connection); + + schemaGenObjName = new ObjectName(ServerSchemaGenerator.OBJECT_NAME); + fileTranObjectName = new ObjectName(FileTransferMBean.OBJECT_NAME); + + Log.exiting(logClass, "setUp"); + } + + @AfterClass + public static void cleanUp() throws Exception { + String methodName = "tearDown"; + Log.entering(logClass, methodName); + + if (server != null && server.isStarted()) { + Log.finer(logClass, methodName, "Server is up, stopping it"); + jmxConnector.close(); + server.stopServer(); + } + Log.exiting(logClass, methodName); + } + + /** + * Invoke ServerSchemaGenerator.generateInstallSchema method + * + * @param params + * @return response from MBean invoke + * @throws Exception + */ + private Map invokeGenerateInstallSchema(Object[] params) throws Exception { + Log.entering(logClass, "invokeGenerateInstallSchema", params); + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String" }; + + @SuppressWarnings("unchecked") + Map returnedMap = (Map) connection.invoke(schemaGenObjName, "generateInstallSchema", params, signature); + + Log.exiting(logClass, "invokeGenerateInstallSchema", returnedMap); + return returnedMap; + } + + /** + * Invoke ServerSchemaGenerator.generateServerSchema method + * + * @param params + * @return response from MBean invoke + * @throws Exception + */ + private Map invokeGenerateServerSchema(Object[] params) throws Exception { + Log.entering(logClass, "invokeGenerateServerSchema", params); + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String" }; + + @SuppressWarnings("unchecked") + Map returnedMap = (Map) connection.invoke(schemaGenObjName, "generateServerSchema", params, signature); + + Log.exiting(logClass, "invokeGenerateServerSchema", returnedMap); + return returnedMap; + } + + /** + * Invoke ServerSchemaGenerator.generate method + * + * @param params + * @return response from MBean invoke + * @throws Exception + */ + private String invokeSchemaGenMBeanGenerate() throws Exception { + + Object[] params = new String[] {}; + String[] signature = new String[] {}; + + String response = (String) connection.invoke(schemaGenObjName, "generate", params, signature); + + Log.finest(logClass, "invokeSchemaGenMBeanGenerate", "response=" + response); + return response; + } + + /** + * Invoke FileTransferMBean.downloadFile method + * + * @param params + * @throws Exception + */ + private void invokeFileTransferMBeanDownloadFile(Object[] params) throws Exception { + Log.entering(logClass, "invokeFileTransferMBeanDownloadFile", params); + String[] signature = new String[] { "java.lang.String", "java.lang.String" }; + connection.invoke(fileTranObjectName, "downloadFile", params, signature); + Log.exiting(logClass, "invokeFileTransferMBeanDownloadFile"); + } + + /** + * Invoke FileTransferMBean.deleteFile method + * + * @param params + * @throws Exception + */ + private void invokeFileTransferMBeanDeleteFile(Object[] params) throws Exception { + Log.entering(logClass, "invokeFileTransferMBeanDeleteFile", params); + String[] signature = new String[] { "java.lang.String" }; + connection.invoke(fileTranObjectName, "deleteFile", params, signature); + Log.exiting(logClass, "invokeFileTransferMBeanDeleteFile"); + } + + @Test + public void testDefaultValuesRestartServer() throws Exception { + String methodName = "testDefaultValuesRestartServer"; + + //Invoke schema generation + Object[] params = new String[] { "1.0", "1", "UTF-8", Locale.getDefault().toString() }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/schemaDefaultValues.xsd"; + + params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than expected minimum size + File file = new File(targetPath); + assertTrue("targetPath file is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > MIN_FILE_SIZE); + + Log.info(logClass, methodName, "Restarting server"); + server.restartServer(); + + Log.info(logClass, methodName, "Waiting for 'CWWKT0016I.*IBMJMXConnectorREST'"); + assertNotNull("'CWWKT0016I.*IBMJMXConnectorREST' was not received on server", + server.waitForStringInLog("CWWKT0016I.*IBMJMXConnectorREST")); + + Log.info(logClass, methodName, "Waiting for 'CWWKO0219I.*ssl'"); + assertNotNull("'CWWKO0219I.*ssl' was not recieved on server", + server.waitForStringInLog("CWWKO0219I.*ssl")); + + // Verify that the file was cleaned up after server restart + assertFalse("Generated schema file was not deleted after server restart. File=" + sourcePath, new File(sourcePath).exists()); + } + + @Test + public void testEmptyStrings() throws Exception { + //Invoke schema generation + Object[] params = new String[] { "", "", "", "" }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Ensure generated file is bigger than expected minimum size + String filePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + File file = new File(filePath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > MIN_FILE_SIZE); + } + + @Test + public void testGenerateDownloadAndDelete() throws Exception { + Object[] params = new String[] { "1.1", "2", "UTF-16", "fr" }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/schemaNonDefault.xsd"; + + params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than expected minimum size + File file = new File(targetPath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > MIN_FILE_SIZE); + + // Remotely delete the generated schema file + RemoteFile remoteFile = server.getMachine().getFile(sourcePath); + + //first check if the file exists + assertTrue("Generated schema file should exist at this point. remoteFile=" + remoteFile.getAbsolutePath(), remoteFile.exists()); + + params = new Object[] { remoteFile.getAbsolutePath() }; + invokeFileTransferMBeanDeleteFile(params); + + //Verify the file is deleted + assertFalse("Generated schema file should have been deleted. remoteFile=" + remoteFile.getAbsolutePath() + " : size" + remoteFile.length(), remoteFile.exists()); + } + + @Test + public void testGenerateServerSchema() throws Exception { + Object[] params = new String[] { null, null, null, null }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateServerSchema(params); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + //Download generated file + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/serverschema.xsd"; + + params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than expected minimum size + File file = new File(targetPath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > SERVER_FILE_SIZE); + + } + + @ExpectedFFDC("java.lang.IllegalArgumentException") + @Test + public void testInvalidSchemaVersion() throws Exception { + final String schemaVersion = "9876"; + Object[] params = new String[] { schemaVersion, null, null, null }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue("Return code should not be 0", (Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0); + + //Retrieve output + String output = (String) returnedMap.get(ServerSchemaGenerator.KEY_OUTPUT); + + assertTrue("Output does not contain expected IllegalArgumentException. output=" + output, output.contains("java.lang.IllegalArgumentException: " + schemaVersion)); + } + + @ExpectedFFDC("java.lang.IllegalArgumentException") + @Test + public void testInvalidOutputVersion() throws Exception { + final String outputVersion = "312"; + Object[] params = new String[] { null, outputVersion, null, null }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue("Return code should not be 0", (Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0); + + //Retrieve output + String output = (String) returnedMap.get(ServerSchemaGenerator.KEY_OUTPUT); + + assertTrue("Output does not contain expected IllegalArgumentException. output=" + output, output.contains("java.lang.IllegalArgumentException: " + outputVersion)); + } + + @Test + public void testInvalidEncoding() throws Exception { + final String encodingValue = "encodingABC"; + Object[] params = new String[] { null, null, encodingValue, null }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue("Return code should not be 0", (Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0); + + //Retrieve output + String output = (String) returnedMap.get(ServerSchemaGenerator.KEY_OUTPUT); + + assertTrue("Output does not contain expected UnsupportedEncodingException. output=" + output, output.contains("java.io.UnsupportedEncodingException: " + encodingValue)); + } + + /** + * Schema Generator replaces invalid locale with the default locale. So an output should be generated. + * + * @throws Exception + */ + @Test + public void testInvalidLocale() throws Exception { + //Invoke schema generation + final String localeValue = "localeXYZ"; + Object[] params = new String[] { null, null, null, localeValue }; //schemaVersion, outputVersion, encoding, locale + Map returnedMap = invokeGenerateInstallSchema(params); + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Ensure generated file is bigger than expected minimum size + String filePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + File file = new File(filePath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > MIN_FILE_SIZE); + } + + @Test + public void testSchemaGenMBeanCallAPI() throws Exception { + ServerSchemaGenerator schemaGenMBean = JMX.newMBeanProxy(connection, schemaGenObjName, ServerSchemaGenerator.class); + assertNotNull("We should have got access to the ServerSchemaGenerator API", schemaGenMBean); + + Map returnedMap = schemaGenMBean.generateInstallSchema(null, null, null, null); //schemaVersion, outputVersion, encoding, locale + + //Check return code + assertTrue((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) == 0); + + //Download generated file + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + String targetPath = outputDir + "/download_target/schemaNonDefaultAPI.xsd"; + + Object[] params = new Object[] { sourcePath, targetPath }; + invokeFileTransferMBeanDownloadFile(params); + + //Ensure the file is bigger than expected minimum size + File file = new File(targetPath); + assertTrue("File is not expected size. File=" + file.getAbsolutePath() + " : size=" + file.length(), file.length() > MIN_FILE_SIZE); + } + + @Test + public void testInvokeGenerateMethod() throws Exception { + //Invoke schema generation using the ServerSchemaGenerator.generate method + String returnedVal = invokeSchemaGenMBeanGenerate(); + assertTrue(returnedVal != null && returnedVal.length() > 0); + } + + /** + * Calls a servlet that uses the JMX REST client to connect to the server + * and check a few MBeanServerConnection methods and MBean API calls. + */ + @Test + public void testSchemaGenAppClient() throws Exception { + // Call AppClientServletSchemaGen, check for good result + String encodedServerRoot = URLEncoder.encode(server.getServerRoot(), "UTF-8"); + URL url = new URL("https", server.getHostname(), server.getHttpDefaultSecurePort(), "/mbeans/appClient?serverRoot=" + encodedServerRoot); + HttpsURLConnection con = (HttpsURLConnection) HttpUtils.getHttpConnection(url, HttpURLConnection.HTTP_OK, 60); + HttpUtils.findStringInHttpConnection(con, SUCCESS_MESSAGE); + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } + + /** + * Schema Generator for server throws illegalargument exception for a invalid locale. + * + * @throws Exception + */ + @Test + public void testServerSchemaInvalidLocale() throws Exception { + //Invoke schema generation + final String localeValue = "localeXYZ"; + Object[] params = new String[] { null, null, null, localeValue }; //schemaVersion, outputVersion, encoding, locale + try { + Map returnedMap = invokeGenerateServerSchema(params); + } catch (Exception ie) { + assertTrue(true); + } + + } + + @Test + @ExpectedFFDC("java.io.UnsupportedEncodingException") + public void testServerSchemaInvalidEncoding() throws Exception { + final String encodingValue = "encodingABC"; + Object[] params = new String[] { null, null, encodingValue, null }; //schemaVersion, outputVersion, encoding, locale + + Map returnedMap = invokeGenerateServerSchema(params); + + //Check return code + assertTrue("Return code should not be 0", (Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0); + + //Retrieve output + String output = (String) returnedMap.get(ServerSchemaGenerator.KEY_OUTPUT); + + assertTrue("Output does not contain expected IOException. output=" + output, output.contains("java.io.IOException: " + encodingValue)); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerConfigTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerConfigTest.java new file mode 100755 index 00000000000..38de7b0016f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerConfigTest.java @@ -0,0 +1,656 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2014 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ + +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.List; + +import org.junit.Test; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.config.ConfigMonitorElement; +import com.ibm.websphere.simplicity.config.ServerConfiguration; + +import componenttest.exception.TopologyException; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ServerConfigTest { + + // Since we have tracing enabled give server longer timeout to start up. + private static final long SERVER_START_TIMEOUT = 30 * 1000; + + @Test + public void testRestart() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.restart"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer("before.log"); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKF0008I")); // Feature update completed + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + try { + // run the test one + test(server, "/restart/restart?testName=before"); + + server.stopServer(false); + + // switch to new configuration + server.copyFileToLibertyServerRoot("restart/server.xml"); + + server.startServer("after.log", false); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up the second time", server.waitForStringInLog("CWWKF0008I")); // Feature update completed + assertNotNull("The restart application never came up the second time", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // run the test two + test(server, "/restart/restart?testName=after"); + } finally { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/com.ibm.ws.config.metatype_1.0.jar"); + } + } + + @Test + public void testRefresh() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.refresh"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer("refresh.log"); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + try { + // run the test one + test(server, "/restart/restart?testName=before"); + + // switch to new configuration + server.copyFileToLibertyServerRoot("refresh/server.xml"); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // run the test two + test(server, "/restart/restart?testName=after"); + } finally { + server.stopServer(); + } + } + + @Test + public void testVariableRestart() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.restart.var"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer("restart-var-before.log"); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + try { + // run the test one + test(server, "/restart/restart?testName=beforeVariable"); + + server.stopServer(false); + + // switch to new bootstrap.properties + server.copyFileToLibertyServerRoot("restart.var/bootstrap.properties"); + + server.startServer("restart-var-after.log", false); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // run the test two + test(server, "/restart/restart?testName=afterVariable"); + } finally { + server.stopServer(); + } + } + + @Test + public void testValidate() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.validate"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + server.copyFileToLibertyInstallRoot("lib/features", "metatype/metatype-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib", "metatype/com.ibm.ws.config.metatype_1.0.jar"); + + server.startServer(); + + try { + assertStringsPresentInLog(server, new String[] { ".*CWWKG0011W.*person.*", ".*firstName.*Jane.*" }); + assertStringsPresentInLog(server, new String[] { ".*CWWKG0011W.*ejb.*threadPool.*", ".*minThreads.*5.*" }); + assertStringsPresentInLog(server, new String[] { ".*CWWKG0011W.*quickStartSecurity.*" }); + } finally { + server.stopServer(); + } + } + + @Test + public void testValidateUpdateFileTag() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.validateConfig"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer(); + + try { + assertASCIIFileTag(server.getDefaultLogFile()); + } finally { + server.stopServer(); + } + } + + @Test + public void testRelativeImports() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer("imports.log"); + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + try { + // run the test one + test(server, "/restart/restart?testName=checkImport"); + } finally { + server.stopServer(); + } + } + + @Test + public void testRefreshError() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.refresh.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + server.startServer("refresh-error.log"); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + try { + // run the test one + test(server, "/restart/restart?testName=before"); + + // switch to new (bad) configuration + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("refresh/bad-server.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // wait for error + assertNotNull("No refresh error", server.waitForStringInLog("CWWKG0014E.*")); + + // run the test one again since nothing has changed + test(server, "/restart/restart?testName=before"); + + // switch to new (good) configuration + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("refresh/server.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // run the test two + test(server, "/restart/restart?testName=after"); + } finally { + server.stopServer(); + } + } + + /** + * This test makes sure that you can update the server configuration and that the changes will be picked up when using a polled style of update trigger. It will then disable + * the polling to make sure changes are no longer picked up. + * + * @throws Exception + */ + @Test + public void testServerConfigUpdating() throws Exception { + LibertyServer server = LibertyServerFactory.getStartedLibertyServer("com.ibm.ws.config.update"); + + try { + // The server has no update trigger so first set one to polled. Polled is the default so this change should be picked up + ServerConfiguration config = server.getServerConfiguration(); + ConfigMonitorElement configMonitor = config.getConfig(); + configMonitor.setUpdateTrigger("polled"); + server.updateServerConfiguration(config); + assertNotNull("The server configuration was not updated when setting it to polled", server.waitForStringInLog("CWWKG0017I")); + + long startTime = System.currentTimeMillis(); + // Now update the server configuration to make sure that still works + server.setMarkToEndOfLog(); + config.addApplication("inexistent", ".", "war"); + server.updateServerConfiguration(config); + assertNotNull("The server configuration was not updated when adding a feature", server.waitForStringInLog("CWWKG0017I")); + + // Now turn off server config monitoring and make sure the updating stops + server.setMarkToEndOfLog(); + configMonitor.setUpdateTrigger("disabled"); + server.updateServerConfiguration(config); + assertNotNull("The server configuration was not updated for disabling monitoring", server.waitForStringInLog("CWWKG0017I")); + + /* + * Updating is now turned off so do another update and make sure that the message is NOT displayed in the log (we wait for 4 messages but expect 3). The default wait + * time for this is 30s which is a bit long but also machine specific so make a note of how long it took to update the config during the last 2 updates and wait for + * that long. + */ + long updateDuration = System.currentTimeMillis() - startTime; + server.setMarkToEndOfLog(); + config.removeApplicationsByName("inexistent"); + server.updateServerConfiguration(config); + assertNull("The server configuration was updated even though monitoring is disabled", server.waitForStringInLog("CWWKG0017I", updateDuration)); + } finally { + server.stopServer(); + } + } + + /** + * This test just makes sure that if the server config update trigger is set to mbean then it doesn't monitor the file. + * + * @throws Exception + */ + @Test + public void testMbeanConfigUpdate() throws Exception { + LibertyServer server = LibertyServerFactory.getStartedLibertyServer("com.ibm.ws.config.update.mbean"); + + try { + // This server has and update trigger set to mbean so the file should not be monitored, update it and make sure a config update isn't triggered + ServerConfiguration config = server.getServerConfiguration(); + config.getFeatureManager().getFeatures().add("servlet-3.0"); + server.updateServerConfiguration(config); + //we are waiting for a message not to appear in the log - 10 seconds is probably long enough instead of the default 2 min + // (note that, for whatever reason, LibertyServer doubles the timeout we pass in) + assertNull("The server configuration was updated when it shouldn't of been monitoring the file", server.waitForStringInLog("CWWKG0017I", 5000)); + } finally { + server.stopServer(); + } + } + + private void test(LibertyServer server, String testUri) throws Exception { + HttpURLConnection con = null; + try { + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + testUri); + con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + assertNotNull(is); + + String output = read(is); + System.out.println(output); + assertTrue(output, output.trim().startsWith("Test Passed")); + } finally { + if (con != null) { + con.disconnect(); + } + } + } + + private static String read(InputStream in) throws IOException { + InputStreamReader isr = new InputStreamReader(in); + BufferedReader br = new BufferedReader(isr); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + return builder.toString(); + } + + private void assertStringsPresentInLog(LibertyServer server, String[] patterns) throws IOException { + for (String pattern : patterns) { + String match = server.waitForStringInLog(pattern); + // Wait for the application to be installed before proceeding + assertNotNull("No lines found matching the pattern: " + pattern, match); + } + } + + private void assertASCIIFileTag(RemoteFile file) throws Exception { + + String systemOS = System.getProperty("os.name"); + if (systemOS.equals("z/OS")) { + String[] cmdArray = new String[] { "chtag", "-p", file.getAbsolutePath() }; + Process p = Runtime.getRuntime().exec(cmdArray); + p.waitFor(); + String line = ""; + StringBuffer exMsg = new StringBuffer(); + BufferedReader buferr = new BufferedReader(new InputStreamReader(p.getInputStream())); + while ((line = buferr.readLine()) != null) { + exMsg.append(line + ". "); + } + buferr.close(); + + String result[] = exMsg.toString().split("\\s"); + assertEquals("t", result[0]); + assertEquals("ISO8859-1", result[1]); + } + } + + @Test + public void testCaseSensitivity() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.casesensitivity"); + // shouldn't take long to fail but it should start pretty fast + server.setServerStartTimeout(5000); + try { + server.startServer("casesensitivity.log"); + } finally { + server.stopServer(); + } + } + + /** + * Test a bad required include () + * for startup and update. When the variable onError is set to FAIL, the runtime should + * bring down the server on startup and not recognize ANY config changes on update. + * + * @throws Exception + */ + @Test + public void testBadRequiredIncludeFAIL() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getServerRoot(), "bootstrap.properties", + server.pathToAutoFVTTestFiles + "/import.error/bootstrap-onError-FAIL.properties", false, + server.getServerRoot()); + server.setServerConfigurationFile("import.error/original.xml"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + try { + // Start out with bad include and onError=FAIL + server.startServerExpectFailure("include-error.log", true, true); + + // Now swap in a valid server.xml to test dynamic config update with onError=FAIL + server.setServerConfigurationFile("import.error/server.xml"); + + server.startServer("include-update-error.log"); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // ensure that the config elements work + test(server, "/restart/restart?testName=before"); + + // switch to new (bad) configuration to test a config update with a bad include + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("import.error/bad-include-server2.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // make sure that both errors messages are present, CWWKG0015E is the summary message + // that comes out on an update with errors and onError=FAIL + assertNotNull(server.waitForStringInLogUsingMark("CWWKG0015E")); + assertNotNull(server.waitForStringInLogUsingMark("CWWKG0090E")); + + // ensure that the config elements were not updated + test(server, "/restart/restart?testName=before"); + + } finally { + if (server.isStarted()) { + server.stopServer(); + } + } + } + + /** + * Test a bad required include () + * for startup and update. When the variable onError is not set to FAIL (i.e. INFO, WARN), + * the runtime should be tolerant and keep the server running while ignoring the bad + * required include. + * + * For a config update, all changes made to the config should be recognized and only + * the bad required include should be ignored. + * + * @throws Exception + */ + @Test + public void testBadRequiredIncludeWARN() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + try { + // Change to default setting of onError=WARN, but swap in a server.xml that has + // malformed xml. + server.copyFileToLibertyServerRoot("import.error/bootstrap.properties"); + server.setServerConfigurationFile("import.error/malformed-server.xml"); + + // Start server with malformed xml and onError=WARN. The server will come up with no configuration, + // which results in an exception because timed exit isn't enabled. + boolean caught = false; + try { + server.startServer("malformed-xml.log", true, true); + } catch (TopologyException ex) { + caught = true; + server.stopServer(); + } + + assertTrue("There should be an exception because timedexit is not enabled", caught); + + // Now provide the original server.xml with a bad required include to ensure + // that the server comes up and reports the bad include. + server.setServerConfigurationFile("import.error/bad-include-server.xml"); + server.startServer("include-warn.log"); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // find the warning in messages.log CWWKG0090E + List includeErrors = server.findStringsInLogs("CWWKG0090E"); + assertEquals("Should have only seen the include error 1 time upon server startup: " + includeErrors, 1, includeErrors.size()); + + // ensure that the config elements work + test(server, "/restart/restart?testName=before"); + + // switch to new (bad) configuration to test a config update with a bad include + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("import.error/bad-include-server2.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // ensure that the error message indicating a bad include was provided is there + includeErrors = server.findStringsInLogs("CWWKG0090E"); + assertEquals("Should have only seen the include error 2 times since starting the server: " + includeErrors, 2, includeErrors.size()); + + // ensure that the modified config elements work + test(server, "/restart/restart?testName=after"); + + } finally { + if (server.isStarted()) { + server.stopServer(); + } + } + } + + @Test + public void testBadRequiredIncludeModifyOnError() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + try { + // Change to default setting of onError=WARN, but swap in a server.xml that has + // malformed xml. + server.copyFileToLibertyServerRoot("import.error/bootstrap.properties"); + + // Now provide the original server.xml with a bad required include to ensure + // that the server comes up and reports the bad include. + server.setServerConfigurationFile("import.error/bad-include-server.xml"); + server.startServer("include-warn.log"); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // find the warning in messages.log CWWKG0090E + List includeErrors = server.findStringsInLogs("CWWKG0090E"); + assertEquals("Should have only seen the include error 1 time upon server startup: " + includeErrors, 1, includeErrors.size()); + + // ensure that the config elements work + test(server, "/restart/restart?testName=before"); + + // Update onError to IGNORE + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("import.error/bad-include-server-onError-ignore.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // ensure that the error message indicating a bad include was provided is there + includeErrors = server.findStringsInLogs("CWWKG0090E"); + assertEquals("Should have only seen the include error 2 times since starting the server: " + includeErrors, 2, includeErrors.size()); + + // switch to new (bad) configuration to test a config update with a bad include + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("import.error/bad-include-server-onError-ignore2.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // ensure that the error message indicating a bad include was provided is there + includeErrors = server.findStringsInLogs("CWWKG0090E"); + assertEquals("Should not see an include error with onError=IGNORE" + includeErrors, 2, includeErrors.size()); + + // ensure that the modified config elements work + test(server, "/restart/restart?testName=after"); + + } finally { + if (server.isStarted()) { + server.stopServer(); + } + } + } + + @Test + public void testVariableMissingName() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + try { + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getServerRoot(), "bootstrap.properties", + server.pathToAutoFVTTestFiles + "/import.error/bootstrap-onError-FAIL.properties", false, + server.getServerRoot()); + server.setServerConfigurationFile("variable.error/missing-name.xml"); + + // With OnError=FAIL, the server should fail to start + server.startServerExpectFailure("variable-name-fail.log", true, true); + + // Change OnError to WARN and try again + server.copyFileToLibertyServerRoot("import.error/bootstrap.properties"); + + server.startServer("variable-name-warn.log", true, true); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // find the warning in messages.log CWWKG0091E + List includeErrors = server.findStringsInLogs("CWWKG0091E"); + assertEquals("Should have only seen the include error 1 time upon server startup: " + includeErrors, 1, includeErrors.size()); + + // ensure that the config elements work + test(server, "/restart/restart?testName=before"); + + // switch to new (bad) configuration to test a config update with a bad variable + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("variable.error/missing-name2.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // ensure that the error message indicating a bad variable was provided is there + includeErrors = server.findStringsInLogs("CWWKG0091E"); + assertEquals("Should have only seen the include error 2 times since starting the server: " + includeErrors, 2, includeErrors.size()); + + // ensure that the modified config elements work + test(server, "/restart/restart?testName=after"); + + } finally { + if (server.isStarted()) { + server.stopServer(); + } + } + } + + @Test + public void testVariableMissingValue() throws Exception { + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.import.error"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + server.setServerStartTimeout(SERVER_START_TIMEOUT); + + try { + LibertyFileManager.copyFileIntoLiberty(server.getMachine(), server.getServerRoot(), "bootstrap.properties", + server.pathToAutoFVTTestFiles + "/import.error/bootstrap-onError-FAIL.properties", false, + server.getServerRoot()); + server.setServerConfigurationFile("variable.error/missing-value.xml"); + + // With OnError=FAIL, the server should fail to start + server.startServerExpectFailure("variable-value-fail.log", true, true); + + // Change OnError to WARN and try again + server.copyFileToLibertyServerRoot("import.error/bootstrap.properties"); + + server.startServer("variable-name-warn.log", true, true); + + // Wait for the application to be installed before proceeding + assertNotNull("The restart application never came up", server.waitForStringInLog("CWWKZ0001I.* restart")); + + // find the warning in messages.log CWWKG0092E + List includeErrors = server.findStringsInLogs("CWWKG0092E"); + assertEquals("Should have only seen the include error 1 time upon server startup: " + includeErrors, 1, includeErrors.size()); + + // ensure that the config elements work + test(server, "/restart/restart?testName=before"); + + // switch to new (bad) configuration to test a config update with a bad variable + server.setMarkToEndOfLog(); + server.setServerConfigurationFile("variable.error/missing-value2.xml"); + + // cause configuration refresh + test(server, "/restart/restart?testName=refresh"); + + // ensure that the error message indicating a bad variable was provided is there + includeErrors = server.findStringsInLogs("CWWKG0092E"); + assertEquals("Should have only seen the include error 2 times since starting the server: " + includeErrors, 2, includeErrors.size()); + + // ensure that the modified config elements work + test(server, "/restart/restart?testName=after"); + + } finally { + if (server.isStarted()) { + server.stopServer(); + } + } + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerXMLConfigurationMBeanTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerXMLConfigurationMBeanTest.java new file mode 100755 index 00000000000..5f46f8b83da --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServerXMLConfigurationMBeanTest.java @@ -0,0 +1,171 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import javax.management.JMX; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.config.mbeans.ServerXMLConfigurationMBean; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Tests that ServerXMLConfigurationMBean can be accessed through a proxy. Note that the + * BVT tests that the configuration files can be downloaded through the FileTransferMBean + * so not going to include a redundant test for that here. + */ +public class ServerXMLConfigurationMBeanTest { + + private static Class logClass = ServerXMLConfigurationMBeanTest.class; + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.schemaGen.mbean"); + + private static String outputDir; + private static MBeanServerConnection connection; + private static JMXConnector jmxConnector; + + private static ObjectName serverXMLConfigurationMBeanObjName; + + @BeforeClass + public static void setUp() throws Exception { + final String methodName = "setUp"; + Log.entering(logClass, methodName); + + outputDir = server.getServerRoot(); + Log.info(logClass, methodName, "serverRoot=" + outputDir); + + Log.info(logClass, methodName, "Starting server=" + server.getServerName()); + server.startServer(); + + Log.info(logClass, methodName, "Waiting for 'CWWKT0016I.*IBMJMXConnectorREST'"); + assertNotNull("'CWWKT0016I.*IBMJMXConnectorREST' was not received on server", + server.waitForStringInLog("CWWKT0016I.*IBMJMXConnectorREST")); + + Log.info(logClass, methodName, "Waiting for 'CWWKO0219I.*ssl'"); + assertNotNull("'CWWKO0219I.*ssl' was not recieved on server", + server.waitForStringInLog("CWWKO0219I.*ssl")); + + Log.info(logClass, methodName, "Waiting for 'CWPKI0803A.*ssl'"); + assertNotNull("'CWPKI0803A.*ssl' was not generated on server", + server.waitForStringInLog("CWPKI0803A")); + + Log.info(logClass, methodName, "Waiting for 'CWWKS0008I: The security service is ready'"); + assertNotNull("'CWWKS0008I: The security service is ready' was not generated on server", + server.waitForStringInLog("CWWKS0008I")); + + Log.info(logClass, methodName, "Waiting for 'CWWKS4105I: LTPA configuration is ready'"); + assertNotNull("'CWWKS4105I: LTPA configuration is ready' was not generated on server", + server.waitForStringInLog("CWWKS4105I")); + + // Set up the trust store + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + HostnameVerifier hv = new HostnameVerifier() { + @Override + public boolean verify(String urlHostName, SSLSession session) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(hv); + + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", "localhost", getSSLPort(), "/IBMJMXConnectorREST"); + Log.info(logClass, methodName, "JMXServiceURL=" + url.toString()); + jmxConnector = JMXConnectorFactory.connect(url, environment); + assertNotNull("JMXConnector should not be null", jmxConnector); + connection = jmxConnector.getMBeanServerConnection(); + assertNotNull("MBeanServerConnection should not be null", connection); + + serverXMLConfigurationMBeanObjName = new ObjectName(ServerXMLConfigurationMBean.OBJECT_NAME); + + Log.exiting(logClass, "setUp"); + } + + @AfterClass + public static void cleanUp() throws Exception { + String methodName = "tearDown"; + Log.entering(logClass, methodName); + + if (server != null && server.isStarted()) { + Log.finer(logClass, methodName, "Server is up, stopping it"); + jmxConnector.close(); + server.stopServer(); + } + Log.exiting(logClass, methodName); + } + + @Test + public void testServerXMLConfigurationMBeanCallAPI() throws Exception { + ServerXMLConfigurationMBean serverXMLConfigMBean = JMX.newMBeanProxy(connection, serverXMLConfigurationMBeanObjName, ServerXMLConfigurationMBean.class); + assertNotNull("ServerXMLConfigurationMBean is unexpectedly null.", serverXMLConfigMBean); + + Collection configFilePaths = serverXMLConfigMBean.fetchConfigurationFilePaths(); + assertNotNull("Configuration file path collection should not be null.", configFilePaths); + + // Check that the collection contains the expected file paths. + assertEquals("Config file path collection size is not 3.", 3, configFilePaths.size()); + assertTrue("server.xml is missing from the collection.", + configFilePaths.contains("${server.config.dir}/server.xml")); + assertTrue("fatTestPorts.xml is missing from the collection.", + configFilePaths.contains("${wlp.user.dir}/servers/fatTestPorts.xml")); + assertTrue("fatTestCommon.xml is missing from the collection.", + configFilePaths.contains("${wlp.user.dir}/servers/fatTestCommon.xml")); + } + + private static int getSSLPort() { + return Integer.valueOf(System.getProperty("HTTP_default.secure", "8020")); + } +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServletRunner.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServletRunner.java new file mode 100755 index 00000000000..e00fd760686 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/ServletRunner.java @@ -0,0 +1,74 @@ +package test.server.config; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.TestName; + +import componenttest.topology.impl.LibertyServer; + +public abstract class ServletRunner { + + /** + * Utility to set the method name as a String before the test + */ + @Rule + public TestName name = new TestName(); + + public String testName = ""; + + @Before + public void setTestName() { + // set the current test name + testName = name.getMethodName(); + } + + protected abstract String getContextRoot(); + + protected abstract String getServletMapping(); + + protected void test(LibertyServer server) throws Exception { + HttpURLConnection con = null; + try { + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/" + + getContextRoot() + "/" + getServletMapping() + "?" + "testName=" + testName); + con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + assertNotNull(is); + + String output = read(is); + System.out.println(output); + assertTrue(output, output.trim().startsWith("OK")); + } finally { + if (con != null) { + con.disconnect(); + } + } + } + + private static String read(InputStream in) throws IOException { + InputStreamReader isr = new InputStreamReader(in); + BufferedReader br = new BufferedReader(isr); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + return builder.toString(); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/VariableMergeTests.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/VariableMergeTests.java new file mode 100755 index 00000000000..fc2c188fca3 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/VariableMergeTests.java @@ -0,0 +1,88 @@ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class VariableMergeTests extends ServletRunner { + + private static final String CONTEXT_ROOT = "varmergedconfig"; + private static final String ALL_IN_ONE_SERVER = "varmerge/allInOne.xml"; + private static final String BREAK_SERVER = "varmerge/break.xml"; + private static final String BREAK_2_SERVER = "varmerge/break2.xml"; + private static final String IGNORE_SERVER = "varmerge/ignore.xml"; + private static final String REPLACE_SERVER = "varmerge/replace.xml"; + private static final String MERGE_SERVER = "varmerge/merge.xml"; + + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + @Override + protected String getServletMapping() { + return "varMergeTest"; + } + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.varmerging"); + + @Test + public void testMergedVariables() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(ALL_IN_ONE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + + } + + @Test + public void testMergedIncludesReplace() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(REPLACE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesIgnore() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(IGNORE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @Test + public void testMergedIncludesMerge() throws Exception { + server.setMarkToEndOfLog(); + server.setServerConfigurationFile(MERGE_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + test(server); + } + + @BeforeClass + public static void setUpForMergedConfigTests() throws Exception { + //copy the config feature into the server features location + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + server.startServer("varmerge.log"); + //make sure the URL is available + assertNotNull(server.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(server.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + } + +} diff --git a/dev/com.ibm.ws.config_fat/fat/src/test/server/config/WSConfigurationHelperTest.java b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/WSConfigurationHelperTest.java new file mode 100755 index 00000000000..aa85dbe4da8 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/fat/src/test/server/config/WSConfigurationHelperTest.java @@ -0,0 +1,125 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ + +@Mode(TestMode.FULL) +public class WSConfigurationHelperTest extends ServletRunner { + + private static final String CONTEXT_ROOT = "confighelper"; + + /* + * (non-Javadoc) + * + * @see test.server.config.ServletRunner#getContextRoot() + */ + @Override + protected String getContextRoot() { + return CONTEXT_ROOT; + } + + /* + * (non-Javadoc) + * + * @see test.server.config.ServletRunner#getServletMapping() + */ + @Override + protected String getServletMapping() { + return "helperTest"; + } + + @BeforeClass + public static void setUpForMetatypeProviderTests() throws Exception { + + // Use the feature/bundle from the merged config tests + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/mergedConfigTest-1.0.mf"); + server.copyFileToLibertyInstallRoot("lib", "bundles/test.merged.config_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/configfatlibertyinternals-1.0.mf"); + + server.startServer("helperTest.log"); + //make sure the URL is available + assertNotNull(server.waitForStringInLog("CWWKT0016I.*" + CONTEXT_ROOT)); + assertNotNull(server.waitForStringInLog("CWWKF0011I")); + } + + @AfterClass + public static void shutdown() throws Exception { + server.stopServer(); + server.deleteFileFromLibertyInstallRoot("lib/features/configfatlibertyinternals-1.0.mf"); + } + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.config.helper"); + + @Test + public void testGetDefaultProperties() throws Exception { + test(server); + } + + @Test + public void testGetDefaultPropertiesWithRequired() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration1() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration2() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration4() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration3() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration5() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration6() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration7() throws Exception { + test(server); + } + + @Test + public void testAddDefaultConfiguration8() throws Exception { + test(server); + } +} diff --git a/dev/com.ibm.ws.config_fat/publish/.gitignore b/dev/com.ibm.ws.config_fat/publish/.gitignore new file mode 100644 index 00000000000..0968b1bceb6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.config_fat/publish/files/.gitignore b/dev/com.ibm.ws.config_fat/publish/files/.gitignore new file mode 100644 index 00000000000..d4a71b1abe0 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/.gitignore @@ -0,0 +1,7 @@ +/bundles +/childalias.zip +/confighelper.zip +/dropins.zip +/mergedconfig.zip +/metatypeprovider.zip +/varmerge.zip diff --git a/dev/com.ibm.ws.config_fat/publish/files/badconfig/UniqueValueConflict.xml b/dev/com.ibm.ws.config_fat/publish/files/badconfig/UniqueValueConflict.xml new file mode 100755 index 00000000000..b86b3047676 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/badconfig/UniqueValueConflict.xml @@ -0,0 +1,16 @@ + + + + + + + jsp-2.2 + jdbc-4.0 + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/badconfig/badHttp.xml b/dev/com.ibm.ws.config_fat/publish/files/badconfig/badHttp.xml new file mode 100755 index 00000000000..ba1cc2db551 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/badconfig/badHttp.xml @@ -0,0 +1,18 @@ + + + + + servlet-3.0 + osgiconsole-1.0 + timedexit-1.0 + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/badconfig/badLogging.xml b/dev/com.ibm.ws.config_fat/publish/files/badconfig/badLogging.xml new file mode 100755 index 00000000000..82e64a44031 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/badconfig/badLogging.xml @@ -0,0 +1,13 @@ + + + + + + + servlet-3.0 + osgiconsole-1.0 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/badconfig/goodConfig.xml b/dev/com.ibm.ws.config_fat/publish/files/badconfig/goodConfig.xml new file mode 100755 index 00000000000..d72781208d2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/badconfig/goodConfig.xml @@ -0,0 +1,12 @@ + + + + + servlet-3.0 + osgiconsole-1.0 + timedexit-1.0 + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/server.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/server.xml new file mode 100755 index 00000000000..b866f31c32f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/server.xml @@ -0,0 +1,42 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverB.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverB.xml new file mode 100755 index 00000000000..cb8acb009cb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverB.xml @@ -0,0 +1,44 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC.xml new file mode 100755 index 00000000000..5c9503cdec5 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC.xml @@ -0,0 +1,46 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC2.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC2.xml new file mode 100755 index 00000000000..8bb5e698aff --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC2.xml @@ -0,0 +1,41 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC3.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC3.xml new file mode 100755 index 00000000000..ca75e6cc47a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC3.xml @@ -0,0 +1,44 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC4.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC4.xml new file mode 100755 index 00000000000..e8a3157c240 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC4.xml @@ -0,0 +1,44 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC5.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC5.xml new file mode 100755 index 00000000000..8525e00c57e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC5.xml @@ -0,0 +1,42 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC6.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC6.xml new file mode 100755 index 00000000000..0eb20773e2f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC6.xml @@ -0,0 +1,44 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC7.xml b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC7.xml new file mode 100755 index 00000000000..d6465ea0f46 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/childalias/serverC7.xml @@ -0,0 +1,44 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + childAliasTestB-1.0 + childAliasTestC-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/aBrokenFile.xml b/dev/com.ibm.ws.config_fat/publish/files/dropins/aBrokenFile.xml new file mode 100755 index 00000000000..b35c826f3cf --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/aBrokenFile.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/alibrary.xml b/dev/com.ibm.ws.config_fat/publish/files/dropins/alibrary.xml new file mode 100755 index 00000000000..6b757cb4c21 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/alibrary.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/blibrary.xml b/dev/com.ibm.ws.config_fat/publish/files/dropins/blibrary.xml new file mode 100755 index 00000000000..4aec61a7f86 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/blibrary.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.notxml b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.notxml new file mode 100755 index 00000000000..c68456f952b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.notxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.xml b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.xml new file mode 100755 index 00000000000..c68456f952b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/dropins/simple2.xml b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple2.xml new file mode 100755 index 00000000000..50cab62ebae --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/dropins/simple2.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/extensions/server.xml b/dev/com.ibm.ws.config_fat/publish/files/extensions/server.xml new file mode 100755 index 00000000000..ae3c77b37c7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/extensions/server.xml @@ -0,0 +1,29 @@ + + + + + + configExtensionsTest-1.0 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB1.xml b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB1.xml new file mode 100755 index 00000000000..83eff7671c6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB1.xml @@ -0,0 +1,13 @@ + + + + + + configExtensionsTestB-1.0 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB2.xml b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB2.xml new file mode 100755 index 00000000000..34236ecee93 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverB2.xml @@ -0,0 +1,14 @@ + + + + + + configExtensionsTest-1.0 + configExtensionsTestB-1.0 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/extensions/serverSchemaGenerator.xml b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverSchemaGenerator.xml new file mode 100755 index 00000000000..fb544c9ade2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/extensions/serverSchemaGenerator.xml @@ -0,0 +1,11 @@ + + + + + + configExtensionsSchemaGeneratorTest-1.0 + configExtensionsTest-1.0 + configExtensionsTestB-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveJDBC.xml b/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveJDBC.xml new file mode 100755 index 00000000000..a4730385b75 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveJDBC.xml @@ -0,0 +1,37 @@ + + + + + osgiConsole-1.0 + servlet-3.0 + localConnector-1.0 + oauth-2.0 + ssl-1.0 + openidConnectServer-1.0 + + + + + + + + + + + + + + + + + client01 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveOpenID.xml b/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveOpenID.xml new file mode 100755 index 00000000000..2d1d54c9eee --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/featureRemove/serverRemoveOpenID.xml @@ -0,0 +1,27 @@ + + + + + osgiConsole-1.0 + servlet-3.0 + jdbc-4.0 + localConnector-1.0 + oauth-2.0 + ssl-1.0 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore.xml new file mode 100755 index 00000000000..c7168bfde9d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore.xml @@ -0,0 +1,28 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore2.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore2.xml new file mode 100755 index 00000000000..c6a27e52250 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server-onError-ignore2.xml @@ -0,0 +1,33 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server.xml new file mode 100755 index 00000000000..9585b789821 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server.xml @@ -0,0 +1,27 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server2.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server2.xml new file mode 100755 index 00000000000..762079f99a7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bad-include-server2.xml @@ -0,0 +1,32 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap-onError-FAIL.properties b/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap-onError-FAIL.properties new file mode 100755 index 00000000000..a43b26d2a24 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap-onError-FAIL.properties @@ -0,0 +1,4 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +relativeLocation=relative.xml +onError=FAIL \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap.properties new file mode 100755 index 00000000000..84bdd909d92 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +relativeLocation=relative.xml diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/malformed-server.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/malformed-server.xml new file mode 100755 index 00000000000..9037d1d7cda --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/malformed-server.xml @@ -0,0 +1,23 @@ + + + + + + + + + servlet-3.0 + configfatlibertyinternals-1.0 + + + + + + + + + + < + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/original.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/original.xml new file mode 100755 index 00000000000..654abb21f83 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/original.xml @@ -0,0 +1,21 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/import.error/server.xml b/dev/com.ibm.ws.config_fat/publish/files/import.error/server.xml new file mode 100755 index 00000000000..030e6d88709 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/import.error/server.xml @@ -0,0 +1,23 @@ + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTest-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTest-1.0.mf new file mode 100755 index 00000000000..a1a5efb9249 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: childAliasTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.childalias; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestB-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestB-1.0.mf new file mode 100755 index 00000000000..8668eb7b1b4 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestB-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: childAliasTestB-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.childalias.b; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestC-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestC-1.0.mf new file mode 100755 index 00000000000..52408615ef9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/childAliasTestC-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: childAliasTestC-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.childalias.c; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsSchemaGeneratorTest-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsSchemaGeneratorTest-1.0.mf new file mode 100755 index 00000000000..43f5edccc91 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsSchemaGeneratorTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: configExtensionsSchemaGeneratorTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.extensions.schema.generator; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTest-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTest-1.0.mf new file mode 100755 index 00000000000..d953d105e9b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTest-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: configExtensionsTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.extensions; version="[1,1.0.100)", + com.ibm.wsspi.appserver.webBundle-1.0; type="osgi.subsystem.feature" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTestB-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTestB-1.0.mf new file mode 100755 index 00000000000..0f458816a93 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configExtensionsTestB-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: configExtensionsTestB-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.extensions.b; version="[1,1.0.100)", + com.ibm.wsspi.appserver.webBundle-1.0; type="osgi.subsystem.feature" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configfatlibertyinternals-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configfatlibertyinternals-1.0.mf new file mode 100755 index 00000000000..602b7829359 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/configfatlibertyinternals-1.0.mf @@ -0,0 +1,12 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: configfatlibertyinternals-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +IBM-API-Package: org.osgi.service.cm; type="internal", + com.ibm.ws.jmx; type="internal", + org.osgi.framework; type="internal", + org.osgi.util.tracker; type="internal", + com.ibm.websphere.config; type="internal", + com.ibm.wsspi.kernel.service.utils; type="internal", + com.ibm.wsspi.kernel.service.location; type="internal" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/delayedVariable-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/delayedVariable-1.0.mf new file mode 100755 index 00000000000..8c6dcd7ade9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/delayedVariable-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: delayedVariable-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.config.variables; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/mergedConfigTest-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/mergedConfigTest-1.0.mf new file mode 100755 index 00000000000..20e4f39e8d1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/mergedConfigTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: mergedConfigTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.merged.config; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/metatypeProviderTest-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/metatypeProviderTest-1.0.mf new file mode 100755 index 00000000000..f11c82b456d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/internalFeatureForFat/metatypeProviderTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: metatypeProviderTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +Subsystem-Content: test.metatype.provider; version="[1,1.0.100)" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/allInOne.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/allInOne.xml new file mode 100755 index 00000000000..0a7f9edbf87 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/allInOne.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/break.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/break.xml new file mode 100755 index 00000000000..e9a94c8b012 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/break.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/break2.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/break2.xml new file mode 100755 index 00000000000..7f80e024f67 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/break2.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelIgnore.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelIgnore.xml new file mode 100755 index 00000000000..7f9a98221c0 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelIgnore.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelReplace.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelReplace.xml new file mode 100755 index 00000000000..fdc4b5c5be1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/fourLevelReplace.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/ignore.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/ignore.xml new file mode 100755 index 00000000000..deeaa1b53e8 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/ignore.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/ignoreReplace.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/ignoreReplace.xml new file mode 100755 index 00000000000..d130b7ba172 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/ignoreReplace.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/merge.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/merge.xml new file mode 100755 index 00000000000..7e3c9e30ccd --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/merge.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/merge/replace.xml b/dev/com.ibm.ws.config_fat/publish/files/merge/replace.xml new file mode 100755 index 00000000000..5d13ba07de9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/merge/replace.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/metatype/.gitignore b/dev/com.ibm.ws.config_fat/publish/files/metatype/.gitignore new file mode 100644 index 00000000000..6070719c4e4 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/metatype/.gitignore @@ -0,0 +1 @@ +/com.ibm.ws.config.metatype_1.0.jar diff --git a/dev/com.ibm.ws.config_fat/publish/files/metatype/metatype-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/metatype/metatype-1.0.mf new file mode 100755 index 00000000000..0284236b04c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/metatype/metatype-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: metatype-1.0 +Subsystem-SymbolicName: com.ibm.ws.config.metatype-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.config.metatype; location:="lib/com.ibm.ws.config.metatype_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/metatype/noMetatypeServer.xml b/dev/com.ibm.ws.config_fat/publish/files/metatype/noMetatypeServer.xml new file mode 100755 index 00000000000..9ceeb7720fb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/metatype/noMetatypeServer.xml @@ -0,0 +1,20 @@ + + + + + + + servlet-3.0 + osgiconsole-1.0 + httpservice-2.2 + configfatlibertyinternals-1.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/metatype/server.xml b/dev/com.ibm.ws.config_fat/publish/files/metatype/server.xml new file mode 100755 index 00000000000..2fc260e93b7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/metatype/server.xml @@ -0,0 +1,21 @@ + + + + + + + servlet-3.0 + osgiconsole-1.0 + httpservice-2.2 + metatypeProviderTest-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.factory.pid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.factory.pid.server.xml new file mode 100755 index 00000000000..02fd41b0235 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.factory.pid.server.xml @@ -0,0 +1,21 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + testproduct:prodtest1-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.invalid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.invalid.server.xml new file mode 100755 index 00000000000..b0ccaa6c8ac --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.invalid.server.xml @@ -0,0 +1,22 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + testproduct:prodtest1-1.0 + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.valid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.valid.server.xml new file mode 100755 index 00000000000..ea8d784ac47 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/prod.ext.valid.server.xml @@ -0,0 +1,21 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + testproduct:prodtest1-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.factory.pid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.factory.pid.server.xml new file mode 100755 index 00000000000..a68ca5708fe --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.factory.pid.server.xml @@ -0,0 +1,21 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + usr:userProdtest1-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.invalid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.invalid.server.xml new file mode 100755 index 00000000000..5a6ed9ab59a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.invalid.server.xml @@ -0,0 +1,22 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + usr:userProdtest1-1.0 + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.valid.server.xml b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.valid.server.xml new file mode 100755 index 00000000000..502875504bc --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/config/user.prod.ext.valid.server.xml @@ -0,0 +1,21 @@ + + + + + + + osgiconsole-1.0 + jsp-2.2 + usr:userProdtest1-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/prodtest1-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/prodtest1-1.0.mf new file mode 100755 index 00000000000..151b88aa1a1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/prodtest1-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtest1-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.prod.extensions; location:="lib/test.prod.extensions_1.0.0.jar", + com.ibm.wsspi.appserver.webBundle-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/userProdtest1-1.0.mf b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/userProdtest1-1.0.mf new file mode 100755 index 00000000000..86604b524a0 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/features/userProdtest1-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:userProdtest1-1.0 +Subsystem-SymbolicName: userProdtest1-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.user.prod.extensions; version="[1,2)", + com.ibm.wsspi.appserver.webBundle-1.0; type="osgi.subsystem.feature" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.config_fat/publish/files/productExtensions/propertiesFiles/testproduct.properties b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/propertiesFiles/testproduct.properties new file mode 100755 index 00000000000..1b80aa40d23 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/productExtensions/propertiesFiles/testproduct.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall=wlp/producttest/ diff --git a/dev/com.ibm.ws.config_fat/publish/files/refresh/bad-server.xml b/dev/com.ibm.ws.config_fat/publish/files/refresh/bad-server.xml new file mode 100755 index 00000000000..4d368c7d5eb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/refresh/bad-server.xml @@ -0,0 +1,5 @@ + + + < + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/refresh/server.xml b/dev/com.ibm.ws.config_fat/publish/files/refresh/server.xml new file mode 100755 index 00000000000..57f7a83ea64 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/refresh/server.xml @@ -0,0 +1,27 @@ + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/restart.var/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/files/restart.var/bootstrap.properties new file mode 100755 index 00000000000..f8560d4219d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/restart.var/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +myHttpPort=5678 diff --git a/dev/com.ibm.ws.config_fat/publish/files/restart/server.xml b/dev/com.ibm.ws.config_fat/publish/files/restart/server.xml new file mode 100755 index 00000000000..2bdbb516161 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/restart/server.xml @@ -0,0 +1,26 @@ + + + + + + servlet-3.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/validator/.gitignore b/dev/com.ibm.ws.config_fat/publish/files/validator/.gitignore new file mode 100644 index 00000000000..c50fb0152d1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/validator/.gitignore @@ -0,0 +1 @@ +/com.ibm.ws.config.ext_1.0.*.jar diff --git a/dev/com.ibm.ws.config_fat/publish/files/validator/bad-signature.xml b/dev/com.ibm.ws.config_fat/publish/files/validator/bad-signature.xml new file mode 100755 index 00000000000..28042958e00 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/validator/bad-signature.xml @@ -0,0 +1,32 @@ + + + + + + + + + + ${minVersion} + ${maxVersion} + ${minVersion} - ${maxVersion} + ${jdkVersion} + ${myMaxVersion} + + v1 + v2 + v3,v4 + v\5 + + + + + + + + + + + + +5FUDKaf7vzcTb2J4Gf//7IzVvaw=Uv6vpn399+UxEt8ORk1EAbEilfULajdkZE8KPxiEvZRalYP2T6heP6pAtZ9edMAF4F3SfggLCSjtG/rsAs0xFfTL/YWjsDND6OSRyw077j7eB9jlvyytRvza1fKUQiHoci8R5bUDlhc73m4JGJVsk7uWnFvlJmff0rdAayqb/pGo6yH55umx1CBVlap3GwP1tNIlB3gBGZ3FPZKY0IRi0Hb3fyemfwlWgNs/2O2G10KtDQiDyGNhdiyq12h4Ms0j6mbVfSVhNYKCp2GCizb7bmv1BGBeCiYTyJvESE4AaODCKmaKdAeiWU2Zdwf+hBqu28195ISZZ7uZc7vQUp0x0w==CN=WebSphere Application Server Liberty Profile,OU=Software Group,O=IBM Corp.,L=Armonk,ST=New York,C=US \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/validator/dropins-enabled.xml b/dev/com.ibm.ws.config_fat/publish/files/validator/dropins-enabled.xml new file mode 100755 index 00000000000..ff26fbf8176 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/validator/dropins-enabled.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + ${minVersion} + ${maxVersion} + ${minVersion} - ${maxVersion} + ${jdkVersion} + ${myMaxVersion} + + v1 + v2 + v3,v4 + v\5 + + + + + + + + + + + +f+lmvF8PXX/4/eNTplGpqNSPaJ4=jnopKWvOoQocYPJYhoYZpjSNeJRH9IQaba2loveEuTJVaHKdY4LQmDfBF8uy+kzNjL84y6VtxrsQAjHRdvzSFckg2FZfA0EbryQNwYgIZlnWrmO/QbXlb+CuMA1ITu3hhjg0toIygphzJZEk3TgxpqzxxFLvYQJ1JSIVS5Jt0eYN6Tfi5MiL5aqG8xOfBUPVSZZoYHczUq+FfMNeoFl6DO8o/0EDnXAEz1r+iQbu+Uufjic3tvVvyQ14Yji4lc/IZdtodjUciCz9DHee8C7xq2kbomWXvXLzFLiWBZT7pdxOFIjaNPxPgnb+7vZc/D7yLnAyh0cSuIY8d/2FAlFCOA==CN=WebSphere Application Server Liberty Profile,OU=Software Group,O=IBM Corp.,L=Armonk,ST=New York,C=USMIIDqDCCApCgAwIBAgIEUMJaljANBgkqhkiG9w0BAQsFADCBlTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCE5ldyBZb3JrMQ8wDQYDVQQHEwZBcm1vbmsxEjAQBgNVBAoTCUlCTSBDb3JwLjEXMBUGA1UECxMOU29mdHdhcmUgR3JvdXAxNTAzBgNVBAMTLFdlYlNwaGVyZSBBcHBsaWNhdGlvbiBTZXJ2ZXIgTGliZXJ0eSBQcm9maWxlMB4XDTEyMTIwNzIxMDczNFoXDTMyMTIwMjIxMDczNFowgZUxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhOZXcgWW9yazEPMA0GA1UEBxMGQXJtb25rMRIwEAYDVQQKEwlJQk0gQ29ycC4xFzAVBgNVBAsTDlNvZnR3YXJlIEdyb3VwMTUwMwYDVQQDEyxXZWJTcGhlcmUgQXBwbGljYXRpb24gU2VydmVyIExpYmVydHkgUHJvZmlsZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ8l5a67C3jNwuS9g0rYYJ3dDjnykECQGXgQ7sP5i9ixF0Gg6NYesjn6VUBhf8ziC/4R4yrflPID+C1nM9SsUQld5QyAjbboRCXbW6+oIofzQKzWUHQQavXOXkH3i765GlsuME2qHYT+H8SQ0S0Z2ZMQGr8PXA8lzTSvExozx+oXRXaqG97cpfNDjVZVswxR9QL5h5GdZ7INtN6OcNiKalz5cF95G4VvL1sjtRkPaupNV7C09hnw+UzdPjmxmIOkw6BbS/J0gkE+NSDjQCt1O4EalCOy1ERKMZIb3QsKyYQvebaXCm7u3aEy/yszaCwIIldSjYjM15SUQw20L5vbn/UCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAeJICZmkkBYgMqcq17+GRTWaDvKkcmBdBaIi6DDuRM31FNI7AzB2uLX2vJzXrrxPW41YturXKAZf25uKbgZOikO8e3djjCUhiLYhIm4aTJxPlrh+MejaNAwAVeZBunNrZL9VI8jtU/a1Vd9bEdQ305yXWzt5c5mfJB3Yrn0LmwYKiSfG2pERy0TVnCpNLM6iQ7O2lQLVXXwlxNthWyOavEqlK54LR1GoklhC4k1r4d/5Cc2tjsoIi1y9gZj0qZptJCM2o1RtWf/xa+MgIavH+M/FqLzphvGOoxkPOqOfgpLPhM7bpLM6xqhiqexE5Xxq0JiNaxDi5iVUoDDxXG8ZslA== \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name.xml b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name.xml new file mode 100755 index 00000000000..6f0f5cb813e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name.xml @@ -0,0 +1,26 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name2.xml b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name2.xml new file mode 100755 index 00000000000..8719b472107 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-name2.xml @@ -0,0 +1,28 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value.xml b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value.xml new file mode 100755 index 00000000000..4bd1cfa4558 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value.xml @@ -0,0 +1,26 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value2.xml b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value2.xml new file mode 100755 index 00000000000..dde0025c93f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/variable.error/missing-value2.xml @@ -0,0 +1,28 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/allInOne.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/allInOne.xml new file mode 100755 index 00000000000..721fa5c2a4f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/allInOne.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/break.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/break.xml new file mode 100755 index 00000000000..f8e8688d41c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/break.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/break2.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/break2.xml new file mode 100755 index 00000000000..3160ed96667 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/break2.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/ignore.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/ignore.xml new file mode 100755 index 00000000000..f6937e46137 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/ignore.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/merge.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/merge.xml new file mode 100755 index 00000000000..7b5d41c8760 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/merge.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/files/varmerge/replace.xml b/dev/com.ibm.ws.config_fat/publish/files/varmerge/replace.xml new file mode 100755 index 00000000000..62c4f51c15e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/files/varmerge/replace.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.bad/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.bad/server.xml new file mode 100755 index 00000000000..ba1cc2db551 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.bad/server.xml @@ -0,0 +1,18 @@ + + + + + servlet-3.0 + osgiconsole-1.0 + timedexit-1.0 + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.casesensitivity/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.casesensitivity/server.xml new file mode 100755 index 00000000000..b9e7ee80807 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.casesensitivity/server.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/server.xml new file mode 100755 index 00000000000..b866f31c32f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.childalias/server.xml @@ -0,0 +1,42 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + childAliasTest-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/server.xml new file mode 100755 index 00000000000..09a8015de23 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.delayedVar/server.xml @@ -0,0 +1,20 @@ + + + + + + jsp-2.2 + osgiconsole-1.0 + configfatlibertyinternals-1.0 + delayedVariable-1.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/server.xml new file mode 100755 index 00000000000..3a13b483a63 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.dropins/server.xml @@ -0,0 +1,22 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + jdbc-4.0 + + + configfatlibertyinternals-1.0 + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.extensions/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.extensions/bootstrap.properties new file mode 100755 index 00000000000..4f1ae5a2e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.extensions/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/server.xml new file mode 100755 index 00000000000..ae5eafe0b2f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.features/server.xml @@ -0,0 +1,38 @@ + + + + + osgiConsole-1.0 + servlet-3.0 + jdbc-4.0 + localConnector-1.0 + oauth-2.0 + ssl-1.0 + openidConnectServer-1.0 + + + + + + + + + + + + + + + + + client01 + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/server.xml new file mode 100755 index 00000000000..331d606b15b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.helper/server.xml @@ -0,0 +1,25 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + + + mergedConfigTest-1.0 + + + configfatlibertyinternals-1.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/bootstrap.properties new file mode 100755 index 00000000000..9449ad31bc2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/bootstrap.properties @@ -0,0 +1,4 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +relativeLocation=relative.xml +onError=FAIL diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/common.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/common.xml new file mode 100755 index 00000000000..eae2d7b79ce --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/common.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/relative.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/relative.xml new file mode 100755 index 00000000000..3135a5d29dd --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/relative.xml @@ -0,0 +1,3 @@ + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/shared.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/shared.xml new file mode 100755 index 00000000000..46748c72e4a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/common/shared.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/server.xml new file mode 100755 index 00000000000..654abb21f83 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/server.xml @@ -0,0 +1,21 @@ + + + + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/shared.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/shared.xml new file mode 100755 index 00000000000..90be6e11040 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import.error/shared.xml @@ -0,0 +1,4 @@ + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/bootstrap.properties new file mode 100755 index 00000000000..84bdd909d92 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +relativeLocation=relative.xml diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/common.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/common.xml new file mode 100755 index 00000000000..eae2d7b79ce --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/common.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/relative.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/relative.xml new file mode 100755 index 00000000000..3135a5d29dd --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/relative.xml @@ -0,0 +1,3 @@ + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/shared.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/shared.xml new file mode 100755 index 00000000000..46748c72e4a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/common/shared.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/server.xml new file mode 100755 index 00000000000..41bee0d180f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/server.xml @@ -0,0 +1,16 @@ + + + + + + servlet-3.0 + configfatlibertyinternals-1.0 + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/shared.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/shared.xml new file mode 100755 index 00000000000..90be6e11040 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.import/shared.xml @@ -0,0 +1,4 @@ + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/server.xml new file mode 100755 index 00000000000..84857d23bf8 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidJDBCoption/server.xml @@ -0,0 +1,22 @@ + + + + + + jdbc-4.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidOptionalInclude/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidOptionalInclude/server.xml new file mode 100755 index 00000000000..bca129e7c18 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.invalidOptionalInclude/server.xml @@ -0,0 +1,24 @@ + + + + + + + + + jdbc-4.0 + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/common.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/common.xml new file mode 100755 index 00000000000..e3b36e57ce7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/common.xml @@ -0,0 +1,22 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + mergedConfigTest-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/conflict.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/conflict.xml new file mode 100755 index 00000000000..938c46720b5 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/conflict.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB.xml new file mode 100755 index 00000000000..34596140a85 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB2.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB2.xml new file mode 100755 index 00000000000..b031d93067b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelB2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC.xml new file mode 100755 index 00000000000..fa48b6a6de1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC2.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC2.xml new file mode 100755 index 00000000000..df7c921921f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/fourLevelC2.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/intermediateReplace.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/intermediateReplace.xml new file mode 100755 index 00000000000..af7b9f26f9e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/intermediateReplace.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/noConflict.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/noConflict.xml new file mode 100755 index 00000000000..02a08e80505 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/noConflict.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/server.xml new file mode 100755 index 00000000000..7829758b305 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.merging/server.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/server.xml new file mode 100755 index 00000000000..2fc260e93b7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.metatype.provider/server.xml @@ -0,0 +1,21 @@ + + + + + + + servlet-3.0 + osgiconsole-1.0 + httpservice-2.2 + metatypeProviderTest-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/bootstrap.properties new file mode 100755 index 00000000000..c554088bab6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/bootstrap.properties @@ -0,0 +1,2 @@ +osgi.console=localhost:5678 +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/server.xml new file mode 100755 index 00000000000..15ad3318664 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.product.extension/server.xml @@ -0,0 +1,9 @@ + + + + + osgiconsole-1.0 + jsp-2.2 + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/server.xml new file mode 100755 index 00000000000..cac904e50da --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh.error/server.xml @@ -0,0 +1,22 @@ + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/server.xml new file mode 100755 index 00000000000..cac904e50da --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.refresh/server.xml @@ -0,0 +1,22 @@ + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/bootstrap.properties new file mode 100755 index 00000000000..6be023c0898 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/bootstrap.properties @@ -0,0 +1,3 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties +myHttpPort=1234 diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/server.xml new file mode 100755 index 00000000000..99b80c2053e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart.var/server.xml @@ -0,0 +1,18 @@ + + + + + + servlet-3.0 + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/server.xml new file mode 100755 index 00000000000..d73ddfa9a3a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.restart/server.xml @@ -0,0 +1,21 @@ + + + + + + servlet-3.0 + configfatlibertyinternals-1.0 + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/.gitignore new file mode 100644 index 00000000000..5c38c69748d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/.gitignore @@ -0,0 +1,2 @@ +/download_target +/dropins diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/bootstrap.properties new file mode 100755 index 00000000000..72a1c9ce337 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/bootstrap.properties @@ -0,0 +1,20 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:\ +com.ibm.ws.config.schemagen.internal.ServerSchemaGeneratorImpl=all=enabled :\ +com.ibm.ws.jmx.connector.client.*=all=enabled:\ +com.ibm.ws.filetransfer.*=all=enabled:\ +com.ibm.ws.security.*=all=enabled:\ +com.ibm.websphere.security.*=all=enabled:\ +com.ibm.ws.webcontainer.*=all=enabled:\ +com.ibm.ws.webcontainer.security.*=all=enabled:\ +com.ibm.ws.webcontainer.security.internal.*=all=enabled:\ +com.ibm.ws.ssl.*=all=enabled:\ +SSL=all=enabled:\ +jmx.rest.server.connector=all=enabled:\ +FileTransfer=all=enabled:\ +web.*=all=enabled:\ +jmx.rest.server.connector=all=enabled:\ +logservice=all=enabled + +com.ibm.ws.logging.max.file.size=0 + +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/server.xml new file mode 100755 index 00000000000..df41d8e53eb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.schemaGen.mbean/server.xml @@ -0,0 +1,17 @@ + + + + restConnector-1.0 + servlet-3.0 + + + + + + + + + + ${server.output.dir} + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.uniquevalueconflict/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.uniquevalueconflict/server.xml new file mode 100755 index 00000000000..366f01211da --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.uniquevalueconflict/server.xml @@ -0,0 +1,19 @@ + + + + + + + jsp-2.2 + jdbc-4.0 + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/bootstrap.properties new file mode 100755 index 00000000000..4f1ae5a2e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/server.xml new file mode 100755 index 00000000000..f58a679c61d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update.mbean/server.xml @@ -0,0 +1,9 @@ + + + + localConnector-1.0 + servlet-3.0 + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/bootstrap.properties new file mode 100755 index 00000000000..4f1ae5a2e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/server.xml new file mode 100755 index 00000000000..1ff1cba56a8 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.update/server.xml @@ -0,0 +1,9 @@ + + + + localConnector-1.0 + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/common/common.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/common/common.xml new file mode 100755 index 00000000000..e1b01a740cf --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/common/common.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/full.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/full.xml new file mode 100755 index 00000000000..1bd852b91f9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/full.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/server.xml new file mode 100755 index 00000000000..0c4fe350831 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validate/server.xml @@ -0,0 +1,22 @@ + + + + + + metatype-1.0 + configfatlibertyinternals-1.0 + servlet-3.0 + appSecurity-2.0 + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/bootstrap.properties new file mode 100755 index 00000000000..4f1ae5a2e10 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/server.xml new file mode 100755 index 00000000000..9253415a30a --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validateConfig/server.xml @@ -0,0 +1,10 @@ + + + + localConnector-1.0 + configfatlibertyinternals-1.0 + + + + + diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/server.xml new file mode 100755 index 00000000000..0ef4ffe19bd --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.validator/server.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + ${minVersion} + ${maxVersion} + ${minVersion} - ${maxVersion} + ${jdkVersion} + ${myMaxVersion} + + v1 + v2 + v3,v4 + v\5 + + + + + + + + + + + +p1oS139FKjDhhBuzB/5HicsDCYc=WQhTMFkWpJcuqaHGLRU4yL4yNm++CxJW4BkTQu71cQgSTSrOsCyYR3lzYqEntqI6vHoaiA1t/6yKzwQ0m9L0WkgkQeWwKjWa6xgQNa2oSar/KkPkXcMVTY3KqlfgL29Vlg0Ac0Ph3F9tRPLOp6SbVrGvvEHAApjMD/5YyDLtVIB127K18yrNTRhvMQ/bzqVLLFKjdiqXF4rMXG1urqD2HWx+CS8G5T1FOoDAP0BhROD4dXbDaiiIOlTAiSwEeddRVdi2HdShi423N3eE8o7iXSBk4yXk5nneYP02mb5vBlxjxHXpdBkcJ0fnR9OdFjpOiX96bOGK+VnVbQadfoYacg==CN=WebSphere Application Server Liberty Profile,OU=Software Group,O=IBM Corp.,L=Armonk,ST=New York,C=USMIIDqDCCApCgAwIBAgIEUMJaljANBgkqhkiG9w0BAQsFADCBlTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCE5ldyBZb3JrMQ8wDQYDVQQHEwZBcm1vbmsxEjAQBgNVBAoTCUlCTSBDb3JwLjEXMBUGA1UECxMOU29mdHdhcmUgR3JvdXAxNTAzBgNVBAMTLFdlYlNwaGVyZSBBcHBsaWNhdGlvbiBTZXJ2ZXIgTGliZXJ0eSBQcm9maWxlMB4XDTEyMTIwNzIxMDczNFoXDTMyMTIwMjIxMDczNFowgZUxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhOZXcgWW9yazEPMA0GA1UEBxMGQXJtb25rMRIwEAYDVQQKEwlJQk0gQ29ycC4xFzAVBgNVBAsTDlNvZnR3YXJlIEdyb3VwMTUwMwYDVQQDEyxXZWJTcGhlcmUgQXBwbGljYXRpb24gU2VydmVyIExpYmVydHkgUHJvZmlsZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ8l5a67C3jNwuS9g0rYYJ3dDjnykECQGXgQ7sP5i9ixF0Gg6NYesjn6VUBhf8ziC/4R4yrflPID+C1nM9SsUQld5QyAjbboRCXbW6+oIofzQKzWUHQQavXOXkH3i765GlsuME2qHYT+H8SQ0S0Z2ZMQGr8PXA8lzTSvExozx+oXRXaqG97cpfNDjVZVswxR9QL5h5GdZ7INtN6OcNiKalz5cF95G4VvL1sjtRkPaupNV7C09hnw+UzdPjmxmIOkw6BbS/J0gkE+NSDjQCt1O4EalCOy1ERKMZIb3QsKyYQvebaXCm7u3aEy/yszaCwIIldSjYjM15SUQw20L5vbn/UCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAeJICZmkkBYgMqcq17+GRTWaDvKkcmBdBaIi6DDuRM31FNI7AzB2uLX2vJzXrrxPW41YturXKAZf25uKbgZOikO8e3djjCUhiLYhIm4aTJxPlrh+MejaNAwAVeZBunNrZL9VI8jtU/a1Vd9bEdQ305yXWzt5c5mfJB3Yrn0LmwYKiSfG2pERy0TVnCpNLM6iQ7O2lQLVXXwlxNthWyOavEqlK54LR1GoklhC4k1r4d/5Cc2tjsoIi1y9gZj0qZptJCM2o1RtWf/xa+MgIavH+M/FqLzphvGOoxkPOqOfgpLPhM7bpLM6xqhiqexE5Xxq0JiNaxDi5iVUoDDxXG8ZslA== \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/.gitignore b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/bootstrap.properties b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/bootstrap.properties new file mode 100755 index 00000000000..95e4f6aa26f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=config=all=enabled:*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/common.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/common.xml new file mode 100755 index 00000000000..1bf222e9900 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/common.xml @@ -0,0 +1,19 @@ + + + + + + + jsp-2.2 + osgiconsole-1.0 + httpservice-2.2 + configfatlibertyinternals-1.0 + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/conflict.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/conflict.xml new file mode 100755 index 00000000000..d8293e3f6d6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/conflict.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/noConflict.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/noConflict.xml new file mode 100755 index 00000000000..2cb9eb36fbd --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/noConflict.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/server.xml b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/server.xml new file mode 100755 index 00000000000..7829758b305 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/publish/servers/com.ibm.ws.config.varmerging/server.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..dac908a02fb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..5888d2ec00d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..95bbc2c1c95 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/childalias/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + ChildAliasTestServlet + test.server.config.childalias.ChildAliasTestServlet + + + + + ChildAliasTestServlet + /child-alias-test + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/childalias/src/test/server/config/childalias/ChildAliasTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/childalias/src/test/server/config/childalias/ChildAliasTestServlet.java new file mode 100755 index 00000000000..b1a6c01a2be --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/childalias/src/test/server/config/childalias/ChildAliasTestServlet.java @@ -0,0 +1,443 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.config.childalias; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +/** + * + */ +public class ChildAliasTestServlet extends HttpServlet { + + private static final String CHILD_1_PID = "test.config.childalias.child.1"; + private static final String CHILD_2_PID = "test.config.childalias.child.2"; + private static final String CHILD_3_PID = "test.config.childalias.child.3"; + private static final String CHILD_4_PID = "test.config.childalias.child.4"; + private static final String CHILD_5_PID = "test.config.childalias.child.5"; + private static final String CHILD_6_PID = "test.config.childalias.child.6"; + private static final String PARENT_1_PID = "test.config.childalias.parent.1"; + private static final String PARENT_2_PID = "test.config.childalias.parent.2"; + private static final String PARENT_3_PID = "test.config.childalias.parent.3"; + private static final String PARENT_4_PID = "test.config.childalias.parent.4"; + private static final String PARENT_5_PID = "test.config.childalias.parent.5"; + private static final String PARENT_6_PID = "test.config.childalias.parent.6"; + private static final String TOP_LEVEL_PID = "test.config.childalias.toplevel"; + + private final ArrayList references = new ArrayList(); + private BundleContext bundleContext; + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + if (testName.equals("dump")) { + // Just for debugging + dump(writer); + } else { + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + } + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + /** + * Just for manual debugging + * + * @param writer + * @throws Exception + */ + private void dump(PrintWriter writer) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configurations; + try { + configurations = ca.listConfigurations(null); + for (Configuration c : configurations) { + writer.print("

"); + String pid = c.getFactoryPid() == null ? c.getPid() : c.getFactoryPid(); + if (pid.startsWith("test")) { + writer.println(pid); + } + } + } catch (InvalidSyntaxException e1) { + throw new IOException(e1); + } + + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } + + public void testChildAlias1() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(CHILD_1_PID, true); + Configuration[] children1 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + CHILD_1_PID + " should exist", children1); + assertEquals("There should only be one instance of PID " + CHILD_1_PID, 1, children1.length); + + Configuration child1 = children1[0]; + Dictionary childProperties = child1.getProperties(); + assertEquals("The attribute value should be the correct metatype translated value", + "defaultValue", childProperties.get("defaultAttribute")); + + filter = getFilter(PARENT_1_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_1_PID + " should exist", parents); + assertEquals("There should be only one instance of PID " + PARENT_1_PID, 1, parents.length); + Configuration parent = parents[0]; + Dictionary parentProperties = parent.getProperties(); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + childProperties.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + public void testChildAlias2() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(CHILD_2_PID, true); + Configuration[] children2 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + CHILD_2_PID + " should exist", children2); + assertEquals("There should only be one instance of PID " + CHILD_2_PID, 1, children2.length); + + Configuration child2 = children2[0]; + Dictionary child2Properties = child2.getProperties(); + assertEquals("The attribute value should be the correct metatype translated value", + "square", child2Properties.get("shape")); + assertEquals("The attribute value should be the correct value from the config", + "orange", child2Properties.get("color")); + + filter = getFilter(PARENT_2_PID, true); + Configuration[] parents2 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_2_PID + " should exist", parents2); + assertEquals("There should be only one instance of PID " + PARENT_2_PID, 1, parents2.length); + Configuration parent2 = parents2[0]; + Dictionary parent2Properties = parent2.getProperties(); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parent2Properties.get(XMLConfigConstants.CFG_SERVICE_PID), + child2Properties.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + public void testChildAliasSingleton1() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = "(" + Constants.SERVICE_PID + "=" + CHILD_3_PID + ")"; + Configuration[] children3 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + CHILD_3_PID + " should exist", children3); + assertEquals("There should only be one instance of PID " + CHILD_3_PID, 1, children3.length); + + Configuration child3 = children3[0]; + Dictionary childProperties = child3.getProperties(); + assertEquals("The attribute value should be the correct metatype translated value", + "coconut", childProperties.get("defaultAttribute")); + assertNull("There should be no contamination from other singletons", childProperties.get("state")); + + filter = "(" + Constants.SERVICE_PID + "=" + PARENT_3_PID + ")"; + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_3_PID + " should exist", parents); + assertEquals("There should be only one instance of PID " + PARENT_3_PID, 1, parents.length); + Configuration parent = parents[0]; + Dictionary parentProperties = parent.getProperties(); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + childProperties.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + public void testChildAliasSingleton2() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = "(" + Constants.SERVICE_PID + "=" + CHILD_4_PID + ")"; + Configuration[] children4 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + CHILD_4_PID + " should exist", children4); + assertEquals("There should only be one instance of PID " + CHILD_4_PID, 1, children4.length); + + Configuration child4 = children4[0]; + Dictionary childProperties = child4.getProperties(); + assertEquals("The attribute value should be the correct metatype translated value", + "washington", childProperties.get("state")); + assertNull("There should be no contamination from other singletons", childProperties.get("defaultAttribute")); + + filter = "(" + Constants.SERVICE_PID + "=" + PARENT_4_PID + ")"; + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_4_PID + " should exist", parents); + assertEquals("There should be only one instance of PID " + PARENT_4_PID, 1, parents.length); + Configuration parent = parents[0]; + Dictionary parentProperties = parent.getProperties(); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + childProperties.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + /** + * Simulate bundle ordering issues by loading a new feature that forces a new bundle to load. + * + * Bundle B has a parent with an unloaded child and a child with an unloaded parent. At this point, + * nothing much will be resolved, but we can verify that there is no contamination with other child + * elements with the same childAlias. + * + * @throws Exception + */ + public void testBundleOrdering1() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(CHILD_5_PID, true); + Configuration[] children5 = ca.listConfigurations(filter); + assertNull("The configuration for " + CHILD_5_PID + " should not exist", children5); + + filter = getFilter(PARENT_5_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNull("The configuration for " + PARENT_5_PID + " should not exist", parents); + + Configuration[] children6 = ca.listConfigurations(getFilter(CHILD_6_PID, true)); + assertNull("The configuration for " + CHILD_6_PID + " should not exist", children6); + + dump(new PrintWriter(System.out)); + + Configuration[] parents6 = ca.listConfigurations(getFilter(PARENT_6_PID, true)); + assertNotNull("The configuration for " + PARENT_6_PID + " should exist", parents6); + assertEquals("There should be only one instance of PID " + PARENT_6_PID, 1, parents6.length); + Configuration parent = parents6[0]; + Dictionary parentProperties = parent.getProperties(); + String[] child6Pids = (String[]) parentProperties.get("testCAChild"); + assertNotNull(PARENT_6_PID + " should have a child element testCAChild", child6Pids); + assertEquals("There should be 1 child pid", 1, child6Pids.length); + Configuration child6Config = ca.getConfiguration(child6Pids[0]); + assertNotNull("The child for " + PARENT_6_PID + " should be available in the configuration", child6Config); + Dictionary child6Props = child6Config.getProperties(); + assertEquals("The child should not be metatype processed", "Not Default", child6Props.get("testAttribute6")); + assertNull("The child should not be metatype processed", child6Props.get("defaultSix")); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + child6Props.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + /** + * Simulate bundle ordering issues by loading a new feature that forces a new bundle to load. + * + * Bundle C has a parent with a child in Bundle B and a child with a parent in Bundle B. All + * elements should be resolved correctly at this point. + * + * @throws Exception + */ + public void testBundleOrdering2() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(CHILD_5_PID, true); + Configuration[] children5 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + CHILD_5_PID + " should exist", children5); + + filter = getFilter(PARENT_5_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_5_PID + " should exist", parents); + + Configuration[] children6 = ca.listConfigurations(getFilter(CHILD_6_PID, true)); + assertNotNull("The configuration for " + CHILD_6_PID + " should exist", children6); + + Configuration[] parents6 = ca.listConfigurations(getFilter(PARENT_6_PID, true)); + assertNotNull("The configuration for " + PARENT_6_PID + " should exist", parents6); + assertEquals("There should be only one instance of PID " + PARENT_6_PID, 1, parents6.length); + Configuration parent = parents6[0]; + Dictionary parentProperties = parent.getProperties(); + String[] child6Pids = (String[]) parentProperties.get("testCAChild"); + assertNotNull(PARENT_6_PID + " should have a child element testCAChild", child6Pids); + assertEquals("There should be only one child pid", 1, child6Pids.length); + Configuration child6Config = ca.getConfiguration(child6Pids[0]); + assertNotNull("The child for " + PARENT_6_PID + " should be available in the configuration", child6Config); + Dictionary child6Props = child6Config.getProperties(); + assertEquals("The child should have correct properties", "Not Default", child6Props.get("testAttribute6")); + assertEquals("The child should be metatype processed", "defaultValueSix", child6Props.get("defaultSix")); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + child6Props.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + /** + * Same scenario as testBundleOrdering2, but asserting that there are no contamination issues between the + * top level element and the child alias elements. + * + * @throws Exception + */ + public void testBundleOrderingAliasConflict() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(TOP_LEVEL_PID, true); + Configuration[] topLevel = ca.listConfigurations(filter); + assertNotNull("The configuration for " + TOP_LEVEL_PID + " should exist", topLevel); + assertEquals("There should be only one instance of PID " + TOP_LEVEL_PID, 1, topLevel.length); + Configuration topLevelConfig = topLevel[0]; + Dictionary topLevelProperties = topLevelConfig.getProperties(); + + assertEquals("The element should have correct properties", "topLevel", topLevelProperties.get("location")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("testAttribute6")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("defaultSix")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("country")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("state")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("defaultAttribute")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("testAttribute3")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("color")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("shape")); + assertNull("The element should not have properties from different OCDs", topLevelProperties.get("testAttribute1")); + + assertNull("The parent pid should be null", + topLevelProperties.get(XMLConfigConstants.CFG_PARENT_PID)); + } + + public void testRemoveChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] parents6 = ca.listConfigurations(getFilter(PARENT_6_PID, true)); + assertNull(PARENT_6_PID + " should be removed", parents6); + + Configuration[] children6 = ca.listConfigurations(getFilter(CHILD_6_PID, true)); + assertNull(CHILD_6_PID + " should be removed", children6); + } + + public void testAddNewChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] parents6 = ca.listConfigurations(getFilter(PARENT_6_PID, true)); + assertNotNull(PARENT_6_PID + " should be added", parents6); + assertEquals("There should be one parent", 1, parents6.length); + Configuration parent = parents6[0]; + Dictionary parentProperties = parent.getProperties(); + String[] child6Pids = (String[]) parentProperties.get("testCAChild"); + assertNotNull(PARENT_6_PID + " should have a child element testCAChild", child6Pids); + assertEquals("There should be only one child pid", 1, child6Pids.length); + Configuration child6Config = ca.getConfiguration(child6Pids[0]); + assertNotNull("The child for " + PARENT_6_PID + " should be available in the configuration", child6Config); + Dictionary child6Props = child6Config.getProperties(); + assertEquals("The child should have correct properties", "New Child", child6Props.get("testAttribute6")); + assertEquals("The child should be metatype processed", "defaultValueSix", child6Props.get("defaultSix")); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + child6Props.get(XMLConfigConstants.CFG_PARENT_PID)); + + } + + public void testUpdateChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] children6 = ca.listConfigurations(getFilter(CHILD_6_PID, true)); + assertNotNull("The child for " + PARENT_6_PID + " should be available in the configuration", children6); + assertEquals("There should be only one child pid", 1, children6.length); + Configuration child6Config = children6[0]; + Dictionary child6Props = child6Config.getProperties(); + assertEquals("The child should have correct properties", "Updated Child", child6Props.get("testAttribute6")); + assertEquals("The child should be metatype processed", "defaultValueSix", child6Props.get("defaultSix")); + } + + public void testRemoveSingletonChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] parents3 = ca.listConfigurations(getFilter(PARENT_3_PID, false)); + assertNotNull(PARENT_3_PID + " should exist", parents3); + assertEquals("There should be one parent", 1, parents3.length); + + Configuration[] children3 = ca.listConfigurations(getFilter(CHILD_3_PID, false)); + // CHILD_3 has defaults. Instead of a remove taking place, the defaults will be used + assertNotNull(CHILD_3_PID + " should not be removed", children3); + assertEquals("There should be one child", 1, children3.length); + Configuration child3 = children3[0]; + Dictionary properties = child3.getProperties(); + assertEquals("Default values should be used", "coconut", properties.get("defaultAttribute")); + assertEquals("Default values should be used", "Attribute 3", properties.get("testAttribute3")); + } + + public void testAddNewSingletonChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] parents3 = ca.listConfigurations(getFilter(PARENT_3_PID, false)); + assertNotNull(PARENT_3_PID + " should exist", parents3); + assertEquals("There should be one parent", 1, parents3.length); + Configuration parent = parents3[0]; + Dictionary parentProperties = parent.getProperties(); + String[] child3Pids = (String[]) parentProperties.get("testCAChild"); + assertNotNull(PARENT_3_PID + " should have a child element testCAChild", child3Pids); + assertEquals("There should be only one child pid", 1, child3Pids.length); + Configuration child3Config = ca.getConfiguration(child3Pids[0]); + assertNotNull("The child for " + PARENT_3_PID + " should be available in the configuration", child3Config); + Dictionary child3Props = child3Config.getProperties(); + assertEquals("The child should have correct properties", "New Singleton Child", child3Props.get("testAttribute3")); + assertEquals("The child should be metatype processed", "coconut", child3Props.get("defaultAttribute")); + assertEquals("The child's parent PID should be equal to the parent's service pid", + parentProperties.get(XMLConfigConstants.CFG_SERVICE_PID), + child3Props.get(XMLConfigConstants.CFG_PARENT_PID)); + + } + + public void testUpdateSingletonChild() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] children3 = ca.listConfigurations(getFilter(CHILD_3_PID, false)); + assertNotNull("The child for " + PARENT_3_PID + " should be available in the configuration", children3); + assertEquals("There should be only one child pid", 1, children3.length); + Configuration child3Config = children3[0]; + Dictionary child3Props = child3Config.getProperties(); + assertEquals("The child should have correct properties", "Updated Singleton Child", child3Props.get("testAttribute3")); + assertNull("The child should not be contaminated with other singletons", child3Props.get("testAttribute1")); + assertEquals("The child should be metatype processed", "coconut", child3Props.get("defaultAttribute")); + } +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..9fa09933ae2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm, com.ibm.websphere.config diff --git a/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..5888d2ec00d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..acc50e1908c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/confighelper/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + WSConfigurationHelperTestServlet + test.config.helper.WSConfigurationHelperTestServlet + + + + + WSConfigurationHelperTestServlet + /helperTest + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/confighelper/src/test/config/helper/WSConfigurationHelperTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/confighelper/src/test/config/helper/WSConfigurationHelperTestServlet.java new file mode 100755 index 00000000000..3d76cf52fc2 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/confighelper/src/test/config/helper/WSConfigurationHelperTestServlet.java @@ -0,0 +1,483 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package test.config.helper; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +import com.ibm.websphere.config.WSConfigurationHelper; +import com.ibm.wsspi.kernel.service.utils.OnErrorUtil.OnError; + +/** + * + */ +public class WSConfigurationHelperTestServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = 1L; + private final ArrayList> references = new ArrayList>(); + private BundleContext bundleContext; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + if (testName.equals("dump")) { + // Just for debugging + dump(writer); + } else { + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + } + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + /** + * Just for manual debugging + * + * @param writer + * @throws Exception + */ + private void dump(PrintWriter writer) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configurations; + try { + configurations = ca.listConfigurations(null); + for (Configuration c : configurations) { + writer.print("

"); + String pid = c.getFactoryPid() == null ? c.getPid() : c.getFactoryPid(); + if (pid.startsWith("test")) { + writer.println(pid); + } + } + } catch (InvalidSyntaxException e1) { + throw new IOException(e1); + } + + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List> references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private WSConfigurationHelper getHelper() { + ServiceReference ref = bundleContext.getServiceReference(WSConfigurationHelper.class); + if (ref == null) { + fail("Reference to WSConfigurationHelper not found"); + return null; + } else { + return bundleContext.getService(ref); + } + } + + public void testGetDefaultProperties() throws Exception { + + String factoryPid = "com.ibm.ws.config"; + + Dictionary dictionary = getHelper().getMetaTypeDefaultProperties(factoryPid); + assertEquals(new Long(500), dictionary.get("monitorInterval")); + assertEquals("polled", dictionary.get("updateTrigger")); + assertEquals(OnError.WARN, dictionary.get("onError")); + + } + + public void testGetDefaultPropertiesWithRequired() throws Exception { + String factoryPid = "com.ibm.ws.config.test.helper"; + + Dictionary dictionary = getHelper().getMetaTypeDefaultProperties(factoryPid); + assertEquals("hello", dictionary.get("defaultVal")); + assertNull(dictionary.get("requiredVal")); + + } + + /** + * Add a default singleton, replacing a "default" singleton (not specified in server.xml, but has all required metatype defaults) + * + * @throws Exception + */ + public void testAddDefaultConfiguration1() throws Exception { + String pid = "com.ibm.ws.config"; + + Dictionary dictionary = new Hashtable(); + dictionary.put("monitorInterval", "700"); + + getHelper().addDefaultConfiguration(pid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration c = ca.getConfiguration(pid); + assertEquals(new Long(700), c.getProperties().get("monitorInterval")); + + // Remove the default config we added, see that the singleton has returned to the original + getHelper().removeDefaultConfiguration(pid); + c = ca.getConfiguration(pid); + assertEquals(new Long(500), c.getProperties().get("monitorInterval")); + } + + /** + * Add a default factory config for a pid that didn't previously exist + * + * @throws Exception + */ + public void testAddDefaultConfiguration2() throws Exception { + String factoryPid = "com.ibm.ws.config.test.helper"; + Dictionary dictionary = new Hashtable(); + dictionary.put("requiredVal", "goodbye"); + + getHelper().addDefaultConfiguration(factoryPid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(1, configs.length); + Dictionary props = configs[0].getProperties(); + assertEquals("goodbye", props.get("requiredVal")); + assertEquals("hello", props.get("defaultVal")); + + // Remove the default configuration, verify that the config goes away + getHelper().removeDefaultConfiguration(factoryPid); + configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertNull(configs); + + } + + /** + * Add a default factory config for a pid that did exist. Values should be merged + * + * @throws Exception + */ + public void testAddDefaultConfiguration3() throws Exception { + String factoryPid = "com.ibm.example.topLevelElement"; + + Dictionary dictionary = new Hashtable(); + dictionary.put("id", "top"); + dictionary.put("drink", "coffee"); + + getHelper().addDefaultConfiguration(factoryPid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(1, configs.length); + Dictionary props = configs[0].getProperties(); + assertEquals("top", props.get("id")); + // From new default config + assertEquals("coffee", props.get("drink")); + // From server.xml + assertEquals("scone", props.get("food")); + // From metatype defaults, both instances + assertEquals("value", props.get("attribute")); + + // Remove the default configuration, see that the config has returned to the values in server.xml + getHelper().removeDefaultConfiguration(factoryPid); + + configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(1, configs.length); + props = configs[0].getProperties(); + assertEquals("top", props.get("id")); + // From new default config + assertNull(props.get("drink")); + // From server.xml + assertEquals("scone", props.get("food")); + // From metatype defaults, both instances + assertEquals("value", props.get("attribute")); + } + + /** + * Add two default configurations, same pid, distinct ids + * + * @throws Exception + */ + public void testAddDefaultConfiguration4() throws Exception { + String factoryPid = "com.ibm.example.topLevelElement"; + + Dictionary dictionary = new Hashtable(); + dictionary.put("id", "top"); + dictionary.put("drink", "coffee"); + + WSConfigurationHelper helper = getHelper(); + helper.addDefaultConfiguration(factoryPid, dictionary); + dictionary.put("id", "top2"); + dictionary.put("drink", "tea"); + helper.addDefaultConfiguration(factoryPid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(2, configs.length); + + for (Configuration config : configs) { + Dictionary props = config.getProperties(); + String id = (String) props.get("id"); + if ("top".equals(id)) { + // From new default config + assertEquals("coffee", props.get("drink")); + // From server.xml + assertEquals("scone", props.get("food")); + // From metatype defaults, both instances + assertEquals("value", props.get("attribute")); + } else if ("top2".equals(id)) { + assertEquals("tea", props.get("drink")); + assertNull(props.get("food")); + assertEquals("value", props.get("attribute")); + } else { + fail("Unrecognized id: " + id); + } + } + + // Remove the default configuration, see that the config has returned to the values in server.xml + getHelper().removeDefaultConfiguration(factoryPid); + + configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(1, configs.length); + Dictionary props = configs[0].getProperties(); + assertEquals("top", props.get("id")); + // From new default config + assertNull(props.get("drink")); + // From server.xml + assertEquals("scone", props.get("food")); + // From metatype defaults, both instances + assertEquals("value", props.get("attribute")); + } + + /** + * Add factory pid with default id and ibm:extends + * + * @throws Exception + */ + public void testAddDefaultConfiguration5() throws Exception { + String factoryPid = "com.ibm.example.child.a"; + String superPid = "com.ibm.example.supertype"; + Dictionary dictionary = new Hashtable(); + dictionary.put("attrA1", "goodbye"); + + getHelper().addDefaultConfiguration(factoryPid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertEquals(1, configs.length); + Dictionary props = configs[0].getProperties(); + assertEquals("goodbye", props.get("attrA1")); + assertEquals("value2", props.get("attrA2")); + + configs = ca.listConfigurations(getFilter(superPid, true)); + assertEquals(1, configs.length); + props = configs[0].getProperties(); + assertEquals("goodbye", props.get("attrA1")); + assertEquals("value2", props.get("attrA2")); + + // Remove the default configuration, verify that the config goes away + getHelper().removeDefaultConfiguration(factoryPid); + configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertNull(configs); + configs = ca.listConfigurations(getFilter(superPid, true)); + assertNull(configs); + + } + + /** + * Add default configuration for a pid that doesn't have metatype. It shouldn't exist in + * config admin. Then remove the default configuration and verify that it still isn't there. + * + * @throws Exception + */ + public void testAddDefaultConfiguration6() throws Exception { + String factoryPid = "nonMetatype"; + Dictionary dictionary = new Hashtable(); + dictionary.put("attrA1", "goodbye"); + + getHelper().addDefaultConfiguration(factoryPid, dictionary); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertNull("The non-metatype configuration should not exist", configs); + + // Remove the default configuration, verify that the config still doesn't exist + getHelper().removeDefaultConfiguration(factoryPid); + configs = ca.listConfigurations(getFilter(factoryPid, true)); + assertNull(configs); + } + + /** + * Add a default factory nested config for a parent that did exist. Values should be merged + * + * Using metatype from metatype-nested-merge.xml + * + * @throws Exception + */ + public void testAddDefaultConfiguration7() throws Exception { + String parentPid = "test.nestedmerge.parent.ONE"; + String childPid = "test.nestedmerge.child"; + + String xml = "" + + " " + + "" + + "" + + ""; + + ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes()); + + getHelper().addDefaultConfiguration(bais); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(childPid, true)); + assertNotNull("The child configuration should exist", configs); + assertEquals(1, configs.length); + Dictionary props = configs[0].getProperties(); + assertEquals("child", props.get("id")); + // From new default config + assertEquals("coffee", props.get("someAttr")); + + // Remove the default configuration, see that the config has returned to the values in server.xml + + getHelper().removeDefaultConfiguration(parentPid); + + configs = ca.listConfigurations(getFilter(parentPid, true)); + assertEquals(1, configs.length); + props = configs[0].getProperties(); + assertEquals("one", props.get("id")); + + assertNull("The child element should not exist as a property on the parent", props.get("child")); + + configs = ca.listConfigurations(getFilter(childPid, true)); + assertNull("The child element should not exist", configs); + } + + /** + * Add a default factory nested config for a parent that doesn't exist with the same id. An instance of the + * parent and child should be added by addDefaultConfiguration, and both should be removed by remove + * + * Using metatype from metatype-nested-merge.xml + * + * @throws Exception + */ + public void testAddDefaultConfiguration8() throws Exception { + String parentPid = "test.nestedmerge.parent.ONE"; + String childPid = "test.nestedmerge.child"; + + String xml = "" + + " " + + "" + + "" + + ""; + + ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes()); + + getHelper().addDefaultConfiguration(bais); + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(parentPid, true)); + assertNotNull("the parent configurations should exist", configs); + assertEquals(2, configs.length); + + // Get the properties for the parent with id "two" + Dictionary props = configs[0].getProperties(); + if ("one".equals(props.get("id"))) + props = configs[1].getProperties(); + assertEquals("two", props.get("id")); + String childServicePid = (String) props.get("child"); + assertNotNull("The child should exist as a property on the parent", childServicePid); + + // Get the child configuration + configs = ca.listConfigurations(getFilter(childPid, true)); + assertNotNull("The child configuration should exist", configs); + assertEquals(1, configs.length); + props = configs[0].getProperties(); + assertEquals("child", props.get("id")); + // From new default config + assertEquals("coffee", props.get("someAttr")); + assertEquals(childServicePid, props.get("service.pid")); + + // Remove the default configuration, see that the config has returned to the values in server.xml + + getHelper().removeDefaultConfiguration(parentPid); + + configs = ca.listConfigurations(getFilter(parentPid, true)); + assertEquals(1, configs.length); + props = configs[0].getProperties(); + assertEquals("one", props.get("id")); + + assertNull("The child element should not exist as a property on the parent", props.get("child")); + + configs = ca.listConfigurations(getFilter(childPid, true)); + assertNull("The child element should not exist", configs); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..dac908a02fb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..5888d2ec00d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..5b8510ae6c7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/dropins/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + ConfigDropinsTestServlet + test.config.dropins.ConfigDropinsServlet + + + + + ConfigDropinsTestServlet + /dropinsTest + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/dropins/src/test/config/dropins/ConfigDropinsServlet.java b/dev/com.ibm.ws.config_fat/test-applications/dropins/src/test/config/dropins/ConfigDropinsServlet.java new file mode 100755 index 00000000000..d44face709c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/dropins/src/test/config/dropins/ConfigDropinsServlet.java @@ -0,0 +1,218 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package test.config.dropins; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * + */ +public class ConfigDropinsServlet extends HttpServlet { + + private static final String LIBRARY_PID = "com.ibm.ws.classloading.sharedlibrary"; + private final ArrayList> references = new ArrayList>(); + private BundleContext bundleContext; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + if (testName.equals("dump")) { + // Just for debugging + dump(writer); + } else { + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + } + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + /** + * Just for manual debugging + * + * @param writer + * @throws Exception + */ + private void dump(PrintWriter writer) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configurations; + try { + configurations = ca.listConfigurations(null); + for (Configuration c : configurations) { + writer.print("

"); + String pid = c.getFactoryPid() == null ? c.getPid() : c.getFactoryPid(); + if (pid.startsWith("test")) { + writer.println(pid); + } + } + } catch (InvalidSyntaxException e1) { + throw new IOException(e1); + } + + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List> references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } + + public void testNonXmlFile() throws Exception { + // Make sure that we don't load files with extensions other than .xml + checkLibraryValue(TEST1, SERVER); + } + + public void testBrokenDropin() throws Exception { + // We should continue to parse server.xml and dropins after encountering a broken file + checkLibraryValue(TEST1, SIMPLE); + } + + public void testSimpleDefaults() throws Exception { + // Value specified for library description in dropin defaults is overridden + checkLibraryValue(TEST1, SERVER); + } + + public void testSimpleOverrides() throws Exception { + // Value specified for library description in dropin overrides is used instead of server.xml + checkLibraryValue(TEST1, SIMPLE); + } + + public void testSimpleOverrides2() throws Exception { + // Value specified for library description in dropin overrides is used instead of server.xml or default dropins + checkLibraryValue(TEST1, SIMPLE2); + } + + public void testDefaultsOrdering() throws Exception { + // Value from server.xml is used. Not testing much here, just sanity. + checkLibraryValue(TEST1, SERVER); + } + + public void testOverridesOrdering() throws Exception { + // Value from simple2.xml in overrides is used rather than simple.xml from overrides or server.xml. + checkLibraryValue(TEST1, SIMPLE2); + } + + public void testNoServerValue1() throws Exception { + // File in defaults, no value in server.xml, use default value + checkLibraryValue(TEST2, A); + } + + public void testNoServerValue2() throws Exception { + // File in overrides, no value in server.xml, use overrides value + checkLibraryValue(TEST2, A); + } + + public void testNoServerValue3() throws Exception { + // Files in defaults and overrides, no value in server.xml, use overrides value + checkLibraryValue(TEST2, B); + } + + private void checkLibraryValue(String libraryID, String description) throws Exception { + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configs = ca.listConfigurations(getFilter(LIBRARY_PID, true)); + if (configs == null) + fail("Could not find library configuration"); + + boolean found = false; + for (Configuration config : configs) { + Dictionary props = config.getProperties(); + String id = (String) props.get("id"); + if (libraryID.equals(id)) { + assertEquals("The description should be from simple.xml", description, props.get("description")); + found = true; + } + } + + assertTrue("The configuration for the library with ID testLibrary should exist", found); + + } + + private static final String TEST1 = "testLibrary"; + private static final String TEST2 = "testLibrary2"; + + private static final String SIMPLE = "Library From Simple.xml"; + private static final String SIMPLE2 = "Library from simple2.xml"; + private static final String SERVER = "Library from server.xml"; + private static final String A = "Library A"; + private static final String B = "Library B"; +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..5ff6e91bf81 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, java.net, javax.management, com.ibm.websphere.config.mbeans, com.ibm.ws.jmx.connector.client.rest diff --git a/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..5888d2ec00d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..5ee7921067f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mbeans/resources/WEB-INF/web.xml @@ -0,0 +1,16 @@ + + + + + AppClientServletSchemaGen + web.AppClientServletSchemaGen + + + + + AppClientServletSchemaGen + /appClient + + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/mbeans/src/web/AppClientServletSchemaGen.java b/dev/com.ibm.ws.config_fat/test-applications/mbeans/src/web/AppClientServletSchemaGen.java new file mode 100755 index 00000000000..155fb8fffe7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mbeans/src/web/AppClientServletSchemaGen.java @@ -0,0 +1,163 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package web; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.URLDecoder; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import javax.management.JMX; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.ibm.websphere.config.mbeans.ServerSchemaGenerator; +import com.ibm.websphere.filetransfer.FileTransferMBean; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; + +@SuppressWarnings("serial") +public class AppClientServletSchemaGen extends HttpServlet { + + private static MBeanServerConnection mbsc; + private static final String SUCCESS_MESSAGE = "Setup completed successfully."; + + private static final long MIN_FILE_SIZE = 500000; + + /** + * Uses the JMX REST connector client from within a user-application to test + * the functionality of com.ibm.websphere.config.mbeans.ServerSchemaGenerator + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + boolean successful = false; + String failureMessage = null; + + try { + + String serverRoot = URLDecoder.decode(request.getParameter("serverRoot"), "UTF-8"); + System.out.println("Server root:" + serverRoot); + System.setProperty("javax.net.ssl.trustStore", serverRoot + "/resources/security/key.jks"); + System.setProperty("javax.net.ssl.trustStorePassword", "Liberty"); + Map environment = new HashMap(); + environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + environment.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + JMXServiceURL url = new JMXServiceURL("REST", request.getServerName(), request.getServerPort(), "/IBMJMXConnectorREST"); + JMXConnector jmxConnector = JMXConnectorFactory.connect(url, environment); + mbsc = jmxConnector.getMBeanServerConnection(); + + //---------------------------------------===== + // Invoke MBean using MBeanServerConnection + //---------------------------------------===== + + //Invoke schema generation + Object[] params = new String[] { "1.0", "1", "UTF-8", Locale.getDefault().toString() }; //schemaVersion, outputVersion, encoding, locale + String[] signature = new String[] { "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String" }; + + final ObjectName SCHEMA_GEN_MBEAN = new ObjectName(ServerSchemaGenerator.OBJECT_NAME); + + @SuppressWarnings("unchecked") + Map returnedMap = (Map) mbsc.invoke(SCHEMA_GEN_MBEAN, "generateInstallSchema", params, signature); + + //Check return code + if ((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0) { + throw new RuntimeException("Invoke MBean - Generate schema call did not return successful return_code"); + } + + //Ensure the file is bigger than expected minimum size + String filePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + File file = new File(filePath); + if (file.length() < MIN_FILE_SIZE) { + throw new RuntimeException("Invoke MBean - Generated schema file is less than expected size. File=" + file.getAbsolutePath() + + " : size=" + file.length()); + } + + //--------------------------------------- + // Call operations using the API + //--------------------------------------- + + ServerSchemaGenerator schemaGenMBean = JMX.newMBeanProxy(mbsc, SCHEMA_GEN_MBEAN, ServerSchemaGenerator.class); + returnedMap = schemaGenMBean.generateInstallSchema(null, null, null, null); //schemaVersion, outputVersion, encoding, locale + + if ((Integer) returnedMap.get(ServerSchemaGenerator.KEY_RETURN_CODE) != 0) { + throw new RuntimeException("MBean via API - Generate schema call did not return successful return_code"); + } + + //Ensure the file is bigger than expected minimum size + String sourcePath = (String) returnedMap.get(ServerSchemaGenerator.KEY_FILE_PATH); + file = new File(sourcePath); + + if (file.length() < MIN_FILE_SIZE) { + throw new RuntimeException("MBean via API - Generated schema file is less than expected size. File=" + file.getAbsolutePath() + + " : size=" + file.length()); + } + + //Download generated file (typical user operation) + String targetPath = serverRoot + "/download_target/schemaServletCallAPI.xsd"; + + final ObjectName FILE_TRN_MBEAN = new ObjectName(FileTransferMBean.OBJECT_NAME); + FileTransferMBean fileTrnMBean = JMX.newMBeanProxy(mbsc, FILE_TRN_MBEAN, FileTransferMBean.class); + fileTrnMBean.downloadFile(sourcePath, targetPath); + + //Ensure downloaded file is bigger than expected minimum size + file = new File(targetPath); + + if (file.length() < MIN_FILE_SIZE) { + throw new RuntimeException("MBean via API - Downloaded schema file is less than expected size. File=" + file.getAbsolutePath() + + " : size=" + file.length()); + } + + // Delete the source file under logs/state + file = new File(sourcePath); + + // First check if the file exists + if (!file.exists()) { + throw new RuntimeException("MBean via API - Generated schema file does not exist (before deletion). File=" + file.getAbsolutePath()); + } + + fileTrnMBean.deleteFile(sourcePath); + + //Verify the file is deleted + if (file.exists()) { + throw new RuntimeException("MBean via API - Generated schema file was not deleted. File=" + file.getAbsolutePath() + " : size=" + file.length()); + } + + jmxConnector.close(); + + successful = true; + + } catch (Throwable t) { + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw)); + failureMessage = sw.toString(); + } + + PrintWriter writer = response.getWriter(); + writer.println(successful ? SUCCESS_MESSAGE : failureMessage); + writer.flush(); + writer.close(); + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..dac908a02fb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..5888d2ec00d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..b19c07b70cb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + MergedConfigTestServlet + test.config.merged.MergedConfigTestServlet + + + + + MergedConfigTestServlet + /mergedConfigTest + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/src/test/config/merged/MergedConfigTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/src/test/config/merged/MergedConfigTestServlet.java new file mode 100755 index 00000000000..b194ec66d89 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/mergedconfig/src/test/config/merged/MergedConfigTestServlet.java @@ -0,0 +1,304 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package test.config.merged; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * + */ +public class MergedConfigTestServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = 4084916808353306371L; + private final ArrayList> references = new ArrayList>(); + private BundleContext bundleContext; + + public static final String PARENT_PID = "com.ibm.example.topLevelElement"; + public static final String CHILD_A_PID = "com.ibm.example.child.a"; + public static final String CHILD_B_PID = "com.ibm.example.child.b"; + public static final String CHILD_C_PID = "com.ibm.example.child.c"; + public static final String PARENT_D_PID = "com.ibm.example.top.d"; + private static final String DEFAULT_PID = "com.ibm.example.default"; + private static final String DEFAULT_MISSING_PID = "com.ibm.example.default.missing"; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + if (testName.equals("dump")) { + // Just for debugging + dump(writer); + } else { + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + } + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + /** + * Just for manual debugging + * + * @param writer + * @throws Exception + */ + private void dump(PrintWriter writer) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configurations; + try { + configurations = ca.listConfigurations(null); + for (Configuration c : configurations) { + writer.print("

"); + String pid = c.getFactoryPid() == null ? c.getPid() : c.getFactoryPid(); + if (pid.startsWith("test")) { + writer.println(pid); + } + } + } catch (InvalidSyntaxException e1) { + throw new IOException(e1); + } + + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List> references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } + + private enum Behavior { + MERGE, REPLACE, IGNORE + } + + private void verify(Behavior behavior) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(PARENT_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_PID + " should exist", parents); + + assertEquals("There should be four instances of PID " + PARENT_PID, 4, parents.length); + + for (Configuration parent : parents) { + Dictionary properties = parent.getProperties(); + String id = (String) properties.get("id"); + if ("a".equals(id)) { + String[] pids = (String[]) properties.get("child.a"); + assertNotNull("The child pids should exist", pids); + assertEquals("There should be one child pid", 1, pids.length); + Configuration child = ca.getConfiguration(pids[0]); + assertNotNull("The child should exist", child); + Dictionary childProps = child.getProperties(); + if (behavior == Behavior.MERGE || behavior == Behavior.REPLACE) { + assertEquals("a1", childProps.get("attrA1")); + } else { + assertNull(childProps.get("attrA1")); + } + if (behavior == Behavior.MERGE || behavior == Behavior.IGNORE) { + assertEquals("a2", childProps.get("attrA2")); + } else { + // We replaced the top level (attrA2=a2) with the include (attr1=a1), but attrA2 has a default value. + assertEquals("value2", childProps.get("attrA2")); + } + } else if ("b".equals(id)) { + String[] pids = (String[]) properties.get("child.b"); + assertNotNull("the child pids should exist", pids); + assertEquals("there should be one child pid", 1, pids.length); + Configuration child = ca.getConfiguration(pids[0]); + assertNotNull("The child should exist", child); + Dictionary childProps = child.getProperties(); + assertEquals("b1", childProps.get("attrB1")); + assertEquals("b2", childProps.get("attrB2")); + } else if ("c".equals(id) || "common".equals(id)) { + } else { + fail("Something went horribly wrong."); + } + } + } + + public void testMergedConfig() throws Exception { + // All config in one file, verify it's merged correctly. If this isn't working, fix this first, because + // whatever is broken here would break the other tests. + verify(Behavior.MERGE); + } + + public void testMergedIncludesMerge() throws Exception { + // Same set of assumptions as the all in one case + verify(Behavior.MERGE); + } + + public void testMergedIncludesBreak() throws Exception { + // The config doesn't get updated, so verify we're still using the all in one config + verify(Behavior.MERGE); + } + + public void testMergedIncludesBreak2() throws Exception { + // Test is arranged so that the assumptions here are the same as for merge.. What would normally be + // merged in is specified in the top level file. The included file has the non conflicting elements, which + // should all get added despite onConflict="break" + verify(Behavior.MERGE); + } + + public void testMergedIncludesReplace() throws Exception { + // Verify that the attribute in the top level file gets replaced by the include + verify(Behavior.REPLACE); + } + + public void testMergedIncludesIgnore() throws Exception { + // Verify that the attribute in the included file gets ignored + verify(Behavior.IGNORE); + + } + + public void testMergedIncludesIgnoreReplace() throws Exception { + // Verify that none of the level 3 (REPLACE) or level 2 (IGNORE) elements are used + verify(Behavior.IGNORE); + } + + public void testMergedIncludesFourLevelReplace() throws Exception { + // Conflict is between level 2 (fourLevelB.xml) and level 4 (conflict.xml). Verify that the "replace" behavior from + // level 2 is used instead of the "ignore" behavior from level 3. + verify(Behavior.REPLACE); + } + + public void testMergedIncludesFourLevelIgnore() throws Exception { + // Conflict is between level 2 (fourLevelB2.xml) and level 4 (conflict.xml). Verify that the "ignore" behavior from + // level 2 is used instead of the "replace" behavior from level 3. + verify(Behavior.IGNORE); + } + + public void testDefaultInstances1() throws Exception { + // Check to make sure a default instance marked requiresExisting=true gets merged into an existing + // configuration + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + PARENT_PID + ")(id=common))"; + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PARENT_PID + "with the ID 'common' should exist", parents); + assertEquals("There should be one instance " + PARENT_PID, 1, parents.length); + + Dictionary properties = parents[0].getProperties(); + String[] pids = (String[]) properties.get("child.a"); + assertNotNull("the child pid should exist", pids); + assertEquals("there should be one child pid", 1, pids.length); + + } + + public void testDefaultInstances2() throws Exception { + // Check to make sure that a default instance without a requiresExisting attribute gets merged in and that one + // with requiresExisting=true does not. + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(DEFAULT_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + DEFAULT_PID + " should exist", parents); + assertEquals("There should be one instance of PID " + DEFAULT_PID, 1, parents.length); + + Dictionary properties = parents[0].getProperties(); + String id = (String) properties.get("id"); + assertEquals("The ID should be 'two'", "two", id); + + } + + public void testDefaultInstances3() throws Exception { + // Check to make sure a default instance marked addIfMissing=true gets added when an existing + // configuration is not specified. Also checks that an instance does not get added when there is an existing configuration. + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(DEFAULT_MISSING_PID, true); + Configuration[] parents = ca.listConfigurations(filter); + assertNotNull("The configuration for " + DEFAULT_MISSING_PID + " should exist", parents); + assertEquals("There should be two instances of PID " + DEFAULT_MISSING_PID, 2, parents.length); + + for (Configuration config : parents) { + Dictionary properties = config.getProperties(); + String id = (String) properties.get("id"); + String someProperty = (String) properties.get("someProperty"); + if ("one".equals(id)) { + assertNull("someProperty should be null because the default instance should not be merged", someProperty); + } else if ("two".equals(id)) { + assertEquals("someProperty should be defined because the default instance should be merged", someProperty, "from default instances"); + } else { + fail("Something went horribly wrong -- default instance with ID " + id + " found when 'one' or 'two' was expected"); + } + } + + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..826e67ac344 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: com.ibm.ws.config.metatype +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..5888d2ec00d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/OSGI-INF/metatype/metatype.xml b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/OSGI-INF/metatype/metatype.xml new file mode 100755 index 00000000000..da1f74436eb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatype/resources/OSGI-INF/metatype/metatype.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatype/src/test/server/config/metatype/TestRunner.java b/dev/com.ibm.ws.config_fat/test-applications/metatype/src/test/server/config/metatype/TestRunner.java new file mode 100755 index 00000000000..f6a0f503ef0 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatype/src/test/server/config/metatype/TestRunner.java @@ -0,0 +1,7 @@ +package test.server.config.metatype; + +// just a dummy class so that things get compiled + +public class TestRunner { + +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..dac908a02fb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..5888d2ec00d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..c0aded3cc2d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + MetatypeProviderTestServlet + test.metatype.provider.MetatypeProviderTestServlet + + + + + MetatypeProviderTestServlet + /providerTest + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/src/test/metatype/provider/MetatypeProviderTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/src/test/metatype/provider/MetatypeProviderTestServlet.java new file mode 100755 index 00000000000..7078d5c5ecf --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/metatypeprovider/src/test/metatype/provider/MetatypeProviderTestServlet.java @@ -0,0 +1,198 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.metatype.provider; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * + */ +public class MetatypeProviderTestServlet extends HttpServlet { + + /** */ + private static final String LIFESPAN_ATTRIBUTE = "lifespan"; + + /** */ + private static final String NAME_ATTRIBUTE = "name"; + + /** */ + private static final long serialVersionUID = -1977276153574893730L; + + private final ArrayList references = new ArrayList(); + private BundleContext bundleContext; + + public static final String PLANT_PID = "test.metatype.provider.plant"; + public static final String ANIMAL_PID = "test.metatype.provider.animal"; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + if (testName.equals("dump")) { + // Just for debugging + dump(writer); + } else { + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + } + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + /** + * Just for manual debugging + * + * @param writer + * @throws Exception + */ + private void dump(PrintWriter writer) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + Configuration[] configurations; + try { + configurations = ca.listConfigurations(null); + for (Configuration c : configurations) { + writer.print("

"); + String pid = c.getFactoryPid() == null ? c.getPid() : c.getFactoryPid(); + if (pid.startsWith("test")) { + writer.println(pid); + } + } + } catch (InvalidSyntaxException e1) { + throw new IOException(e1); + } + + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } + + public void testMetatypeProvider1() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(PLANT_PID, true); + Configuration[] children1 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + PLANT_PID + " should exist", children1); + assertEquals("There should only be one instance of PID " + PLANT_PID, 1, children1.length); + + } + + public void testMetatypeProvider2() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(ANIMAL_PID, true); + Configuration[] children1 = ca.listConfigurations(filter); + assertNotNull("The configuration for " + ANIMAL_PID + " should exist", children1); + assertEquals("There should only be one instance of PID " + ANIMAL_PID, 1, children1.length); + + Configuration child = children1[0]; + Dictionary dictionary = child.getProperties(); + assertNotNull("The dictionary should exist", dictionary); + + Object lifespan = dictionary.get(LIFESPAN_ATTRIBUTE); + assertNotNull("The lifespan attribute should exist", lifespan); + + assertEquals("The lifespan attribute should be 1000 days", 86400000000L, lifespan); + + Object name = dictionary.get(NAME_ATTRIBUTE); + assertNotNull("The name attribute should exist", name); + assertEquals("The name should be marmot", "marmot", name); + } + + /** + * Test that metatype converted config is removed when its corresponding metatype is removed + * + * PLANT_PID should not exist in config admin even though it was specified using the full pid. + * We don't recreate the pre-metatype config when the metatype is removed. + * + * ANIMAL_PID should not exist. + * + * @throws Exception + */ + public void testMetatypeProvider3() throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(PLANT_PID, true); + Configuration[] children1 = ca.listConfigurations(filter); + assertNull("The configuration for " + PLANT_PID + " should not exist", children1); + + filter = getFilter(ANIMAL_PID, true); + children1 = ca.listConfigurations(filter); + assertNull("The configuration for " + ANIMAL_PID + " should not exist", children1); + } +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..dac908a02fb --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm diff --git a/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..5888d2ec00d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/restart/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..d92e42649f3 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/restart/resources/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + + + ConfigRestartTestServlet + test.server.config.restart.ConfigRestartTestServlet + + + + + ConfigRestartTestServlet + /restart + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/restart/src/test/server/config/restart/ConfigRestartTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/restart/src/test/server/config/restart/ConfigRestartTestServlet.java new file mode 100755 index 00000000000..83c989c7e8f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/restart/src/test/server/config/restart/ConfigRestartTestServlet.java @@ -0,0 +1,250 @@ +package test.server.config.restart; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import javax.management.MBeanServer; +import javax.management.ObjectName; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.util.tracker.ServiceTracker; + +import com.ibm.ws.jmx.PlatformMBeanService; + +@SuppressWarnings("serial") +public class ConfigRestartTestServlet extends HttpServlet { + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + List references = new ArrayList(); + BundleContext bundleContext = bundle.getBundleContext(); + try { + if ("before".equals(testName)) { + testConfigurationBefore(bundleContext, references); + } else if ("after".equals(testName)) { + testConfigurationAfter(bundleContext, references); + } else if ("beforeVariable".equals(testName)) { + testBeforeVariable(bundleContext, references); + } else if ("afterVariable".equals(testName)) { + testAfterVariable(bundleContext, references); + } else if ("checkImport".equals(testName)) { + testCheckImport(bundleContext, references); + } else if ("refresh".equals(testName)) { + testRefresh(bundleContext, references); + } else { + fail("Invalid test name: " + testName); + } + writer.println("Test Passed"); + } catch (Throwable e) { + e.printStackTrace(writer); + } finally { + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + } + + writer.flush(); + writer.close(); + } + + private void testConfigurationBefore(BundleContext ctx, List references) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(ctx, references); + testSingletonBefore(ca); + testFactoryBefore(ca); + } + + private void testConfigurationAfter(BundleContext ctx, List references) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(ctx, references); + testSingletonAfter(ca); + testFactoryAfter(ca); + } + + private void testSingletonBefore(ConfigurationAdmin ca) { + Configuration[] configs = null; + String filter = null; + + filter = "(" + Constants.SERVICE_PID + "=" + "singleton-one" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration value property", "abc", configs[0].getProperties().get("value")); + + filter = "(" + Constants.SERVICE_PID + "=" + "singleton-two" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration value property", "def", configs[0].getProperties().get("value")); + } + + private void testSingletonAfter(ConfigurationAdmin ca) { + Configuration[] configs = null; + String filter = null; + + // deleted after restart + filter = "(" + Constants.SERVICE_PID + "=" + "singleton-one" + ")"; + configs = getConfiguration(ca, filter); + assertNull("There should not be a configuration found for filter " + filter, configs); + + // unchanged after restart + filter = "(" + Constants.SERVICE_PID + "=" + "singleton-two" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration value property", "def", configs[0].getProperties().get("value")); + } + + private void testFactoryBefore(ConfigurationAdmin ca) { + Configuration[] configs = null; + String filter = null; + + filter = "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 2 configurations for filter " + filter, 2, configs.length); + + filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")(id=1))"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration name property", "one", configs[0].getProperties().get("name")); + + filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")(id=2))"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration name property", "two", configs[0].getProperties().get("name")); + } + + private void testFactoryAfter(ConfigurationAdmin ca) { + Configuration[] configs = null; + String filter = null; + + filter = "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 2 configurations for filter " + filter, 2, configs.length); + + filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")(id=1))"; + configs = getConfiguration(ca, filter); + assertNull("There should not be a configuration found for filter " + filter, configs); + + filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")(id=2))"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration name property", "two", configs[0].getProperties().get("name")); + + filter = "(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + "factory" + ")(id=3))"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration name property", "three", configs[0].getProperties().get("name")); + + } + + private void testBeforeVariable(BundleContext ctx, List references) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(ctx, references); + + Configuration[] configs = null; + String filter = null; + + filter = "(" + Constants.SERVICE_PID + "=" + "myPort" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration type property", "http", configs[0].getProperties().get("type")); + assertEquals("Configuration value property", "1234", configs[0].getProperties().get("value")); + } + + private void testAfterVariable(BundleContext ctx, List references) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(ctx, references); + + Configuration[] configs = null; + String filter = null; + + filter = "(" + Constants.SERVICE_PID + "=" + "myPort" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration type property", "http", configs[0].getProperties().get("type")); + assertEquals("Configuration value property", "5678", configs[0].getProperties().get("value")); + } + + private void testCheckImport(BundleContext ctx, List references) throws Exception { + ConfigurationAdmin ca = getConfigurationAdmin(ctx, references); + + Configuration[] configs = null; + String filter = null; + + filter = "(" + Constants.SERVICE_PID + "=" + "person" + ")"; + configs = getConfiguration(ca, filter); + assertNotNull("There should be a configuration found for filter " + filter, configs); + assertEquals("There should be 1 configuration for filter " + filter, 1, configs.length); + assertEquals("Configuration firstName property", "Joe", configs[0].getProperties().get("firstName")); + assertEquals("Configuration lastName property", "Doe", configs[0].getProperties().get("lastName")); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private Configuration[] getConfiguration(ConfigurationAdmin ca, String filter) { + try { + return ca.listConfigurations(filter); + } catch (InvalidSyntaxException e) { + throw new RuntimeException("Invalid filter: " + filter, e); + } catch (IOException e) { + throw new RuntimeException("Error listing configurations", e); + } + } + + private void testRefresh(BundleContext ctx, List references) throws Exception { + ServiceTracker tracker = new ServiceTracker(ctx, PlatformMBeanService.class.getName(), null); + tracker.open(); + try { + PlatformMBeanService service = (PlatformMBeanService) tracker.waitForService(60 * 1000); + assertNotNull("No Platform MBean service", service); + + List serverXML = new ArrayList(); + serverXML.add(new File("server.xml").getAbsolutePath()); + + MBeanServer server = service.getMBeanServer(); + ObjectName configServices = new ObjectName("WebSphere", "service", "com.ibm.ws.kernel.filemonitor.FileNotificationMBean"); + server.invoke(configServices, "notifyFileChanges", new Object[] { Collections.emptyList(), serverXML, Collections.EMPTY_LIST }, + new String[] { Collection.class.getName(), Collection.class.getName(), Collection.class.getName() }); + } finally { + tracker.close(); + } + } +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..f49fb55181f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: test +Import-Packages: java.io, javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.cm, com.ibm.wsspi.kernel.service.location diff --git a/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/permissions.xml b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..5888d2ec00d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/META-INF/permissions.xml @@ -0,0 +1,69 @@ + + + + + + java.io.FilePermission + ALL FILES + read,write + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + java.net.SocketPermission + * + connect,resolve + + + + java.util.PropertyPermission + * + read,write + + + + java.lang.RuntimePermission + * + * + + + + org.osgi.service.cm.ConfigurationPermission + * + configure + + + + javax.security.auth.AuthPermission + * + + + + org.osgi.framework.ServicePermission + * + register,get + + + + + org.osgi.framework.AdminPermission + * + * + + + + org.osgi.framework.AdaptPermission + * + adapt + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/WEB-INF/web.xml b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..1b0ab41efc8 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/varmerge/resources/WEB-INF/web.xml @@ -0,0 +1,26 @@ + + + + + VarMergeTestServlet + test.config.merged.VarMergeTestServlet + + + + + VarMergeTestServlet + /varMergeTest + + + + DelayedVariableTestServlet + test.config.merged.DelayedVariableTestServlet + + + + + DelayedVariableTestServlet + /delayedVarTests + + + diff --git a/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/DelayedVariableTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/DelayedVariableTestServlet.java new file mode 100755 index 00000000000..0a714c2dd15 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/DelayedVariableTestServlet.java @@ -0,0 +1,138 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package test.config.merged; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +/** + * + */ +public class DelayedVariableTestServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = 6784264217930725272L; + private static final String DELAYED_VAR_PID = "com.ibm.ws.config.variable.delay"; + + private static final String DELAYED_VAR_ATTR = "delayedVariable"; + private static final String DELAYED_IBM_VAR_ATTR = "delayedIBMVar"; + private static final String IMMEDIATE_VAR_ATTR = "immediateVar"; + private static final String IMMEDIATE_VAR_TWO = "immediateVarTwo"; + + private static final String VARIABLE_STRING = "${variableDelayTest}"; + private static final String EVALUATED_VARIABLE = "evaluated"; + + private final ArrayList> references = new ArrayList>(); + private BundleContext bundleContext; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private ConfigurationAdmin getConfigurationAdmin(BundleContext ctx, List> references) throws Exception { + ServiceReference ref = ctx.getServiceReference(ConfigurationAdmin.class); + assertNotNull("No ConfigurationAdmin service", ref); + references.add(ref); + return ctx.getService(ref); + } + + private String getFilter(String pid, boolean isFactory) { + if (isFactory) { + return "(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + pid + ")"; + } else { + return "(" + Constants.SERVICE_PID + "=" + pid + ")"; + } + } + + public void testVariableDelay() throws Exception { + + ConfigurationAdmin ca = getConfigurationAdmin(bundleContext, references); + String filter = getFilter(DELAYED_VAR_PID, true); + Configuration[] varDelay = ca.listConfigurations(filter); + assertNotNull("The configuration for " + DELAYED_VAR_PID + " should exist", varDelay); + + assertEquals("There should be one instance of PID " + DELAYED_VAR_PID, 1, varDelay.length); + + Dictionary properties = varDelay[0].getProperties(); + + assertEquals(VARIABLE_STRING, properties.get(DELAYED_VAR_ATTR)); + assertEquals(VARIABLE_STRING, properties.get(DELAYED_IBM_VAR_ATTR)); + assertEquals(EVALUATED_VARIABLE, properties.get(IMMEDIATE_VAR_ATTR)); + assertEquals(EVALUATED_VARIABLE, properties.get(IMMEDIATE_VAR_TWO)); + + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/VarMergeTestServlet.java b/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/VarMergeTestServlet.java new file mode 100755 index 00000000000..3d3d0f0f964 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-applications/varmerge/src/test/config/merged/VarMergeTestServlet.java @@ -0,0 +1,137 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package test.config.merged; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; + +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; + +/** + * + */ +public class VarMergeTestServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = 6784264217930725272L; + private final ArrayList> references = new ArrayList>(); + private BundleContext bundleContext; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + + String testName = request.getParameter("testName"); + assertNotNull("No testName parameter specified", testName); + + Bundle bundle = FrameworkUtil.getBundle(HttpServlet.class); + + this.bundleContext = bundle.getBundleContext(); + try { + + log("Begin test: " + testName); + invokeTest(testName); + writer.println("OK"); + + } catch (NoSuchMethodException e) { + writer.println("FAILED - Invalid test name: " + testName); + } catch (InvocationTargetException e) { + writer.println("FAILED"); + e.getTargetException().printStackTrace(writer); + } catch (Throwable e) { + writer.println("FAILED"); + e.printStackTrace(writer); + } finally { + log("End test: " + testName); + for (ServiceReference ref : references) { + bundleContext.ungetService(ref); + } + references.clear(); + } + + writer.flush(); + writer.close(); + } + + private void invokeTest(String testName) throws Exception { + Method method = getClass().getDeclaredMethod(testName); + method.invoke(this); + } + + private enum Behavior { + MERGE, REPLACE, IGNORE + } + + private void verify(Behavior behavior) throws Exception { + + ServiceReference ref = bundleContext.getServiceReference(WsLocationAdmin.class); + assertNotNull("No location service", ref); + references.add(ref); + WsLocationAdmin locationAdmin = bundleContext.getService(ref); + + String value = locationAdmin.resolveString("${var1}"); + switch (behavior) { + case MERGE: + assertEquals("fromInclude", value); + break; + case REPLACE: + assertEquals("fromInclude", value); + break; + case IGNORE: + assertEquals("fromServerXml", value); + break; + + } + + } + + public void testMergedVariables() throws Exception { + verify(Behavior.MERGE); + } + + public void testMergedIncludesMerge() throws Exception { + verify(Behavior.MERGE); + } + + public void testMergedIncludesReplace() throws Exception { + verify(Behavior.REPLACE); + } + + public void testMergedIncludesIgnore() throws Exception { + // Verify that the attribute in the included file gets ignored + verify(Behavior.IGNORE); + + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/bnd.bnd new file mode 100755 index 00000000000..be640d8c4ed --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/bnd.bnd @@ -0,0 +1,11 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Child Alias B +Bundle-SymbolicName: test.config.childalias.b +Bundle-Description: Test bundle B for IBM childAlias extension, version=${bVersion} + +Include-Resource:\ + OSGI-INF/metatype/metatype-childalias-b.xml=resources/metatype-childalias-b.xml \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/resources/metatype-childalias-b.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/resources/metatype-childalias-b.xml new file mode 100755 index 00000000000..81687352d66 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.b/resources/metatype-childalias-b.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/bnd.bnd new file mode 100755 index 00000000000..96c93b1d8a1 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/bnd.bnd @@ -0,0 +1,11 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Child Alias C +Bundle-SymbolicName: test.config.childalias.c +Bundle-Description: Test bundle C for IBM childAlias extension, version=${bVersion} + +Include-Resource:\ + OSGI-INF/metatype/metatype-childalias-c.xml=resources/metatype-childalias-c.xml \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/resources/metatype-childalias-c.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/resources/metatype-childalias-c.xml new file mode 100755 index 00000000000..54d7abce803 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias.c/resources/metatype-childalias-c.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/bnd.bnd new file mode 100755 index 00000000000..b215a44ac08 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/bnd.bnd @@ -0,0 +1,11 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Child Alias +Bundle-SymbolicName: test.config.childalias +Bundle-Description: Test bundle for IBM childAlias extension, version=${bVersion} + +Include-Resource:\ + OSGI-INF/metatype/metatype-childalias.xml=resources/metatype-childalias.xml \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/resources/metatype-childalias.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/resources/metatype-childalias.xml new file mode 100755 index 00000000000..b1a27ca1227 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.childalias/resources/metatype-childalias.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/bnd.bnd new file mode 100755 index 00000000000..ee9601e5052 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/bnd.bnd @@ -0,0 +1,11 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Extensions B +Bundle-SymbolicName: test.config.extensions.b; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +Include-Resource:\ + OSGI-INF/metatype/metatype-extensions-two.xml=resources/metatype-extensions-two.xml \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/resources/metatype-extensions-two.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/resources/metatype-extensions-two.xml new file mode 100755 index 00000000000..fb6ec51a0f7 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.b/resources/metatype-extensions-two.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/bnd.bnd new file mode 100755 index 00000000000..a58b3b7b92d --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Schema Generator Config Extensions +Bundle-SymbolicName: test.config.extensions.schema.generator; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +Private-Package: test.config.extensions.schema.generator + +Service-Component:\ + test.config.extensions.schema.generator;\ + implementation:=test.config.extensions.schema.generator.GeneratorTest;\ + schemaGenerator="com.ibm.websphere.metatype.SchemaGenerator" diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/src/test/config/extensions/schema/generator/GeneratorTest.java b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/src/test/config/extensions/schema/generator/GeneratorTest.java new file mode 100755 index 00000000000..cf43d467b59 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions.schema.generator/src/test/config/extensions/schema/generator/GeneratorTest.java @@ -0,0 +1,59 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.config.extensions.schema.generator; + +import java.io.ByteArrayOutputStream; +import java.util.ArrayList; +import java.util.List; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import com.ibm.websphere.metatype.SchemaGenerator; +import com.ibm.websphere.metatype.SchemaGeneratorOptions; + +public class GeneratorTest { + + private SchemaGenerator schemaGenerator = null; + + public void activate(ComponentContext compContext) { + + BundleContext bundleContext = compContext.getBundleContext(); + List metatypeBundles = new ArrayList(); + for (Bundle bundle : bundleContext.getBundles()) { + if (bundle.getSymbolicName().startsWith("test.config.extensions")) + metatypeBundles.add(bundle); + } + + SchemaGeneratorOptions options = new SchemaGeneratorOptions(); + options.setEncoding("UTF-8"); + options.setBundles(metatypeBundles.toArray(new Bundle[] {})); + + // generate schema. We don't do anything with the generated schema, but use this to generate + // the error messages that + try { + if (schemaGenerator != null) + schemaGenerator.generate(new ByteArrayOutputStream(), options); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void deactivate(ComponentContext context) { + //NOP + } + + public void setSchemaGenerator(SchemaGenerator generator) { + this.schemaGenerator = generator; + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/bnd.bnd new file mode 100755 index 00000000000..4020ea77765 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/bnd.bnd @@ -0,0 +1,27 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Extensions +Bundle-SymbolicName: test.config.extensions; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +Web-ContextPath: config-extensions-test + +# export the interface packages +Export-Package: \ + test.config.extensions;provide:=true + +Service-Component:\ + test.config.extensions.super.component;\ + provide:='org.osgi.service.cm.ManagedServiceFactory,test.config.extensions.ConfigPropertiesProvider';\ + implementation:=test.config.extensions.ExtensionsTest;\ + properties:="service.pid=test.config.extensions.super,service.vendor=IBM",\ + test.config.extensions.internal.super.component;\ + provide:='org.osgi.service.cm.ManagedServiceFactory,test.config.extensions.ConfigPropertiesProvider';\ + implementation:=test.config.extensions.ExtensionsTest;\ + properties:="service.pid=test.config.extensions.internal.super,service.vendor=IBM" + +Include-Resource:\ + OSGI-INF/metatype/metatype-extensions.xml=resources/metatype-extensions.xml \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/resources/metatype-extensions.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/resources/metatype-extensions.xml new file mode 100755 index 00000000000..54eb6ed20ff --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/resources/metatype-extensions.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ConfigPropertiesProvider.java b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ConfigPropertiesProvider.java new file mode 100755 index 00000000000..efd177e7b7f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ConfigPropertiesProvider.java @@ -0,0 +1,26 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2013 + * + * The source code for this program is not published or otherwise divested of + * its trade secrets, irrespective of what has been deposited with the U.S. + * Copyright Office. + */ +package test.config.extensions; + +import java.util.Dictionary; + +interface ConfigPropertiesProvider { + /** + * Waits for a call to the ManagedServiceFactory with + * the specified config id + * + * + * @param pidStartsWith + * @return the properties that the ManagedServiceFactory was called with + */ + Dictionary getPropertiesForId(String id); +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ExtensionsTest.java b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ExtensionsTest.java new file mode 100755 index 00000000000..b0aa1952b16 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/ExtensionsTest.java @@ -0,0 +1,90 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.config.extensions; + +import java.util.Dictionary; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; + +/** + * + */ +public class ExtensionsTest implements ManagedServiceFactory, ConfigPropertiesProvider { + + //timeout if the service hasn't been called in 15 seconds + private final long TIMEOUT = 15000; + + Map> propSets = new ConcurrentHashMap>(); + + public Dictionary getPropertiesForId(String id) { + Dictionary props = getPropsForId(id); + synchronized (propSets) { + while (props == null) { + try { + propSets.wait(TIMEOUT); + props = getPropsForId(id); + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted"); + } + if (props == null) + throw new RuntimeException("Extensions test timed out waiting for ManagedServiceFactory updated call starting with config id " + id); + } + } + return props; + } + + Dictionary getPropsForId(String id) { + return propSets.get(id); + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#deleted(java.lang.String) + */ + @Override + public void deleted(String pid) { + // TODO Auto-generated method stub + + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#updated(java.lang.String, java.util.Dictionary) + */ + @Override + public void updated(String pid, Dictionary properties) throws ConfigurationException { + System.out.println("ExtensionsTest (mock ManagedServiceFactory) updated called with pid: " + pid + " and properties: " + properties); + if (pid != null && properties != null) { + synchronized (propSets) { + String id; + propSets.put(((id = (String) properties.get("id")) == null) ? pid : id, properties); + propSets.notifyAll(); + } + } + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#getName() + */ + @Override + public String getName() { + // TODO Auto-generated method stub + return null; + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/TestResultsServlet.java b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/TestResultsServlet.java new file mode 100755 index 00000000000..0d87e0a34ef --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.extensions/src/test/config/extensions/TestResultsServlet.java @@ -0,0 +1,102 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.config.extensions; + +import java.io.IOException; +import java.util.Collection; +import java.util.Dictionary; +import java.util.HashSet; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; + +import com.ibm.ws.config.xml.internal.XMLConfigConstants; + +/** + * + */ +@WebServlet(urlPatterns = { "test" }) +public class TestResultsServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = -4913608474531994493L; + private static final String servicePIDName = "service.pid"; + + /* + * (non-Javadoc) + * + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + BundleContext ctxt = (BundleContext) req.getServletContext().getAttribute("osgi-bundlecontext"); + // Get the ManagedServiceFactory identifier so we can look up the correct service. + String servicePid = req.getParameter(servicePIDName); + Collection> refs = new HashSet>(); + ServiceReference ref = null; + + try { + + System.out.println("Looking up services with filter of (" + servicePIDName + "=" + servicePid + ")"); + // Find all services that match the relevant service.pid attr. There should only be one of these. + refs = ctxt.getServiceReferences(ConfigPropertiesProvider.class, "(" + servicePIDName + "=" + servicePid + ")"); + // If we don't find any then issue warning in the response. + if (!refs.isEmpty()) { + // There should only be one service, so pick the 1st one. + ref = refs.iterator().next(); + ConfigPropertiesProvider propsProvider = ctxt.getService(ref); + if (propsProvider != null) { + String id = req.getParameter("id"); + Dictionary props = propsProvider.getPropertiesForId(id); + if (props != null) { + String configId = (String) props.get(XMLConfigConstants.CFG_CONFIG_INSTANCE_ID); + if (configId != null && configId.startsWith(servicePid)) { + resp.getWriter().print("PASSED: test bundle was called with properties for ID " + id); + String propName; + if ((propName = req.getParameter("prop")) != null) { + resp.getWriter().print("Prop value: " + props.get(propName)); + } + resp.setStatus(HttpServletResponse.SC_OK); + return; + + } else { + resp.getWriter().print("FAILED: incorrect config.id in properties for ID " + id + ". Value: " + configId); + resp.setStatus(HttpServletResponse.SC_OK); + return; + } + } else { + resp.getWriter().print("FAILED: test bundle was not called with properties for PID starting with " + id); + resp.setStatus(HttpServletResponse.SC_OK); + return; + } + } + } else { + System.out.println("No service"); + resp.getWriter().print("FAILED: unable to find ConfigPropertiesProvider service"); + resp.setStatus(HttpServletResponse.SC_OK); + } + } catch (InvalidSyntaxException ise) { + resp.getWriter().print("Exception thrown whilst getting Config Property Provider service references: " + ise); + } finally { + // If the reference isn't null, release the service. + if (ref != null) + ctxt.ungetService(ref); + } + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/bnd.bnd new file mode 100755 index 00000000000..50b1b97f6ec --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/bnd.bnd @@ -0,0 +1,12 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Tests for variable behavior +Bundle-SymbolicName: test.config.variables +Bundle-Description: Test bundle for variable behavior, version=${bVersion} + + +Include-Resource: \ + OSGI-INF=resources/OSGI-INF diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/resources/OSGI-INF/metatype/metatype-variables.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/resources/OSGI-INF/metatype/metatype-variables.xml new file mode 100755 index 00000000000..4343011b3f0 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.config.variables/resources/OSGI-INF/metatype/metatype-variables.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/bnd.bnd new file mode 100755 index 00000000000..e4a5a3e06a6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config Merging +Bundle-SymbolicName: test.merged.config +Bundle-Description: Test bundle for config merging, version=${bVersion} + +IBM-Default-Config: OSGI-INF/wlp/defaultInstances.xml, \ + OSGI-INF/wlp/defaultInstances2.xml; requireExisting=true, \ + OSGI-INF/wlp/defaultInstances3.xml; addIfMissing=true + +Include-Resource: \ + OSGI-INF=resources/OSGI-INF diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/metatype/metatype-mergedconfig.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/metatype/metatype-mergedconfig.xml new file mode 100755 index 00000000000..7fd7305b577 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/metatype/metatype-mergedconfig.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances.xml new file mode 100755 index 00000000000..e0a77cf718c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances2.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances2.xml new file mode 100755 index 00000000000..f9ad45d4272 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances2.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances3.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances3.xml new file mode 100755 index 00000000000..647420217a8 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.merged.config/resources/OSGI-INF/wlp/defaultInstances3.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/bnd.bnd new file mode 100755 index 00000000000..f448e82fefe --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test MetatypeProvider +Bundle-SymbolicName: test.metatype.provider +Bundle-Description: Test bundle for MetatypeProvider, version=${bVersion} + +-dsannotations: com.ibm.ws.config.metatype.provider.Plant,\ + com.ibm.ws.config.metatype.provider.Animal,\ + com.ibm.ws.config.metatype.provider.AnimalToo + +Private-Package: com.ibm.ws.config.metatype.provider.* + +Import-Package: * diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Animal.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Animal.java new file mode 100755 index 00000000000..33139f3efbc --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Animal.java @@ -0,0 +1,157 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Dictionary; +import java.util.List; + +import org.osgi.framework.Constants; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ConfigurationPolicy; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.metatype.AttributeDefinition; +import org.osgi.service.metatype.MetaTypeProvider; +import org.osgi.service.metatype.ObjectClassDefinition; + +import com.ibm.websphere.metatype.AttributeDefinitionProperties; +import com.ibm.websphere.metatype.MetaTypeFactory; +import com.ibm.websphere.metatype.ObjectClassDefinitionProperties; + +/** + * + */ +@Component(service = { Animal.class, ManagedServiceFactory.class, MetaTypeProvider.class }, immediate = true, + configurationPolicy = ConfigurationPolicy.IGNORE, + property = { Constants.SERVICE_VENDOR + "=" + "IBM", + Constants.SERVICE_PID + "=" + Animal.ANIMAL_PID }) +public class Animal implements ManagedServiceFactory, MetaTypeProvider { + + public static final String ANIMAL_PID = "test.metatype.provider.animal"; + private ObjectClassDefinition ocd; + private MetaTypeFactory metaTypeFactoryService; + + @Reference(service = MetaTypeFactory.class, + cardinality = ReferenceCardinality.MANDATORY) + protected void setMetaTypeFactoryService(MetaTypeFactory mtpService) { + this.metaTypeFactoryService = mtpService; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.MetaTypeProvider#getLocales() + */ + @Override + public String[] getLocales() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.MetaTypeProvider#getObjectClassDefinition(java.lang.String, java.lang.String) + */ + @Override + public ObjectClassDefinition getObjectClassDefinition(String arg0, String arg1) { + if (this.ocd == null) { + AttributeDefinition nameAttr = new AnimalNameAttr(); + AttributeDefinition lifespanAttr = metaTypeFactoryService.createAttributeDefinition(getLifespanProps()); + AttributeDefinition eatsAttr = metaTypeFactoryService.createAttributeDefinition(getEatsProperties()); + List attributeList = new ArrayList(); + attributeList.add(lifespanAttr); + attributeList.add(nameAttr); + attributeList.add(eatsAttr); + this.ocd = metaTypeFactoryService.createObjectClassDefinition(getOCDProperties(), attributeList, Collections. emptyList()); + + } + + return this.ocd; + + } + + /** + * @return + */ + private AttributeDefinitionProperties getEatsProperties() { + AttributeDefinitionProperties props = new AttributeDefinitionProperties("eats"); + props.setName("eats"); + props.setDescription("What an animal eats"); + props.setType(MetaTypeFactory.PID_TYPE); + props.setReferencePid(Plant.PLANT_PID); + props.setCardinality(10); + return props; + } + + /** + * @return + */ + private AttributeDefinitionProperties getLifespanProps() { + AttributeDefinitionProperties props = new AttributeDefinitionProperties("lifespan"); + props.setName("Lifespan"); + props.setDescription("The animal's lifespan"); + props.setType(MetaTypeFactory.DURATION_TYPE); + props.setCardinality(0); + + return props; + } + + /** + * @param ocd2 + */ + private ObjectClassDefinitionProperties getOCDProperties() { + ObjectClassDefinitionProperties properties = new ObjectClassDefinitionProperties("test.metatype.provider.animal"); + properties.setDescription("An animal"); + properties.setName("test.metatype.provider.animal"); + properties.setAlias("animal"); + + return properties; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#deleted(java.lang.String) + */ + @Override + public void deleted(String arg0) { + System.out.println("Deleted"); + + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#getName() + */ + @Override + public String getName() { + return "Animal MetatypeProvider"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#updated(java.lang.String, java.util.Dictionary) + */ + @Override + public void updated(String arg0, Dictionary arg1) throws ConfigurationException { + System.out.println("Updated"); + + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalNameAttr.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalNameAttr.java new file mode 100755 index 00000000000..6612a203eef --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalNameAttr.java @@ -0,0 +1,116 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import org.osgi.service.metatype.AttributeDefinition; + +import com.ibm.websphere.metatype.MetaTypeFactory; + +/** + * + */ +public class AnimalNameAttr implements AttributeDefinition { + + /** */ + public static final String ID_ATTRIBUTE = "name"; + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getCardinality() + */ + @Override + public int getCardinality() { + return 0; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getDefaultValue() + */ + @Override + public String[] getDefaultValue() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getDescription() + */ + @Override + public String getDescription() { + return "The animal name"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getID() + */ + @Override + public String getID() { + return ID_ATTRIBUTE; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getName() + */ + @Override + public String getName() { + return "Name"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getOptionLabels() + */ + @Override + public String[] getOptionLabels() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getOptionValues() + */ + @Override + public String[] getOptionValues() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getType() + */ + @Override + public int getType() { + return MetaTypeFactory.TOKEN_TYPE; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#validate(java.lang.String) + */ + @Override + public String validate(String arg0) { + return ""; + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalToo.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalToo.java new file mode 100755 index 00000000000..287758ec60b --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/AnimalToo.java @@ -0,0 +1,57 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import java.util.Map; + +import org.osgi.framework.Constants; +import org.osgi.service.cm.ConfigurationEvent; +import org.osgi.service.cm.ConfigurationListener; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; + +/** + * + */ +@Component(service = { AnimalToo.class, ConfigurationListener.class }, immediate = true, + property = { Constants.SERVICE_VENDOR + "=" + "IBM" }) +public class AnimalToo implements ConfigurationListener { + + @Activate + protected void activate(ComponentContext ctx, Map config) { + System.out.println("Activate"); + } + + @Deactivate + protected void deactivate(ComponentContext ctx) { + System.out.println("Deactivate"); + } + + @Modified + protected void modified(Map config) { + System.out.println("MOdified"); + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ConfigurationListener#configurationEvent(org.osgi.service.cm.ConfigurationEvent) + */ + @Override + public void configurationEvent(ConfigurationEvent arg0) { + System.out.println("config event"); + + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Plant.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Plant.java new file mode 100755 index 00000000000..18868a4013c --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/Plant.java @@ -0,0 +1,89 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import java.util.Dictionary; + +import org.osgi.framework.Constants; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ConfigurationPolicy; +import org.osgi.service.metatype.MetaTypeProvider; +import org.osgi.service.metatype.ObjectClassDefinition; + +/** + * + */ +@Component(service = { Plant.class, ManagedServiceFactory.class, MetaTypeProvider.class }, immediate = true, + configurationPolicy = ConfigurationPolicy.IGNORE, + property = { Constants.SERVICE_VENDOR + "=" + "IBM", + Constants.SERVICE_PID + "=" + Plant.PLANT_PID }) +public class Plant implements ManagedServiceFactory, MetaTypeProvider { + + public static final String PLANT_PID = "test.metatype.provider.plant"; + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.MetaTypeProvider#getLocales() + */ + @Override + public String[] getLocales() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.MetaTypeProvider#getObjectClassDefinition(java.lang.String, java.lang.String) + */ + @Override + public ObjectClassDefinition getObjectClassDefinition(String arg0, String arg1) { + return new PlantObjectClassDefinition(); + + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#deleted(java.lang.String) + */ + @Override + public void deleted(String arg0) { + System.out.println("Deleted"); + + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#getName() + */ + @Override + public String getName() { + return "Plant MetatypeProvider"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.cm.ManagedServiceFactory#updated(java.lang.String, java.util.Dictionary) + */ + @Override + public void updated(String arg0, Dictionary arg1) throws ConfigurationException { + System.out.println("Updated"); + + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantNameAttr.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantNameAttr.java new file mode 100755 index 00000000000..5a699f6b277 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantNameAttr.java @@ -0,0 +1,111 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import org.osgi.service.metatype.AttributeDefinition; + +/** + * + */ +public class PlantNameAttr implements AttributeDefinition { + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getCardinality() + */ + @Override + public int getCardinality() { + return 0; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getDefaultValue() + */ + @Override + public String[] getDefaultValue() { + return new String[] { "orchid" }; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getDescription() + */ + @Override + public String getDescription() { + return "The plant name"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getID() + */ + @Override + public String getID() { + return "name"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getName() + */ + @Override + public String getName() { + return "Name"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getOptionLabels() + */ + @Override + public String[] getOptionLabels() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getOptionValues() + */ + @Override + public String[] getOptionValues() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#getType() + */ + @Override + public int getType() { + return AttributeDefinition.STRING; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.AttributeDefinition#validate(java.lang.String) + */ + @Override + public String validate(String arg0) { + return ""; + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantObjectClassDefinition.java b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantObjectClassDefinition.java new file mode 100755 index 00000000000..fe9eb611913 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.metatype.provider/src/com/ibm/ws/config/metatype/provider/PlantObjectClassDefinition.java @@ -0,0 +1,77 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.config.metatype.provider; + +import java.io.IOException; +import java.io.InputStream; + +import org.osgi.service.metatype.AttributeDefinition; +import org.osgi.service.metatype.ObjectClassDefinition; + +/** + * + */ +public class PlantObjectClassDefinition implements ObjectClassDefinition { + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.ObjectClassDefinition#getAttributeDefinitions(int) + */ + @Override + public AttributeDefinition[] getAttributeDefinitions(int arg0) { + AttributeDefinition nameAttr = new PlantNameAttr(); + return new AttributeDefinition[] { nameAttr }; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.ObjectClassDefinition#getDescription() + */ + @Override + public String getDescription() { + return "A Plant."; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.ObjectClassDefinition#getID() + */ + @Override + public String getID() { + return "test.metatype.provider.plant"; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.ObjectClassDefinition#getIcon(int) + */ + @Override + public InputStream getIcon(int arg0) throws IOException { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.service.metatype.ObjectClassDefinition#getName() + */ + @Override + public String getName() { + return "test.metatype.provider.plant"; + } + +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/bnd.bnd new file mode 100755 index 00000000000..3819e8dc20f --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/bnd.bnd @@ -0,0 +1,24 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config For Product Extensions +Bundle-SymbolicName: test.prod.extensions; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +# export the interface packages +Export-Package: \ + test.prod.extensions;provide:=true + +Private-Package: test.prod.extensions.internal.* + +Web-ContextPath: product1-extensions-test + +Include-Resource:\ + OSGI-INF/metatype/metatype.xml=resources/metatype.xml + +Service-Component:\ + test.prod.extensions;\ + provide:='test.prod.extensions.ProductExtension1';\ + implementation:=test.prod.extensions.internal.ProductExtension1ServiceImpl \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/resources/metatype.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/resources/metatype.xml new file mode 100755 index 00000000000..5ba90d49327 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/resources/metatype.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1.java b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1.java new file mode 100755 index 00000000000..822dc1084d9 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1.java @@ -0,0 +1,40 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.prod.extensions; + +/** + * Product extension service interface. + */ +public interface ProductExtension1 { + + /** + * Say Hello. + * + * @param input + * @return + */ + public String sayHello(String input); + + /** + * Retrieves configured attribute 1. + * + * @return A Long value. + */ + public Long getAttribute1(); + + /** + * Retrieves configured attribute 1. + * + * @return A String value. + */ + public String getAttribute2(); +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1TestServlet.java b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1TestServlet.java new file mode 100755 index 00000000000..7060f9df518 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/ProductExtension1TestServlet.java @@ -0,0 +1,124 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.prod.extensions; + +import java.io.IOException; +import java.lang.reflect.Method; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +/** + * ProductExtension1TestServlet. + */ +@WebServlet(urlPatterns = { "test" }) +public class ProductExtension1TestServlet extends HttpServlet { + + private static final long serialVersionUID = -4913608474531994493L; + public static final String SAY_HELLO_INPUT = "HelloYou"; + public static final String EXPECTED_SAY_HELLO = "you.said." + SAY_HELLO_INPUT + ".i.say." + SAY_HELLO_INPUT + ".back"; + public static final Long EXPECTED_ATTRB1 = 999999L; + public static final String EXPECTED_ATTRB2 = "HELLOWORLD"; + + /** + * doGet. + */ + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + ServiceReference prod1SvcRef = null; + BundleContext bundleContext = (BundleContext) req.getServletContext().getAttribute("osgi-bundlecontext"); + + // Unable to get bundle context. + if (bundleContext == null) { + String reply = "TEST_FAILED: Unable to obtain a bundle context reference."; + System.out.println(reply); + resp.getWriter().print(reply); + resp.setStatus(HttpServletResponse.SC_OK); + return; + } + + try { + prod1SvcRef = bundleContext.getServiceReference("test.prod.extensions.ProductExtension1"); + if (prod1SvcRef == null) { + printOutput(resp, "TEST_FAILED: Unable to get a UserProductExtension1 service reference."); + return; + } + + final Object prod1Svc = bundleContext.getService(prod1SvcRef); + if (prod1Svc != null) { + final Method sayHello_method = prod1Svc.getClass().getMethod("sayHello", String.class); + final Method getAtrib1Method = prod1Svc.getClass().getMethod("getAttribute1"); + final Method getAtrib2Method = prod1Svc.getClass().getMethod("getAttribute2"); + + if (sayHello_method == null || getAtrib1Method == null || getAtrib2Method == null) { + printOutput(resp, "TEST_FAILED: Unable get a method reference from the UserProductExtension1 service."); + return; + } + + // Call sayHello on the service. + String sayHelloOut = (String) sayHello_method.invoke(prod1Svc, SAY_HELLO_INPUT); + if (!sayHelloOut.equals(EXPECTED_SAY_HELLO)) { + printOutput(resp, "TEST_FAILED: sayHello returned: " + sayHelloOut + ". Expected: " + EXPECTED_SAY_HELLO); + return; + } + + // Call getAttribute1 on the service. + Long attrib1Out = (Long) getAtrib1Method.invoke(prod1Svc); + if (attrib1Out == null || attrib1Out.longValue() != EXPECTED_ATTRB1.longValue()) { + printOutput(resp, "TEST_FAILED: getAttribute1 returned: " + attrib1Out + ". Expected: " + EXPECTED_ATTRB1 + + ". Possible configuration error. The OCD alias under which attribute1 is defined must be prefixed by: \"productName_\"."); + return; + } + + // Call getAttribute2 on the service. + String attrib2Out = (String) getAtrib2Method.invoke(prod1Svc); + if (attrib2Out == null || !attrib2Out.equals(EXPECTED_ATTRB2)) { + printOutput(resp, "TEST_FAILED: getAttribute2 returned: " + attrib2Out + ". Expected: " + EXPECTED_ATTRB2 + + ". Possible configuration error. The OCD alias under which attribute2 is defined must be prefixed by: \"productName_\"."); + return; + } + + printOutput(resp, "TEST_PASSED: sayHello returned: " + sayHelloOut + ". getAttribute2 returned: " + attrib2Out); + } else { + printOutput(resp, "TEST_FAILED:Product1 service not found."); + } + } catch (Throwable t) { + printOutput(resp, "TEST_FAILED: Exception while processing test: " + t); + } finally { + if (prod1SvcRef != null) + bundleContext.ungetService(prod1SvcRef); + } + } + + /** + * Prints the output to the HTTP call. + * + * @param resp HttpServletResponse + * @param reply The repply. + */ + private void printOutput(HttpServletResponse resp, String reply) { + System.out.println(reply); + + try { + resp.getWriter().print(reply); + } catch (IOException ioe) { + System.out.println("Failed setting the reply in the HttpServletResponse" + ioe); + } + resp.setStatus(HttpServletResponse.SC_OK); + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/internal/ProductExtension1ServiceImpl.java b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/internal/ProductExtension1ServiceImpl.java new file mode 100755 index 00000000000..cf1e1182310 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.prod.extensions/src/test/prod/extensions/internal/ProductExtension1ServiceImpl.java @@ -0,0 +1,85 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.prod.extensions.internal; + +import java.util.Map; + +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import test.prod.extensions.ProductExtension1; + +/** + * Product Extension Service. + */ +public class ProductExtension1ServiceImpl implements ProductExtension1 { + + Long attribute1; + String attribute2; + + /** + * Declarative Services method to deactivate this component. + * Best practice: this should be a protected method, not public or private + * + * @param context context for this component + */ + protected void activate(BundleContext bundleContext, Map properties) { + System.out.println("@ed: attributeMap: " + properties.size()); + + for (Map.Entry entry : properties.entrySet()) { + System.out.println("key: " + entry.getKey() + ", value: " + entry.getValue()); + } + + attribute1 = (Long) properties.get("attribute1"); + System.out.println("@ed: attribute1: " + attribute1); + attribute2 = (String) properties.get("attribute2"); + System.out.println("@ed: attribute2: " + attribute2); + } + + /** + * Declarative Services method to deactivate this component. + * Best practice: this should be a protected method, not public or private + * + * @param context context for this component + */ + protected void deactivate(ComponentContext context) {} + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#sayHello(java.lang.String) + */ + @Override + public String sayHello(String input) { + return "you.said." + input + ".i.say." + input + ".back"; + } + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#getAttribute1() + */ + @Override + public Long getAttribute1() { + return attribute1; + } + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#getAttribute1() + */ + @Override + public String getAttribute2() { + return attribute2; + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/bnd.bnd b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/bnd.bnd new file mode 100755 index 00000000000..695ffef979e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/bnd.bnd @@ -0,0 +1,24 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test Config For User Product Extensions +Bundle-SymbolicName: test.user.prod.extensions; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +# export the interface packages +Export-Package: \ + test.user.prod.extensions;provide:=true + +Private-Package: test.user.prod.extensions.internal.* + +Web-ContextPath: user.product1-extensions-test + +Include-Resource:\ + OSGI-INF/metatype/metatype.xml=resources/metatype.xml + +Service-Component:\ + test.user.prod.extensions;\ + provide:='test.user.prod.extensions.UserProductExtension1';\ + implementation:=test.user.prod.extensions.internal.UserProductExtension1ServiceImpl \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/resources/metatype.xml b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/resources/metatype.xml new file mode 100755 index 00000000000..6e73ff6287e --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/resources/metatype.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1.java b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1.java new file mode 100755 index 00000000000..8e9410b57b0 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1.java @@ -0,0 +1,40 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.user.prod.extensions; + +/** + * User product extension service interface. + */ +public interface UserProductExtension1 { + + /** + * Say Hello. + * + * @param input + * @return + */ + public String sayHello(String input); + + /** + * Retrieves configured attribute 1. + * + * @return A Long value. + */ + public Long getAttribute1(); + + /** + * Retrieves configured attribute 1. + * + * @return A String value. + */ + public String getAttribute2(); +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1TestServlet.java b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1TestServlet.java new file mode 100755 index 00000000000..33cc2c7c312 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/UserProductExtension1TestServlet.java @@ -0,0 +1,123 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.user.prod.extensions; + +import java.io.IOException; +import java.lang.reflect.Method; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +/** + * UserProductExtension1TestServlet. + */ +@WebServlet(urlPatterns = { "test" }) +public class UserProductExtension1TestServlet extends HttpServlet { + private static final long serialVersionUID = -4913608474531994493L; + public static final String SAY_HELLO_INPUT = "HelloYou"; + public static final String EXPECTED_SAY_HELLO = "you.said." + SAY_HELLO_INPUT + ".i.say." + SAY_HELLO_INPUT + ".back"; + public static final Long EXPECTED_ATTRB1 = 999999L; + public static final String EXPECTED_ATTRB2 = "HELLOWORLD"; + + /** + * doGet. + */ + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + ServiceReference prod1SvcRef = null; + BundleContext bundleContext = (BundleContext) req.getServletContext().getAttribute("osgi-bundlecontext"); + + // Unable to get bundle context. + if (bundleContext == null) { + String reply = "TEST_FAILED: Unable to obtain a bundle context reference."; + System.out.println(reply); + resp.getWriter().print(reply); + resp.setStatus(HttpServletResponse.SC_OK); + return; + } + + try { + prod1SvcRef = bundleContext.getServiceReference("test.user.prod.extensions.UserProductExtension1"); + if (prod1SvcRef == null) { + printOutput(resp, "TEST_FAILED: Unable to get a UserProductExtension1 service reference."); + return; + } + + final Object prod1Svc = bundleContext.getService(prod1SvcRef); + if (prod1Svc != null) { + final Method sayHello_method = prod1Svc.getClass().getMethod("sayHello", String.class); + final Method getAtrib1Method = prod1Svc.getClass().getMethod("getAttribute1"); + final Method getAtrib2Method = prod1Svc.getClass().getMethod("getAttribute2"); + + if (sayHello_method == null || getAtrib1Method == null || getAtrib2Method == null) { + printOutput(resp, "TEST_FAILED: Unable get a method reference from the UserProductExtension1 service."); + return; + } + + // Call sayHello on the service. + String sayHelloOut = (String) sayHello_method.invoke(prod1Svc, SAY_HELLO_INPUT); + if (!sayHelloOut.equals(EXPECTED_SAY_HELLO)) { + printOutput(resp, "TEST_FAILED: sayHello returned: " + sayHelloOut + ". Expected: " + EXPECTED_SAY_HELLO); + return; + } + + // Call getAttribute1 on the service. + Long attrib1Out = (Long) getAtrib1Method.invoke(prod1Svc); + if (attrib1Out == null || attrib1Out.longValue() != EXPECTED_ATTRB1.longValue()) { + printOutput(resp, "TEST_FAILED: getAttribute1 returned: " + attrib1Out + ". Expected: " + EXPECTED_ATTRB1 + + ". Possible configuration error. The OCD alias under which attribute1 is defined must be prefixed by: \"productName_\"."); + return; + } + + // Call getAttribute2 on the service. + String attrib2Out = (String) getAtrib2Method.invoke(prod1Svc); + if (attrib2Out == null || !attrib2Out.equals(EXPECTED_ATTRB2)) { + printOutput(resp, "TEST_FAILED: getAttribute2 returned: " + attrib2Out + ". Expected: " + EXPECTED_ATTRB2 + + ". Possible configuration error. The OCD alias under which attribute2 is defined must be prefixed by: \"productName_\"."); + return; + } + + printOutput(resp, "TEST_PASSED: sayHello returned: " + sayHelloOut + ". getAttribute2 returned: " + attrib2Out); + } else { + printOutput(resp, "TEST_FAILED:Product1 service not found."); + } + } catch (Throwable t) { + printOutput(resp, "TEST_FAILED: Exception while processing test: " + t); + } finally { + if (prod1SvcRef != null) + bundleContext.ungetService(prod1SvcRef); + } + } + + /** + * Prints the output to the HTTP call. + * + * @param resp HttpServletResponse + * @param reply The repply. + */ + private void printOutput(HttpServletResponse resp, String reply) { + System.out.println(reply); + + try { + resp.getWriter().print(reply); + } catch (IOException ioe) { + System.out.println("Failed setting the reply in the HttpServletResponse" + ioe); + } + resp.setStatus(HttpServletResponse.SC_OK); + } +} diff --git a/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/internal/UserProductExtension1ServiceImpl.java b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/internal/UserProductExtension1ServiceImpl.java new file mode 100755 index 00000000000..bebb0d80f22 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test-bundles/test.user.prod.extensions/src/test/user/prod/extensions/internal/UserProductExtension1ServiceImpl.java @@ -0,0 +1,77 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.user.prod.extensions.internal; + +import java.util.Map; + +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import test.user.prod.extensions.UserProductExtension1; + +/** + * User Product Extension Service. + */ +public class UserProductExtension1ServiceImpl implements UserProductExtension1 { + + Long attribute1; + String attribute2; + + /** + * Declarative Services method to deactivate this component. + * Best practice: this should be a protected method, not public or private + * + * @param context context for this component + */ + protected void activate(BundleContext bundleContext, Map properties) { + attribute1 = (Long) properties.get("attribute1"); + attribute2 = (String) properties.get("attribute2"); + } + + /** + * Declarative Services method to deactivate this component. + * Best practice: this should be a protected method, not public or private + * + * @param context context for this component + */ + protected void deactivate(ComponentContext context) {} + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#sayHello(java.lang.String) + */ + @Override + public String sayHello(String input) { + return "you.said." + input + ".i.say." + input + ".back"; + } + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#getAttribute1() + */ + @Override + public Long getAttribute1() { + return attribute1; + } + + /* + * (non-Javadoc) + * + * @see test.prod.extensions.Product1#getAttribute1() + */ + @Override + public String getAttribute2() { + return attribute2; + } +} diff --git a/dev/com.ibm.ws.config_fat/test/logging.properties b/dev/com.ibm.ws.config_fat/test/logging.properties new file mode 100755 index 00000000000..0b4c1bbfca6 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/test/logging.properties @@ -0,0 +1,76 @@ +############################################################ +# Logging Configuration File +# +# You can use a different file by specifying a filename +# with the java.util.logging.config.file system property. +# For example java -Djava.util.logging.config.file=myfile +############################################################ + +############################################################ +# Global properties +############################################################ + +# "handlers" specifies a comma separated list of log Handler +# classes. These handlers will be installed during VM startup. +# Note that these classes must be on the system classpath. +# By default we only configure a ConsoleHandler, which will only +# show messages at the INFO and above levels. +handlers=com.ibm.ws.fat.util.GenericHandler, java.util.logging.FileHandler + +# Default global logging level. +# This specifies which kinds of events are logged across +# all loggers. For any given facility this global level +# can be overriden by a facility specific level +# Note that the GenericHandler also has a separate level +# setting to limit messages printed to the underlying stream. +.level=INFO + +############################################################ +# Handler specific properties. +# Describes specific configuration info for Handlers. +############################################################ + +# The GenericHandler will log all messages printed at any logging level +com.ibm.ws.fat.util.GenericHandler.level=ALL +com.ibm.ws.fat.util.GenericHandler.formatter=com.ibm.ws.fat.util.GenericFormatter +com.ibm.ws.fat.util.GenericHandler.stream=system.out +com.ibm.ws.fat.util.GenericHandler.flush=true + +# The FileHandler will log all messages printed at any logging level to exactly one file located in results/output.txt +java.util.logging.FileHandler.level=ALL +java.util.logging.FileHandler.formatter=com.ibm.ws.fat.util.GenericFormatter +java.util.logging.FileHandler.limit=0 +java.util.logging.FileHandler.count=1 +java.util.logging.FileHandler.pattern=results/output.txt +java.util.logging.FileHandler.append=true + +############################################################ +# Formatter specific properties. +# Describes specific configuration info for Formatters. +############################################################ + +com.ibm.ws.fat.util.GenericFormatter.class.full=false +com.ibm.ws.fat.util.GenericFormatter.class.length=30 +com.ibm.ws.fat.util.GenericFormatter.class.log=true +com.ibm.ws.fat.util.GenericFormatter.level.log=true +com.ibm.ws.fat.util.GenericFormatter.method.length=30 +com.ibm.ws.fat.util.GenericFormatter.method.log=true +com.ibm.ws.fat.util.GenericFormatter.thread.length=3 +com.ibm.ws.fat.util.GenericFormatter.thread.log=true +com.ibm.ws.fat.util.GenericFormatter.time.format=[MM/dd/yyyy HH:mm:ss:SSS z] +com.ibm.ws.fat.util.GenericFormatter.time.log=true + +############################################################ +# Facility specific properties. +# Provides extra control for each logger. +############################################################ +com.ibm.ws.webcontainer.fvt.level=INFO +com.ibm.websphere.simplicity.level=INFO +com.ibm.ws.jmx.connector.client.level=FINEST +com.ibm.ws.jmx.connector.client.rest.internal.level=FINEST +com.ibm.ws.filetransfer.mbean.level=FINEST +test.server.config.level=FINER +#com.ibm.websphere.jiiws.level=FINER +#httpclient.wire.level=FINEST +#httpclient.wire.header.level=FINEST +#org.apache.commons.httpclient.level=FINEST diff --git a/dev/com.ibm.ws.config_fat/validator.exclude.xml b/dev/com.ibm.ws.config_fat/validator.exclude.xml new file mode 100644 index 00000000000..b8795817794 --- /dev/null +++ b/dev/com.ibm.ws.config_fat/validator.exclude.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.classpath b/dev/com.ibm.ws.jmx.connector.client.rest/.classpath new file mode 100755 index 00000000000..2876090f903 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.classpath.gradle b/dev/com.ibm.ws.jmx.connector.client.rest/.classpath.gradle new file mode 100644 index 00000000000..2876090f903 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.gitignore b/dev/com.ibm.ws.jmx.connector.client.rest/.gitignore new file mode 100644 index 00000000000..57b341172a1 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/generated/ diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.project b/dev/com.ibm.ws.jmx.connector.client.rest/.project new file mode 100755 index 00000000000..364b0f3a64a --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.jmx.connector.client.rest + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..845c3083c7d --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +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.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c874b581698 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/bnd.bnd b/dev/com.ibm.ws.jmx.connector.client.rest/bnd.bnd new file mode 100755 index 00000000000..fc1d262a372 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/bnd.bnd @@ -0,0 +1,35 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +Bundle-Name: JMX Connector Client +Bundle-SymbolicName: com.ibm.ws.jmx.connector.client.rest +Bundle-Description: JMX Connector Client and common converter code; version=${bVersion} + +Private-Package: \ + com.ibm.ws.jmx.connector.client.rest.internal.* + +Export-Package: \ + com.ibm.websphere.jmx.connector.rest, \ + com.ibm.ws.jmx.connector.client.rest;thread-context=true, \ + com.ibm.ws.jmx.connector.converter, \ + com.ibm.ws.jmx.connector.datatypes + +Import-Package: \ + javax.management.*, \ + com.ibm.json.java.*, \ + com.ibm.ws.ffdc.*, \ + com.ibm.websphere.ras.*, \ + com.ibm.ws.ssl.protocol, \ + javax.net.ssl + +Include-Resource: \ + META-INF=resources/META-INF + +-dsannotations: com.ibm.ws.jmx.connector.client.rest.internal.Activator + +instrument.disabled: true + +-buildpath: \ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0,\ + com.ibm.websphere.appserver.api.json, \ + com.ibm.ws.org.osgi.annotation.versioning.1.0.0;version=latest diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/build.gradle b/dev/com.ibm.ws.jmx.connector.client.rest/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/build.xml b/dev/com.ibm.ws.jmx.connector.client.rest/build.xml new file mode 100755 index 00000000000..01c35e90413 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/build.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + Building ${clients.dir}/restConnector.jar with @{bnd} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/findbugs.exclude.xml b/dev/com.ibm.ws.jmx.connector.client.rest/findbugs.exclude.xml new file mode 100755 index 00000000000..9019b5841b7 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/findbugs.exclude.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/legal/copyright.properties b/dev/com.ibm.ws.jmx.connector.client.rest/legal/copyright.properties new file mode 100755 index 00000000000..c3eead2ff1e --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/legal/copyright.properties @@ -0,0 +1,13 @@ +#This properties describes files that have non-standard (i.e. non-OCO) copyright notices +# +#The name of property is the basename of the file (e.g., permissions.perm, MyJavaClass.java. +# +#The value of the property is why the file is non-standard: +# +# none - The file does not have or need a copyright notice +# apache - The file has an apache copyright notice +# sun - The file has a SUN copyright notice (which is valid as we are complying with the CDDL license) +# unclassified - The file is copyrighted by IBM, but is not Confidential or OCO +# restricted - This file is NOT OCO, but has the "Restricted Materials of IBM" notice +# +javax.management.remote.JMXConnectorProvider=none \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/META-INF/services/javax.management.remote.JMXConnectorProvider b/dev/com.ibm.ws.jmx.connector.client.rest/resources/META-INF/services/javax.management.remote.JMXConnectorProvider new file mode 100755 index 00000000000..84f96986bd3 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/META-INF/services/javax.management.remote.JMXConnectorProvider @@ -0,0 +1 @@ +com.ibm.ws.jmx.connector.client.rest.ClientProvider \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops new file mode 100755 index 00000000000..dc6e60b7ab0 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: A new file transfer client has connected with connection identifier {0}. +filetransfer.client.init.explanation=A new file transfer client has connected with the specified connection identifier. +filetransfer.client.init.useraction=This is an informational message, and no action is required. + +filetransfer.client.error=CWWKX7952E: A client-side error message "{0}" has occurred for connection {1}. +filetransfer.client.error.explanation=The client-side of the JMX REST connector encountered an error, and the specified message was generated. +filetransfer.client.error.useraction=Use the generated error message to identify, and correct the issue that caused this error, and rerun the operation. + +filetransfer.server.error=CWWKX7953E: Server-side error message "{0}" has occurred for connection {1}. +filetransfer.server.error.explanation=The server-side of the JMX REST connector encountered an error, and generated the specified message. +filetransfer.server.error.useraction=Use the generated error message to identify, and correct the issue that caused this error, and rerun the operation. + +filetransfer.client.bad.credentials=CWWKX7954E: The specified user name or password are not authorized. The server responded with code {0} and message "{1}" for connection {2}. +filetransfer.client.bad.credentials.explanation=The credentials provided when obtaining the connection are incorrect. The user may not exist, may not have authority to access the server, or the password may be incorrect. +filetransfer.client.bad.credentials.useraction=Correct the user name or password, then obtain a new connection. + +filetransfer.response.code.error=CWWKX7955E: The file transfer client received response code {0} with message "{1}" for connection {2}. +filetransfer.response.code.error.explanation=The file transfer client received an unexpected response code from the server. +filetransfer.response.code.error.useraction=Use the client response code to identify, and resolve the cause of this issue, and rerun the operation. + +filetransfer.download.file=CWWKX7956I: The request to download file {0} has been successful and its contents have been written into file {1} using connection {2}. +filetransfer.download.file.explanation=The download request of the specified file was successful. +filetransfer.download.file.useraction=This is an informational message, and no action is required. + +filetransfer.unsupported.operation=CWWKX7957E: The operation {0} is not supported by the file transfer client for connection {1}. +filetransfer.unsupported.operation.explanation=The specified operation is not supported by the file transfer client. +filetransfer.unsupported.operation.useraction=Request an operation that is supported by the file transfer client. + +filetransfer.upload.file=CWWKX7958I: The request to upload file {0} has been successful and its contents have been written into file {1} using connection {2}. +filetransfer.upload.file.explanation=The upload request of the specified file was successful. +filetransfer.upload.file.useraction=This is an informational message, and no action is required. + +filetransfer.delete.file=CWWKX7959I: The request to delete file {0} has been successful using connection {1}. +filetransfer.delete.file.explanation=The delete request of the specified file was successful. +filetransfer.delete.file.useraction=This is an informational message, and no action is required. + +filetransfer.delete.all=CWWKX7960I: The request to delete all files and folders from collection {0} succeeded using connection {1}. +filetransfer.delete.all.explanation=The delete request of the specified collection was successful. +filetransfer.delete.all.useraction=This is an informational message, and no action is required. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_cs.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_cs.nlsprops new file mode 100755 index 00000000000..a785a8c4482 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_cs.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Nov\u00fd klient p\u0159enosu soubor\u016f se spojil s identifik\u00e1torem p\u0159ipojen\u00ed {0}. +filetransfer.client.init.explanation=Nov\u00fd klient p\u0159enosu soubor\u016f se spojil s ur\u010den\u00fdm identifik\u00e1torem p\u0159ipojen\u00ed. +filetransfer.client.init.useraction=Toto je informativn\u00ed zpr\u00e1va a nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + +filetransfer.client.error=CWWKX7952E: Do\u0161lo k chybov\u00e1 zpr\u00e1v\u011b "{0}" na stran\u011b klienta pro p\u0159ipojen\u00ed {1}. +filetransfer.client.error.explanation=Do\u0161lo k chyb\u011b konektoru JMX REST na stran\u011b klienta a byla generov\u00e1na ur\u010den\u00e1 zpr\u00e1va. +filetransfer.client.error.useraction=Pomoc\u00ed generovan\u00e9 chybov\u00e9 zpr\u00e1vy identifikujte a opravte probl\u00e9m, kter\u00fd tuto chybu zp\u016fsobil, a spus\u0165te operaci znovu. + +filetransfer.server.error=CWWKX7953E: Do\u0161lo k chybov\u00e1 zpr\u00e1v\u011b "{0}" na stran\u011b serveru pro p\u0159ipojen\u00ed {1}. +filetransfer.server.error.explanation=Do\u0161lo k chyb\u011b konektoru JMX REST na stran\u011b serveru a byla generov\u00e1na uveden\u00e1 zpr\u00e1va. +filetransfer.server.error.useraction=Pomoc\u00ed generovan\u00e9 chybov\u00e9 zpr\u00e1vy identifikujte a opravte probl\u00e9m, kter\u00fd tuto chybu zp\u016fsobil, a spus\u0165te operaci znovu. + +filetransfer.client.bad.credentials=CWWKX7954E: Zadan\u00e9 u\u017eivatelsk\u00e9 jm\u00e9no a heslo nen\u00ed autorizovan\u00e9. Server odpov\u011bd\u011bl k\u00f3dem {0} a zpr\u00e1vou "{1}" pro p\u0159ipojen\u00ed {2}. +filetransfer.client.bad.credentials.explanation=Pov\u011b\u0159en\u00ed zadan\u00e1 p\u0159i z\u00edsk\u00e1v\u00e1n\u00ed p\u0159ipojen\u00ed jsou nespr\u00e1vn\u00e1. Je mo\u017en\u00e9, \u017ee u\u017eivatel neexistuje, nem\u00e1 opr\u00e1vn\u011bn\u00ed pro p\u0159\u00edstup na server nebo je nespr\u00e1vn\u00e9 heslo. +filetransfer.client.bad.credentials.useraction=Opravte jm\u00e9no u\u017eivatele nebo heslo a pot\u00e9 z\u00edskejte nov\u00e9 p\u0159ipojen\u00ed. + +filetransfer.response.code.error=CWWKX7955E: Klient p\u0159enosu soubor\u016f p\u0159ijal k\u00f3d odezvy {0} se zpr\u00e1vou "{1}" pro p\u0159ipojen\u00ed {2}. +filetransfer.response.code.error.explanation=Klient p\u0159enosu soubor\u016f p\u0159ijal neo\u010dek\u00e1van\u00fd k\u00f3d odezvy ze serveru. +filetransfer.response.code.error.useraction=Pomoc\u00ed k\u00f3du odezvy klienta ur\u010dete a vy\u0159e\u0161te p\u0159\u00ed\u010dinu tohoto probl\u00e9mu a spus\u0165te operaci znovu. + +filetransfer.download.file=CWWKX7956I: Po\u017eadavek na sta\u017een\u00ed souboru {0} byl \u00fasp\u011b\u0161n\u011b proveden a obsah byl zaps\u00e1n do souboru {1} pomoc\u00ed p\u0159ipojen\u00ed {2}. +filetransfer.download.file.explanation=Po\u017eadavek na sta\u017een\u00ed uveden\u00e9ho souboru byl \u00fasp\u011b\u0161n\u011b proveden. +filetransfer.download.file.useraction=Toto je informativn\u00ed zpr\u00e1va a nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + +filetransfer.unsupported.operation=CWWKX7957E: Operaci {0} klient p\u0159enosu soubor\u016f nepodporuje pro p\u0159ipojen\u00ed {1}. +filetransfer.unsupported.operation.explanation=Uvedenou operaci klient p\u0159enosu soubor\u016f nepodporuje. +filetransfer.unsupported.operation.useraction=Vy\u017e\u00e1dejte si operaci, kterou klient p\u0159enosu soubor\u016f podporuje. + +filetransfer.upload.file=CWWKX7958I: Po\u017eadavek na odesl\u00e1n\u00ed souboru {0} byl \u00fasp\u011b\u0161n\u011b proveden a obsah byl zaps\u00e1n do souboru {1} pomoc\u00ed p\u0159ipojen\u00ed {2}. +filetransfer.upload.file.explanation=Po\u017eadavek na odesl\u00e1n\u00ed uveden\u00e9ho souboru byl \u00fasp\u011b\u0161n\u011b proveden. +filetransfer.upload.file.useraction=Toto je informativn\u00ed zpr\u00e1va a nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + +filetransfer.delete.file=CWWKX7959I: Po\u017eadavek na odstran\u011bn\u00ed souboru {0} byl proveden \u00fasp\u011b\u0161n\u011b pomoc\u00ed p\u0159ipojen\u00ed {1}. +filetransfer.delete.file.explanation=Po\u017eadavek na odstran\u011bn\u00ed uveden\u00e9ho souboru byl \u00fasp\u011b\u0161n\u00fd. +filetransfer.delete.file.useraction=Toto je informativn\u00ed zpr\u00e1va a nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + +filetransfer.delete.all=CWWKX7960I: Po\u017eadavek na odstran\u011bn\u00ed v\u0161ech soubor\u016f a slo\u017eek z kolekce {0} byl \u00fasp\u011b\u0161n\u011b proveden pomoc\u00ed p\u0159ipojen\u00ed {1}. +filetransfer.delete.all.explanation=Po\u017eadavek na odstran\u011bn\u00ed uveden\u00e9 kolekce byl \u00fasp\u011b\u0161n\u00fd. +filetransfer.delete.all.useraction=Toto je informativn\u00ed zpr\u00e1va a nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_de.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_de.nlsprops new file mode 100755 index 00000000000..c734ddb8fc3 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_de.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Ein neuer Datei\u00fcbertragungsclient hat eine Verbindung mit der Verbindungs-ID {0} hergestellt. +filetransfer.client.init.explanation=Ein neuer Datei\u00fcbertragungsclient hat eine Verbindung mit der angegebenen Verbindungs-ID hergestellt. +filetransfer.client.init.useraction=Dies ist eine Informationsnachricht. Es ist keine Aktion erforderlich. + +filetransfer.client.error=CWWKX7952E: Der clientseitige Fehler "{0}" ist f\u00fcr die Verbindung {1} aufgetreten. +filetransfer.client.error.explanation=Auf der Clientseite des JMX-REST-Connectors ist ein Fehler aufgetreten, und es wurde die angegebene Nachricht generiert. +filetransfer.client.error.useraction=Verwenden Sie die generierte Fehlernachricht, um das Problem, das diesen Fehler verursacht, zu identifizieren und zu beheben, und f\u00fchren Sie anschlie\u00dfend die Operation erneut aus. + +filetransfer.server.error=CWWKX7953E: Der serverseitige Fehler "{0}" ist f\u00fcr die Verbindung {1} aufgetreten. +filetransfer.server.error.explanation=Auf der Serverseite des JMX-REST-Connectors ist ein Fehler aufgetreten, und es wurde die angegebene Nachricht generiert. +filetransfer.server.error.useraction=Verwenden Sie die generierte Fehlernachricht, um das Problem, das diesen Fehler verursacht, zu identifizieren und zu beheben, und f\u00fchren Sie anschlie\u00dfend die Operation erneut aus. + +filetransfer.client.bad.credentials=CWWKX7954E: Der angegebene Benutzername oder das angegebene Kennwort ist nicht berechtigt. Der Server hat mit dem Code {0} und der Nachricht "{1}" f\u00fcr die Verbindung {2} geantwortet. +filetransfer.client.bad.credentials.explanation=Die beim Anfordern der Verbindung angegebenen Berechtigungsnachweise sind nicht g\u00fcltig. M\u00f6glicherweise ist der Benutzer nicht vorhanden, oder er hat keine Berechtigung f\u00fcr den Zugriff auf den Server, oder das Kennwort ist ung\u00fcltig. +filetransfer.client.bad.credentials.useraction=Korrigieren Sie den Benutzernamen bzw. das Kennwort, und fordern Sie dann eine neue Verbindung an. + +filetransfer.response.code.error=CWWKX7955E: Der Datei\u00fcbertragungsclient hat den Antwortcode {0} mit der Nachricht "{1}" f\u00fcr die Verbindung {2} empfangen. +filetransfer.response.code.error.explanation=Der Datei\u00fcbertragungsclient hat einen unerwarteten Antwortcode vom Server empfangen. +filetransfer.response.code.error.useraction=Verwenden Sie den Antwortcode des Clients, um die Ursache f\u00fcr dieses Problem zu identifizieren und zu beheben, und f\u00fchren Sie anschlie\u00dfend die Operation erneut aus. + +filetransfer.download.file=CWWKX7956I: Die Anforderung zum Herunterladen der Datei {0} war erfolgreich, und der Inhalt der Datei wurde in die Datei {1} geschrieben. Die Verbindung {2} wurde daf\u00fcr verwendet. +filetransfer.download.file.explanation=Die Downloadanforderung f\u00fcr die angegebene Datei war erfolgreich. +filetransfer.download.file.useraction=Dies ist eine Informationsnachricht. Es ist keine Aktion erforderlich. + +filetransfer.unsupported.operation=CWWKX7957E: Die Operation {0} wird vom Datei\u00fcbertragungsclient f\u00fcr die Verbindung {1} nicht unterst\u00fctzt. +filetransfer.unsupported.operation.explanation=Die angegebene Operation wird vom Datei\u00fcbertragungsclient nicht unterst\u00fctzt. +filetransfer.unsupported.operation.useraction=Fordern Sie eine Operation an, die vom Datei\u00fcbertragungsclient unterst\u00fctzt wird. + +filetransfer.upload.file=CWWKX7958I: Die Anforderung zum Hochladen der Datei {0} war erfolgreich, und der Inhalt der Datei wurde in die Datei {1} geschrieben. Die Verbindung {2} wurde daf\u00fcr verwendet. +filetransfer.upload.file.explanation=Die Uploadanforderung f\u00fcr die angegebene Datei war erfolgreich. +filetransfer.upload.file.useraction=Dies ist eine Informationsnachricht. Es ist keine Aktion erforderlich. + +filetransfer.delete.file=CWWKX7959I: Die Anforderung zum L\u00f6schen der Datei {0} \u00fcber die Verbindung {1} war erfolgreich. +filetransfer.delete.file.explanation=Die Anforderung zum L\u00f6schen der angegebenen Datei war erfolgreich. +filetransfer.delete.file.useraction=Dies ist eine Informationsnachricht. Es ist keine Aktion erforderlich. + +filetransfer.delete.all=CWWKX7960I: Die Anforderung zum L\u00f6schen aller Dateien und Ordner aus der Sammlung {0} \u00fcber die Verbindung {1} war erfolgreich. +filetransfer.delete.all.explanation=Die L\u00f6schanforderung f\u00fcr die angegebene Sammlung war erfolgreich. +filetransfer.delete.all.useraction=Dies ist eine Informationsnachricht. Es ist keine Aktion erforderlich. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_es.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_es.nlsprops new file mode 100755 index 00000000000..df6c915a4df --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_es.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Un nuevo cliente de transferencia de archivos se ha conectado con el ID de conexi\u00f3n {0}. +filetransfer.client.init.explanation=Un nuevo cliente de transferencia de archivos se ha conectado con el ID de conexi\u00f3n especificado. +filetransfer.client.init.useraction=Este es un mensaje informativo y no es necesaria ninguna acci\u00f3n. + +filetransfer.client.error=CWWKX7952E: Se ha generado un mensaje de error del lado de cliente "{0}" para la conexi\u00f3n {1}. +filetransfer.client.error.explanation=El lado del cliente del conector JMX REST ha encontrado un error y se ha generado el mensaje especificado. +filetransfer.client.error.useraction=Utilice el mensaje de error generado para identificar y corregir el problema que ha provocado este error, y vuelva a ejecutar la operaci\u00f3n. + +filetransfer.server.error=CWWKX7953E: Se ha generado un mensaje de error del lado de servidor "{0}" para la conexi\u00f3n {1}. +filetransfer.server.error.explanation=El lado del servidor del conector JMX REST ha encontrado un error y se ha generado el mensaje especificado. +filetransfer.server.error.useraction=Utilice el mensaje de error generado para identificar y corregir el problema que ha provocado este error, y vuelva a ejecutar la operaci\u00f3n. + +filetransfer.client.bad.credentials=CWWKX7954E: El nombre de usuario o la contrase\u00f1a especificados no est\u00e1n autorizados. El servidor ha respondido con el c\u00f3digo {0} y el mensaje "{1}" para la conexi\u00f3n {2}. +filetransfer.client.bad.credentials.explanation=Las credenciales proporcionadas al obtener la conexi\u00f3n son incorrectas. El usuario puede que no exista, puede que no tenga autoridad para acceder al servidor o que la contrase\u00f1a sea incorrecta. +filetransfer.client.bad.credentials.useraction=Corrija el nombre de usuario o la contrase\u00f1a y despu\u00e9s obtenga una nueva conexi\u00f3n. + +filetransfer.response.code.error=CWWKX7955E: El cliente de transferencia de archivos ha recibido un c\u00f3digo de respuesta {0} con el mensaje "{1}" para la conexi\u00f3n {2}. +filetransfer.response.code.error.explanation=El cliente de transferencia de archivos ha recibido un c\u00f3digo de respuesta inesperado del servidor. +filetransfer.response.code.error.useraction=Utilice el c\u00f3digo de respuesta del cliente para identificar y resolver la causa del problema, y vuelva a ejecutar la operaci\u00f3n. + +filetransfer.download.file=CWWKX7956I: La solicitud de descarga del archivo {0} ha sido satisfactoria y su contenido se ha escrito en el archivo {1} utilizando la conexi\u00f3n {2}. +filetransfer.download.file.explanation=La solicitud de descarga del archivo especificado ha sido satisfactoria. +filetransfer.download.file.useraction=Este es un mensaje informativo y no es necesaria ninguna acci\u00f3n. + +filetransfer.unsupported.operation=CWWKX7957E: La operaci\u00f3n {0} no est\u00e1 soportada por el cliente de transferencia de archivos para la conexi\u00f3n {1}. +filetransfer.unsupported.operation.explanation=La operaci\u00f3n especificada no est\u00e1 soportada por el cliente de transferencia de archivos. +filetransfer.unsupported.operation.useraction=Solicite una operaci\u00f3n que est\u00e9 soportada por el cliente de transferencia de archivos. + +filetransfer.upload.file=CWWKX7958I: La solicitud de carga del archivo {0} ha sido satisfactoria y su contenido se ha escrito en el archivo {1} utilizando la conexi\u00f3n {2}. +filetransfer.upload.file.explanation=La solicitud de carga del archivo especificado ha sido satisfactoria. +filetransfer.upload.file.useraction=Este es un mensaje informativo y no es necesaria ninguna acci\u00f3n. + +filetransfer.delete.file=CWWKX7959I: La solicitud de supresi\u00f3n del archivo {0} ha sido satisfactoria utilizando conexi\u00f3n {1}. +filetransfer.delete.file.explanation=La solicitud de supresi\u00f3n del archivo especificado ha sido satisfactoria. +filetransfer.delete.file.useraction=Este es un mensaje informativo y no es necesaria ninguna acci\u00f3n. + +filetransfer.delete.all=CWWKX7960I: La solicitud de supresi\u00f3n de todos los archivos y carpetas de la colecci\u00f3n {0} ha sido satisfactoria utilizando la conexi\u00f3n {1}. +filetransfer.delete.all.explanation=La solicitud de supresi\u00f3n de la colecci\u00f3n especificada ha sido satisfactoria. +filetransfer.delete.all.useraction=Este es un mensaje informativo y no es necesaria ninguna acci\u00f3n. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_fr.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_fr.nlsprops new file mode 100755 index 00000000000..d2c482d796f --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_fr.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Un nouveau client de transfert de fichier a \u00e9t\u00e9 connect\u00e9 avec l''identificateur de connexion {0}. +filetransfer.client.init.explanation=Un nouveau client de transfert de fichier a \u00e9t\u00e9 connect\u00e9 avec l'identificateur de connexion indiqu\u00e9. +filetransfer.client.init.useraction=Il s'agit d'un message d'information et aucune action n'est requise. + +filetransfer.client.error=CWWKX7952E: Un message d''erreur "{0}" a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 c\u00f4t\u00e9 client pour la connexion {1}. +filetransfer.client.error.explanation=Une erreur s'est produite pour le connecteur JMX REST c\u00f4t\u00e9 client et le message indiqu\u00e9 a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9. +filetransfer.client.error.useraction=Utilisez le message d'erreur g\u00e9n\u00e9r\u00e9 pour identifier et corriger le probl\u00e8me \u00e0 l'origine de cette erreur, puis relancez l'op\u00e9ration. + +filetransfer.server.error=CWWKX7953E: Le message d''erreur "{0}" a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 c\u00f4t\u00e9 serveur pour la connexion {1}. +filetransfer.server.error.explanation=Une erreur s'est produite sur le connecteur JMX REST c\u00f4t\u00e9 serveur et a g\u00e9n\u00e9r\u00e9 le message indiqu\u00e9. +filetransfer.server.error.useraction=Utilisez le message d'erreur g\u00e9n\u00e9r\u00e9 pour identifier et corriger le probl\u00e8me \u00e0 l'origine de cette erreur, puis relancez l'op\u00e9ration. + +filetransfer.client.bad.credentials=CWWKX7954E: Le nom d''utilisateur ou le mot de passe indiqu\u00e9 n''est pas autoris\u00e9. Le serveur a r\u00e9pondu avec le code {0} et le message "{1}" pour la connexion {2}. +filetransfer.client.bad.credentials.explanation=Les donn\u00e9es d'identification fournies lors de l'obtention de la connexion sont incorrectes. L'utilisateur n'existe peut-\u00eatre pas, s'il existe, il n'a peut-\u00eatre pas le droit d'acc\u00e9der au serveur, ou le mot de passe indiqu\u00e9 est incorrect. +filetransfer.client.bad.credentials.useraction=Corrigez le nom d'utilisateur ou le mot de passe, puis obtenez une nouvelle connexion. + +filetransfer.response.code.error=CWWKX7955E: Le client de transfert de fichier a re\u00e7u un code de r\u00e9ponse {0} avec le message "{1}" pour la connexion {2}. +filetransfer.response.code.error.explanation=Le client du transfert de fichiers a re\u00e7u un code de r\u00e9ponse inattendu du serveur. +filetransfer.response.code.error.useraction=Utilisez la code de r\u00e9ponse client pour identifier et r\u00e9soudre ce probl\u00e8me, puis relancez l'op\u00e9ration. + +filetransfer.download.file=CWWKX7956I: La demande de t\u00e9l\u00e9chargement du fichier {0} a abouti et son contenu a \u00e9t\u00e9 \u00e9crit dans le fichier {1} \u00e0 l''aide de la connexion {2}. +filetransfer.download.file.explanation=La demande de t\u00e9l\u00e9chargement du fichier sp\u00e9cifi\u00e9 a abouti. +filetransfer.download.file.useraction=Il s'agit d'un message d'information et aucune action n'est requise. + +filetransfer.unsupported.operation=CWWKX7957E: L''op\u00e9ration {0} n''est pas prise en charge par le client de transfert de fichier pour la connexion {1}. +filetransfer.unsupported.operation.explanation=L'op\u00e9ration sp\u00e9cifi\u00e9e n'est pas prise en charge par le client du transfert de fichiers. +filetransfer.unsupported.operation.useraction=Demandez une op\u00e9ration qui est prise en charge par le client du transfert de fichiers. + +filetransfer.upload.file=CWWKX7958I: La demande de t\u00e9l\u00e9chargement du fichier {0} a abouti et son contenu a \u00e9t\u00e9 \u00e9crit dans le fichier {1} \u00e0 l''aide de la connexion {2}. +filetransfer.upload.file.explanation=La demande de t\u00e9l\u00e9chargement du fichier sp\u00e9cifi\u00e9 a abouti. +filetransfer.upload.file.useraction=Il s'agit d'un message d'information et aucune action n'est requise. + +filetransfer.delete.file=CWWKX7959I: La demande de suppression du fichier {0} \u00e0 l''aide de la connexion {1} a abouti. +filetransfer.delete.file.explanation=La demande de suppression du fichier indiqu\u00e9 a abouti. +filetransfer.delete.file.useraction=Il s'agit d'un message d'information et aucune action n'est requise. + +filetransfer.delete.all=CWWKX7960I: La demande de suppression de tous les fichiers et dossiers de la collection {0} a r\u00e9ussi via la connexion {1}. +filetransfer.delete.all.explanation=La demande de suppression de la collection sp\u00e9cifi\u00e9e a r\u00e9ussi. +filetransfer.delete.all.useraction=Il s'agit d'un message d'information et aucune action n'est requise. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_hu.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_hu.nlsprops new file mode 100755 index 00000000000..b5afafc9697 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_hu.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \u00daj f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l csatlakozott {0} kapcsolatazonos\u00edt\u00f3val. +filetransfer.client.init.explanation=\u00daj f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l csatlakozott a megadott kapcsolatazonos\u00edt\u00f3val. +filetransfer.client.init.useraction=Ez inform\u00e1ci\u00f3s \u00fczenet, semmit sem kell tennie. + +filetransfer.client.error=CWWKX7952E: \u00dcgyf\u00e9loldali "{0}" hiba\u00fczenet a(z) {1} kapcsolat eset\u00e9ben. +filetransfer.client.error.explanation=A JMX REST csatol\u00f3 \u00fcgyf\u00e9l oldal\u00e1n hiba t\u00f6rt\u00e9nt, \u00e9s a megadott \u00fczenet j\u00f6tt l\u00e9tre. +filetransfer.client.error.useraction=Az el\u0151\u00e1ll\u00edtott hiba\u00fczenet seg\u00edts\u00e9g\u00e9vel azonos\u00edtsa \u00e9s jav\u00edtsa a hib\u00e1t okoz\u00f3 probl\u00e9m\u00e1t, majd futtassa \u00fajra a m\u0171veletet. + +filetransfer.server.error=CWWKX7953E: Kiszolg\u00e1l\u00f3 oldali "{0}" hiba\u00fczenet a(z) {1} kapcsolat eset\u00e9ben. +filetransfer.server.error.explanation=A JMX REST csatol\u00f3 kiszolg\u00e1l\u00f3 oldal\u00e1n hiba t\u00f6rt\u00e9nt, \u00e9s a megadott \u00fczenetet \u00e1ll\u00edtotta el\u0151. +filetransfer.server.error.useraction=Az el\u0151\u00e1ll\u00edtott hiba\u00fczenet seg\u00edts\u00e9g\u00e9vel azonos\u00edtsa \u00e9s jav\u00edtsa a hib\u00e1t okoz\u00f3 probl\u00e9m\u00e1t, majd futtassa \u00fajra a m\u0171veletet. + +filetransfer.client.bad.credentials=CWWKX7954E: A megadottfelhaszn\u00e1l\u00f3n\u00e9v \u00e9s jelsz\u00f3 nem jogosult. A kiszolg\u00e1l\u00f3 a(z) {0} k\u00f3ddal \u00e9s"{1}" \u00fczenettel v\u00e1laszolt a(z) {2} kapcsolat eset\u00e9ben. +filetransfer.client.bad.credentials.explanation=A kapcsolat l\u00e9trehoz\u00e1sakor megadott hiteles\u00edt\u00e9si adatok helytelenek. Lehet, hogy a felhaszn\u00e1l\u00f3 nem l\u00e9tezik, nincs jogosults\u00e1ga a kiszolg\u00e1l\u00f3 el\u00e9r\u00e9s\u00e9hez, vagy helytelen a jelsz\u00f3. +filetransfer.client.bad.credentials.useraction=Jav\u00edtsa ki a felhaszn\u00e1l\u00f3nevet vagy jelsz\u00f3t, majd hozzon l\u00e9tre \u00faj kapcsolatot. + +filetransfer.response.code.error=CWWKX7955E: A f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l {0} v\u00e1laszk\u00f3dot kapott "{1}" \u00fczenettel a(z) {2} kapcsolat eset\u00e9ben. +filetransfer.response.code.error.explanation=A f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l nem v\u00e1rt v\u00e1laszk\u00f3dot kapott a kiszolg\u00e1l\u00f3t\u00f3l. +filetransfer.response.code.error.useraction=Az \u00fcgyf\u00e9l v\u00e1laszk\u00f3ddal azonos\u00edtsa \u00e9s oldja meg a probl\u00e9ma ok\u00e1t, majd futtassa \u00fajra a m\u0171veletet. + +filetransfer.download.file=CWWKX7956I: A(z) {0} f\u00e1jl let\u00f6lt\u00e9s\u00e9re vonatkoz\u00f3 k\u00e9r\u00e9s sikeres volt, \u00e9s a tartalma a(z) {1} f\u00e1jlba lett \u00edrva a(z) {2} kapcsolat alkalmaz\u00e1s\u00e1val. +filetransfer.download.file.explanation=A megadott f\u00e1jl let\u00f6lt\u00e9si k\u00e9r\u00e9se sikeres volt. +filetransfer.download.file.useraction=Ez inform\u00e1ci\u00f3s \u00fczenet, semmit sem kell tennie. + +filetransfer.unsupported.operation=CWWKX7957E: A(z) {0} m\u0171veletet a f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l nem t\u00e1mogatja a(z) {1} kapcsolat eset\u00e9ben. +filetransfer.unsupported.operation.explanation=A megadott m\u0171veletet nem t\u00e1mogatja a f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l. +filetransfer.unsupported.operation.useraction=K\u00e9rjen olyan m\u0171veletet, amelyet a f\u00e1jl\u00e1tviteli \u00fcgyf\u00e9l t\u00e1mogat. + +filetransfer.upload.file=CWWKX7958I: A(z) {0} f\u00e1jl felt\u00f6lt\u00e9s\u00e9re vonatkoz\u00f3 k\u00e9r\u00e9s sikeres volt, \u00e9s a tartalma a(z) {1} f\u00e1jlba lett \u00edrva a(z) {2} kapcsolat alkalmaz\u00e1s\u00e1val. +filetransfer.upload.file.explanation=A megadott f\u00e1jl felt\u00f6lt\u00e9si k\u00e9r\u00e9se sikeres volt. +filetransfer.upload.file.useraction=Ez inform\u00e1ci\u00f3s \u00fczenet, semmit sem kell tennie. + +filetransfer.delete.file=CWWKX7959I: A(z) {0} f\u00e1jl t\u00f6rl\u00e9s\u00e9re vonatkoz\u00f3 k\u00e9r\u00e9s sikeres volt a(z) {1} kapcsolat felhaszn\u00e1l\u00e1s\u00e1val. +filetransfer.delete.file.explanation=A megadott f\u00e1jl t\u00f6rl\u00e9si k\u00e9r\u00e9se sikeres volt. +filetransfer.delete.file.useraction=Ez inform\u00e1ci\u00f3s \u00fczenet, semmit sem kell tennie. + +filetransfer.delete.all=CWWKX7960I: A(z) {0} gy\u0171jtem\u00e9nyben l\u00e9v\u0151 \u00f6sszes f\u00e1jl \u00e9s mappa t\u00f6rl\u00e9s\u00e9re vonatkoz\u00f3 k\u00e9r\u00e9s siker\u00fclt a(z) {1} kapcsolat haszn\u00e1lat\u00e1val. +filetransfer.delete.all.explanation=A megadott gy\u0171jtem\u00e9ny t\u00f6rl\u00e9si k\u00e9r\u00e9se sikeres volt. +filetransfer.delete.all.useraction=Ez inform\u00e1ci\u00f3s \u00fczenet, semmit sem kell tennie. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_it.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_it.nlsprops new file mode 100755 index 00000000000..be4711857d0 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_it.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Un nuovo client di trasferimento file si \u00e8 connesso con l''identificativo di connessione {0}. +filetransfer.client.init.explanation=Un nuovo client di trasferimento file si \u00e8 connesso con l'identificativo di connessione specificato. +filetransfer.client.init.useraction=Si tratta di un messaggio informativo, non \u00e8 richiesta alcuna azione. + +filetransfer.client.error=CWWKX7952E: Si \u00e8 verificato un messaggio di errore lato client "{0}" per la connessione {1}. +filetransfer.client.error.explanation=Il connettore REST JMX lato client ha rilevato un errore ed \u00e8 stato generato il messaggio specificato. +filetransfer.client.error.useraction=Utilizzare il messaggio di errore generato per identificare e risolvere il problema che ha causato questo errore ed eseguire di nuovo l'operazione. + +filetransfer.server.error=CWWKX7953E: Si \u00e8 verificato un messaggio di errore lato server "{0}" per la connessione {1}. +filetransfer.server.error.explanation=Il connettore REST JMX lato server ha rilevato un errore ed \u00e8 stato generato il messaggio specificato. +filetransfer.server.error.useraction=Utilizzare il messaggio di errore generato per identificare e risolvere il problema che ha causato questo errore ed eseguire di nuovo l'operazione. + +filetransfer.client.bad.credentials=CWWKX7954E: Il nome utente o la password specificati non sono autorizzati. Il server ha risposto con il codice {0} e il messaggio "{1}" per la connessione {2}. +filetransfer.client.bad.credentials.explanation=Le credenziali fornite durante il tentativo di ottenere la connessione non sono corrette. Probabilmente l'utente non esiste, non dispone dell'autorizzazione per accedere al server oppure la password non \u00e8 corretta. +filetransfer.client.bad.credentials.useraction=Correggere il nome utente o la password, quindi ottenere la connessione. + +filetransfer.response.code.error=CWWKX7955E: Il client di trasferimento file ha ricevuto il codice di risposta {0} con il messaggio "{1}" per la connessione {2}. +filetransfer.response.code.error.explanation=Il client di trasferimento file ha ricevuto un codice di risposta imprevisto dal server. +filetransfer.response.code.error.useraction=Utilizzare il codice di risposta del client per identificare e risolvere la causa di questo problema, ed eseguire di nuovo l'operazione. + +filetransfer.download.file=CWWKX7956I: La richiesta di scaricamento del file {0} \u00e8 riuscita e il suo contenuto \u00e8 stato scritto nel file {1} utilizzando la connessione {2}. +filetransfer.download.file.explanation=La richiesta di scaricamento del file specificato \u00e8 riuscita. +filetransfer.download.file.useraction=Si tratta di un messaggio informativo, non \u00e8 richiesta alcuna azione. + +filetransfer.unsupported.operation=CWWKX7957E: L''operazione {0} non \u00e8 supportata dal client di trasferimento file per la connessione {1}. +filetransfer.unsupported.operation.explanation=L'operazione specificata non \u00e8 supportata dal client di trasferimento file. +filetransfer.unsupported.operation.useraction=Richiedere un'operazione supportata dal client di trasferimento file. + +filetransfer.upload.file=CWWKX7958I: La richiesta di caricamento del file {0} \u00e8 riuscita e il suo contenuto \u00e8 stato scritto nel file {1} utilizzando la connessione {2}. +filetransfer.upload.file.explanation=La richiesta di caricamento del file specificato \u00e8 riuscita. +filetransfer.upload.file.useraction=Si tratta di un messaggio informativo, non \u00e8 richiesta alcuna azione. + +filetransfer.delete.file=CWWKX7959I: La richiesta di eliminazione del file {0} \u00e8 riuscita utilizzando la connessione {1}. +filetransfer.delete.file.explanation=La richiesta di eliminazione del file specificato \u00e8 riuscita. +filetransfer.delete.file.useraction=Si tratta di un messaggio informativo, non \u00e8 richiesta alcuna azione. + +filetransfer.delete.all=CWWKX7960I: Richiesta di eliminazione di tutti i file e cartelle dalla raccolta {0} riuscita con la connessione {1}. +filetransfer.delete.all.explanation=La richiesta di eliminazione della raccolta specificata \u00e8 riuscita. +filetransfer.delete.all.useraction=Si tratta di un messaggio informativo, non \u00e8 richiesta alcuna azione. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ja.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ja.nlsprops new file mode 100755 index 00000000000..73608fc0076 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ja.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \u65b0\u898f\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u63a5\u7d9a ID {0} \u3092\u7528\u3044\u3066\u63a5\u7d9a\u3055\u308c\u307e\u3057\u305f\u3002 +filetransfer.client.init.explanation=\u65b0\u898f\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u793a\u3055\u308c\u305f\u63a5\u7d9a ID \u3092\u7528\u3044\u3066\u63a5\u7d9a\u3055\u308c\u307e\u3057\u305f\u3002 +filetransfer.client.init.useraction=\u3053\u308c\u306f\u901a\u77e5\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u3042\u308a\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 + +filetransfer.client.error=CWWKX7952E: \u63a5\u7d9a {1} \u306b\u5bfe\u3057\u3066\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30fb\u30b5\u30a4\u30c9\u306e\u30a8\u30e9\u30fc\u30fb\u30e1\u30c3\u30bb\u30fc\u30b8\u300c{0}\u300d\u304c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002 +filetransfer.client.error.explanation=JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30fb\u30b5\u30a4\u30c9\u304c\u30a8\u30e9\u30fc\u3092\u691c\u51fa\u3057\u3001\u793a\u3055\u308c\u305f\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u751f\u6210\u3055\u308c\u307e\u3057\u305f\u3002 +filetransfer.client.error.useraction=\u751f\u6210\u3055\u308c\u305f\u30a8\u30e9\u30fc\u30fb\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u4f7f\u7528\u3057\u3066\u3053\u306e\u30a8\u30e9\u30fc\u3092\u5f15\u304d\u8d77\u3053\u3057\u305f\u554f\u984c\u3092\u7279\u5b9a\u3057\u3001\u4fee\u6b63\u3057\u3066\u3001\u64cd\u4f5c\u3092\u518d\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +filetransfer.server.error=CWWKX7953E: \u63a5\u7d9a {1} \u306b\u5bfe\u3057\u3066\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30b5\u30a4\u30c9\u306e\u30a8\u30e9\u30fc\u30fb\u30e1\u30c3\u30bb\u30fc\u30b8\u300c{0}\u300d\u304c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002 +filetransfer.server.error.explanation=JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306e\u30b5\u30fc\u30d0\u30fc\u30fb\u30b5\u30a4\u30c9\u304c\u30a8\u30e9\u30fc\u3092\u691c\u51fa\u3057\u3001\u793a\u3055\u308c\u305f\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u751f\u6210\u3057\u307e\u3057\u305f\u3002 +filetransfer.server.error.useraction=\u751f\u6210\u3055\u308c\u305f\u30a8\u30e9\u30fc\u30fb\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u4f7f\u7528\u3057\u3066\u3053\u306e\u30a8\u30e9\u30fc\u3092\u5f15\u304d\u8d77\u3053\u3057\u305f\u554f\u984c\u3092\u7279\u5b9a\u3057\u3001\u4fee\u6b63\u3057\u3066\u3001\u64cd\u4f5c\u3092\u518d\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +filetransfer.client.bad.credentials=CWWKX7954E: \u6307\u5b9a\u3055\u308c\u305f\u30e6\u30fc\u30b6\u30fc\u540d\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u8a31\u53ef\u3055\u308c\u307e\u305b\u3093\u3002\u30b5\u30fc\u30d0\u30fc\u306f\u3001\u63a5\u7d9a {2} \u306b\u3064\u3044\u3066\u30b3\u30fc\u30c9 {0}\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u300c{1}\u300d\u3067\u5fdc\u7b54\u3057\u307e\u3057\u305f\u3002 +filetransfer.client.bad.credentials.explanation=\u63a5\u7d9a\u306e\u53d6\u5f97\u6642\u306b\u6307\u5b9a\u3057\u305f\u8cc7\u683c\u60c5\u5831\u306b\u8aa4\u308a\u304c\u3042\u308a\u307e\u3059\u3002 \u30e6\u30fc\u30b6\u30fc\u304c\u5b58\u5728\u3057\u306a\u3044\u304b\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u304c\u306a\u3044\u304b\u3001\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u306b\u8aa4\u308a\u304c\u3042\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +filetransfer.client.bad.credentials.useraction=\u30e6\u30fc\u30b6\u30fc\u540d\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a02\u6b63\u3057\u3066\u304b\u3089\u65b0\u898f\u63a5\u7d9a\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +filetransfer.response.code.error=CWWKX7955E: \u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u63a5\u7d9a {2} \u306b\u3064\u3044\u3066\u3001\u5fdc\u7b54\u30b3\u30fc\u30c9 {0} \u304a\u3088\u3073\u30e1\u30c3\u30bb\u30fc\u30b8\u300c{1}\u300d\u3092\u53d7\u3051\u53d6\u308a\u307e\u3057\u305f\u3002 +filetransfer.response.code.error.explanation=\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u4e88\u671f\u3057\u306a\u3044\u5fdc\u7b54\u30b3\u30fc\u30c9\u3092\u53d7\u4fe1\u3057\u307e\u3057\u305f\u3002 +filetransfer.response.code.error.useraction=\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u5fdc\u7b54\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3053\u306e\u554f\u984c\u306e\u539f\u56e0\u3092\u7279\u5b9a\u3057\u3001\u89e3\u6c7a\u3057\u3066\u3001\u64cd\u4f5c\u3092\u518d\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +filetransfer.download.file=CWWKX7956I: \u30d5\u30a1\u30a4\u30eb {0} \u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u3001\u63a5\u7d9a {2} \u3092\u4f7f\u7528\u3057\u3066\u305d\u306e\u5185\u5bb9\u304c\u30d5\u30a1\u30a4\u30eb {1} \u306b\u66f8\u304d\u8fbc\u307e\u308c\u307e\u3057\u305f\u3002 +filetransfer.download.file.explanation=\u793a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.download.file.useraction=\u3053\u308c\u306f\u901a\u77e5\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u3042\u308a\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 + +filetransfer.unsupported.operation=CWWKX7957E: \u64cd\u4f5c {0} \u306f\u3001\u63a5\u7d9a {1} \u3067\u306f\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u3088\u3063\u3066\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +filetransfer.unsupported.operation.explanation=\u793a\u3055\u308c\u305f\u64cd\u4f5c\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u3088\u3063\u3066\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +filetransfer.unsupported.operation.useraction=\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u3088\u3063\u3066\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u308b\u64cd\u4f5c\u3092\u8981\u6c42\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +filetransfer.upload.file=CWWKX7958I: \u30d5\u30a1\u30a4\u30eb {0} \u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u3001\u63a5\u7d9a {2} \u3092\u4f7f\u7528\u3057\u3066\u305d\u306e\u5185\u5bb9\u304c\u30d5\u30a1\u30a4\u30eb {1} \u306b\u66f8\u304d\u8fbc\u307e\u308c\u307e\u3057\u305f\u3002 +filetransfer.upload.file.explanation=\u793a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.upload.file.useraction=\u3053\u308c\u306f\u901a\u77e5\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u3042\u308a\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 + +filetransfer.delete.file=CWWKX7959I: \u30d5\u30a1\u30a4\u30eb {0} \u306e\u524a\u9664\u8981\u6c42\u304c\u3001\u63a5\u7d9a {1} \u3092\u4f7f\u7528\u3057\u3066\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.delete.file.explanation=\u793a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u524a\u9664\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.delete.file.useraction=\u3053\u308c\u306f\u901a\u77e5\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u3042\u308a\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 + +filetransfer.delete.all=CWWKX7960I: \u30b3\u30ec\u30af\u30b7\u30e7\u30f3 {0} \u304b\u3089\u306e\u3059\u3079\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30d5\u30a9\u30eb\u30c0\u30fc\u306e\u524a\u9664\u8981\u6c42\u304c\u3001\u63a5\u7d9a {1} \u3092\u4f7f\u7528\u3057\u3066\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.delete.all.explanation=\u793a\u3055\u308c\u305f\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u524a\u9664\u8981\u6c42\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u307e\u3057\u305f\u3002 +filetransfer.delete.all.useraction=\u3053\u308c\u306f\u901a\u77e5\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u3042\u308a\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ko.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ko.nlsprops new file mode 100755 index 00000000000..32f9315d626 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ko.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \uc0c8 \ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc5f0\uacb0 ID {0}\uacfc(\uc640) \uc5f0\uacb0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.client.init.explanation=\uc0c8 \ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc9c0\uc815\ub41c \uc5f0\uacb0 ID\uc640 \uc5f0\uacb0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.client.init.useraction=\uc774\uac83\uc740 \uc815\ubcf4 \uba54\uc2dc\uc9c0\uc774\ubbc0\ub85c \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. + +filetransfer.client.error=CWWKX7952E: \uc5f0\uacb0 {1}\uc5d0 \ub300\ud55c \ud074\ub77c\uc774\uc5b8\ud2b8\uce21 \uc624\ub958 \uba54\uc2dc\uc9c0 "{0}"\uc774(\uac00) \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. +filetransfer.client.error.explanation=JMX REST \ucee4\ub125\ud130\uc758 \ud074\ub77c\uc774\uc5b8\ud2b8\uce21\uc5d0\uc11c \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc73c\uba70 \uc9c0\uc815\ub41c \uba54\uc2dc\uc9c0\uac00 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.client.error.useraction=\uc0dd\uc131\ub41c \uc624\ub958 \uba54\uc2dc\uc9c0\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc774 \uc624\ub958\uc758 \uc6d0\uc778\uc774 \ub418\ub294 \ubb38\uc81c\ub97c \uc2dd\ubcc4\ud558\uace0 \uc815\uc815\ud55c \ud6c4 \uc870\uc791\uc744 \ub2e4\uc2dc \uc2e4\ud589\ud569\ub2c8\ub2e4. + +filetransfer.server.error=CWWKX7953E: \uc5f0\uacb0 {1}\uc5d0 \ub300\ud55c \uc11c\ubc84\uce21 \uc624\ub958 \uba54\uc2dc\uc9c0 "{0}"\uc774(\uac00) \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. +filetransfer.server.error.explanation=JMX REST \ucee4\ub125\ud130\uc758 \uc11c\ubc84\uce21\uc5d0 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc73c\uba70 \uc9c0\uc815\ub41c \uba54\uc2dc\uc9c0\uac00 \ud45c\uc2dc\ub429\ub2c8\ub2e4. +filetransfer.server.error.useraction=\uc0dd\uc131\ub41c \uc624\ub958 \uba54\uc2dc\uc9c0\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc774 \uc624\ub958\uc758 \uc6d0\uc778\uc774 \ub418\ub294 \ubb38\uc81c\ub97c \uc2dd\ubcc4\ud558\uace0 \uc815\uc815\ud55c \ud6c4 \uc870\uc791\uc744 \ub2e4\uc2dc \uc2e4\ud589\ud569\ub2c8\ub2e4. + +filetransfer.client.bad.credentials=CWWKX7954E: \uc9c0\uc815\ub41c \uc0ac\uc6a9\uc790 \uc774\ub984\uc774\ub098 \ube44\ubc00\ubc88\ud638\uac00 \uc778\uc99d\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4. \uc11c\ubc84\uac00 {2} \uc5f0\uacb0\uc5d0 \ub300\ud574 {0} \ucf54\ub4dc \ubc0f "{1}" \uba54\uc2dc\uc9c0\ub85c \uc751\ub2f5\ud569\ub2c8\ub2e4. +filetransfer.client.bad.credentials.explanation=\uc5f0\uacb0\uc744 \uc5bb\uc744 \ub54c \uc81c\uacf5\ub41c \uc2e0\uc784 \uc815\ubcf4\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \uc0ac\uc6a9\uc790\uac00 \uc5c6\uac70\ub098 \uc11c\ubc84\uc5d0 \uc561\uc138\uc2a4\ud560 \uad8c\ud55c\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. \ub610\ub294 \ube44\ubc00\ubc88\ud638\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +filetransfer.client.bad.credentials.useraction=\uc0ac\uc6a9\uc790 \uc774\ub984 \ub610\ub294 \ube44\ubc00\ubc88\ud638\ub97c \uc815\uc815\ud55c \ub2e4\uc74c \uc0c8 \uc5f0\uacb0\uc744 \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +filetransfer.response.code.error=CWWKX7955E: \ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 {2} \uc5f0\uacb0\uc5d0 \ub300\ud574 "{1}" \uba54\uc2dc\uc9c0\uc640 \ud568\uaed8 {0} \uc751\ub2f5 \ucf54\ub4dc\ub97c \uc218\uc2e0\ud588\uc2b5\ub2c8\ub2e4. +filetransfer.response.code.error.explanation=\ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84\uc5d0\uc11c \uc608\uc0c1\uce58 \uc54a\uc740 \uc751\ub2f5 \ucf54\ub4dc\ub97c \uc218\uc2e0\ud588\uc2b5\ub2c8\ub2e4. +filetransfer.response.code.error.useraction=\ud074\ub77c\uc774\uc5b8\ud2b8 \uc751\ub2f5 \ucf54\ub4dc\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc774 \ubb38\uc81c\uc758 \uc6d0\uc778\uc744 \uc2dd\ubcc4\ud558\uace0 \ud574\uacb0\ud55c \ub2e4\uc74c \uc870\uc791\uc744 \ub2e4\uc2dc \uc2e4\ud589\ud569\ub2c8\ub2e4. + +filetransfer.download.file=CWWKX7956I: {0} \ud30c\uc77c \ub2e4\uc6b4\ub85c\ub4dc \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc73c\uba70 {2} \uc5f0\uacb0\uc744 \uc0ac\uc6a9\ud558\uc5ec \ud574\ub2f9 \ucee8\ud150\uce20\uac00 {1} \ud30c\uc77c\uc5d0 \uc791\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.download.file.explanation=\uc9c0\uc815\ub41c \ud30c\uc77c\uc758 \ub2e4\uc6b4\ub85c\ub4dc \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.download.file.useraction=\uc774\uac83\uc740 \uc815\ubcf4 \uba54\uc2dc\uc9c0\uc774\ubbc0\ub85c \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. + +filetransfer.unsupported.operation=CWWKX7957E: {1} \uc5f0\uacb0\uc5d0 \uc0ac\uc6a9\ud558\ub294 \ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0\uc11c ''{0}'' \uc870\uc791\uc774 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +filetransfer.unsupported.operation.explanation=\ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0\uc11c \uc9c0\uc815\ub41c \uc870\uc791\uc774 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +filetransfer.unsupported.operation.useraction=\ud30c\uc77c \uc804\uc1a1 \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0\uc11c \uc9c0\uc6d0\ub418\ub294 \uc870\uc791\uc744 \uc694\uccad\ud558\uc2ed\uc2dc\uc624. + +filetransfer.upload.file=CWWKX7958I: {0} \ud30c\uc77c \uc5c5\ub85c\ub4dc \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc73c\uba70 {2} \uc5f0\uacb0\uc744 \uc0ac\uc6a9\ud558\uc5ec \ud574\ub2f9 \ucee8\ud150\uce20\uac00 {1} \ud30c\uc77c\uc5d0 \uc791\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.upload.file.explanation=\uc9c0\uc815\ub41c \ud30c\uc77c\uc758 \uc5c5\ub85c\ub4dc \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.upload.file.useraction=\uc774\uac83\uc740 \uc815\ubcf4 \uba54\uc2dc\uc9c0\uc774\ubbc0\ub85c \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. + +filetransfer.delete.file=CWWKX7959I: {0} \ud30c\uc77c \uc0ad\uc81c \uc694\uccad\uc774 {1} \uc5f0\uacb0\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.delete.file.explanation=\uc9c0\uc815\ub41c \ud30c\uc77c\uc758 \uc0ad\uc81c \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.delete.file.useraction=\uc774\uac83\uc740 \uc815\ubcf4 \uba54\uc2dc\uc9c0\uc774\ubbc0\ub85c \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. + +filetransfer.delete.all=CWWKX7960I: {0} \ucf5c\ub809\uc158\uc5d0\uc11c \ubaa8\ub4e0 \ud30c\uc77c\uacfc \ud3f4\ub354\ub97c \uc0ad\uc81c\ud558\ub294 \uc694\uccad\uc774 {1} \uc5f0\uacb0\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc815\uc0c1\uc801\uc73c\ub85c \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.delete.all.explanation=\uc9c0\uc815\ub41c \ucf5c\ub809\uc158\uc5d0 \ub300\ud55c \uc0ad\uc81c \uc694\uccad\uc774 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +filetransfer.delete.all.useraction=\uc774\uac83\uc740 \uc815\ubcf4 \uba54\uc2dc\uc9c0\uc774\ubbc0\ub85c \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pl.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pl.nlsprops new file mode 100755 index 00000000000..77bb0becdc9 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pl.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Nowy klient przesy\u0142ania plik\u00f3w nawi\u0105za\u0142 po\u0142\u0105czenie o identyfikatorze {0}. +filetransfer.client.init.explanation=Nowy klient przesy\u0142ania plik\u00f3w nawi\u0105za\u0142 po\u0142\u0105czenie o okre\u015blonym identyfikatorze. +filetransfer.client.init.useraction=To jest komunikat informacyjny i nie jest wymagana \u017cadna czynno\u015b\u0107. + +filetransfer.client.error=CWWKX7952E: Wyst\u0105pi\u0142 komunikat o b\u0142\u0119dzie po stronie klienta {0} dla po\u0142\u0105czenia {1}. +filetransfer.client.error.explanation=Konektor JMX REST po stronie klienta napotka\u0142 b\u0142\u0105d i zosta\u0142 wygenerowany okre\u015blony komunikat. +filetransfer.client.error.useraction=U\u017cyj wygenerowanego komunikatu o b\u0142\u0119dzie, aby zidenytfikowa\u0107 i rozwi\u0105za\u0107 problem spowodowany b\u0142\u0119dem, a nast\u0119pnie uruchom ponownie operacj\u0119. + +filetransfer.server.error=CWWKX7953E: Wyst\u0105pi\u0142 komunikat o b\u0142\u0119dzie po stronie serwera ({0}) dla po\u0142\u0105czenia {1}. +filetransfer.server.error.explanation=Konektor JMX REST po stronie serwera napotka\u0142 b\u0142\u0105d i wygenerowa\u0142 podany komunikat. +filetransfer.server.error.useraction=U\u017cyj wygenerowanego komunikatu o b\u0142\u0119dzie, aby zidenytfikowa\u0107 i rozwi\u0105za\u0107 problem spowodowany b\u0142\u0119dem, a nast\u0119pnie uruchom ponownie operacj\u0119. + +filetransfer.client.bad.credentials=CWWKX7954E: Podana nazwa u\u017cytkownika lub has\u0142o nie zosta\u0142y autoryzowane. Serwer zwr\u00f3ci\u0142 kod {0} i komunikat \u201e{1}\u201d dla po\u0142\u0105czenia {2}. +filetransfer.client.bad.credentials.explanation=Referencje podane podczas nawi\u0105zywania po\u0142\u0105czenia s\u0105 niepoprawne. Prawdopodobnie u\u017cytkownik nie istnieje, nie ma uprawnie\u0144 niezb\u0119dnych do uzyskania dost\u0119pu do serwera lub has\u0142o jest niepoprawne. +filetransfer.client.bad.credentials.useraction=Popraw nazw\u0119 u\u017cytkownika lub has\u0142o, a nast\u0119pnie nawi\u0105\u017c nowe po\u0142\u0105czenie. + +filetransfer.response.code.error=CWWKX7955E: Klient przesy\u0142ania plik\u00f3w odebra\u0142 kod odpowiedzi {0} z komunikatem \u201e{1}\u201d dla po\u0142\u0105czenia {2}. +filetransfer.response.code.error.explanation=Klient przesy\u0142ania plik\u00f3w odebra\u0142 nieoczekiwany kod odpowiedzi z serwera. +filetransfer.response.code.error.useraction=U\u017cyj kodu odpowiedzi klienta, aby zidentyfikowa\u0107 i usun\u0105\u0107 przyczyn\u0119 problemu, a nast\u0119pnie uruchom ponownie operacj\u0119. + +filetransfer.download.file=CWWKX7956I: \u017b\u0105danie pobrania pliku {0} zosta\u0142o wykonane pomy\u015blnie, a jego zawarto\u015b\u0107 zosta\u0142a zapisana w pliku {1} przy u\u017cyciu po\u0142\u0105czenia {2}. +filetransfer.download.file.explanation=\u017b\u0105danie pobrania podanego pliku zako\u0144czy\u0142o si\u0119 powodzeniem. +filetransfer.download.file.useraction=To jest komunikat informacyjny i nie jest wymagana \u017cadna czynno\u015b\u0107. + +filetransfer.unsupported.operation=CWWKX7957E: Operacja {0} nie jest obs\u0142ugiwana przez klient przesy\u0142ania plik\u00f3w dla po\u0142\u0105czenia {1}. +filetransfer.unsupported.operation.explanation=Okre\u015blona operacja nie jest obs\u0142ugiwana przez klient przesy\u0142ania plik\u00f3w. +filetransfer.unsupported.operation.useraction=Za\u017c\u0105daj operacji, kt\u00f3ra jest obs\u0142ugiwana przez klient przesy\u0142ania plik\u00f3w. + +filetransfer.upload.file=CWWKX7958I: \u017b\u0105danie przes\u0142ania pliku {0} zosta\u0142o wykonane pomy\u015blnie, a jego zawarto\u015b\u0107 zosta\u0142a zapisana w pliku {1} przy u\u017cyciu po\u0142\u0105czenia {2}. +filetransfer.upload.file.explanation=\u017b\u0105danie przes\u0142ania podanego pliku zako\u0144czy\u0142o si\u0119 powodzeniem. +filetransfer.upload.file.useraction=To jest komunikat informacyjny i nie jest wymagana \u017cadna czynno\u015b\u0107. + +filetransfer.delete.file=CWWKX7959I: \u017b\u0105danie usuni\u0119cia pliku {0} zosta\u0142o wykonane pomy\u015blnie przy u\u017cyciu po\u0142\u0105czenia {1}. +filetransfer.delete.file.explanation=\u017b\u0105danie usuni\u0119cia podanego pliku zako\u0144czy\u0142o si\u0119 powodzeniem. +filetransfer.delete.file.useraction=To jest komunikat informacyjny i nie jest wymagana \u017cadna czynno\u015b\u0107. + +filetransfer.delete.all=CWWKX7960I: \u017b\u0105danie usuni\u0119cia wszystkich plik\u00f3w i folder\u00f3w z kolekcji {0} zosta\u0142o wykonane pomy\u015blnie przy u\u017cyciu po\u0142\u0105czenia {1}. +filetransfer.delete.all.explanation=\u017b\u0105danie usuni\u0119cia podanej kolekcji zako\u0144czy\u0142o si\u0119 powodzeniem. +filetransfer.delete.all.useraction=To jest komunikat informacyjny i nie jest wymagana \u017cadna czynno\u015b\u0107. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pt_BR.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pt_BR.nlsprops new file mode 100755 index 00000000000..09725d28561 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_pt_BR.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Um novo cliente de transfer\u00eancia de arquivos conectou-se ao identificador de conex\u00e3o {0}. +filetransfer.client.init.explanation=Um novo cliente de transfer\u00eancia de arquivos conectou-se ao identificador de conex\u00e3o especificado. +filetransfer.client.init.useraction=Esta \u00e9 uma mensagem informativa e nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. + +filetransfer.client.error=CWWKX7952E: Ocorreu uma mensagem de erro "{0}" do lado do cliente para a conex\u00e3o {1}. +filetransfer.client.error.explanation=O lado do cliente do conector JMX REST encontrou um erro e a mensagem especificada foi gerada. +filetransfer.client.error.useraction=Use a mensagem de erro gerada para identificar e corrigir o problema que causou esse erro e execute novamente a opera\u00e7\u00e3o. + +filetransfer.server.error=CWWKX7953E: Ocorreu uma mensagem de erro "{0}" do lado do servidor para a conex\u00e3o {1}. +filetransfer.server.error.explanation=O lado do servidor do conector JMX REST encontrou um erro e gerou a mensagem especificada. +filetransfer.server.error.useraction=Use a mensagem de erro gerada para identificar e corrigir o problema que causou esse erro e execute novamente a opera\u00e7\u00e3o. + +filetransfer.client.bad.credentials=CWWKX7954E: O nome de usu\u00e1rio ou a senha especificados n\u00e3o est\u00e3o autorizados. O servidor respondeu com o c\u00f3digo {0} e a mensagem "{1}" para a conex\u00e3o {2}. +filetransfer.client.bad.credentials.explanation=As credenciais fornecidas ao obter a conex\u00e3o s\u00e3o incorretas. O usu\u00e1rio pode n\u00e3o existir, n\u00e3o ter autoridade para acessar o servidor, ou a senha pode ser incorreta. +filetransfer.client.bad.credentials.useraction=Corrija o nome de usu\u00e1rio ou a senha e, em seguida, obtenha uma nova conex\u00e3o. + +filetransfer.response.code.error=CWWKX7955E: O cliente de transfer\u00eancia de arquivos recebeu o c\u00f3digo de resposta {0} com a mensagem "{1}" para a conex\u00e3o {2}. +filetransfer.response.code.error.explanation=O cliente de transfer\u00eancia de arquivos recebeu um c\u00f3digo de resposta inesperado do servidor. +filetransfer.response.code.error.useraction=Use o c\u00f3digo de resposta do cliente para identificar e resolver a causa desse problema e execute novamente a opera\u00e7\u00e3o. + +filetransfer.download.file=CWWKX7956I: A solicita\u00e7\u00e3o para fazer o download do arquivo {0} foi bem-sucedida e seu conte\u00fado foi gravado no arquivo {1} usando a conex\u00e3o {2}. +filetransfer.download.file.explanation=A solicita\u00e7\u00e3o de download do arquivo especificado obteve \u00eaxito. +filetransfer.download.file.useraction=Esta \u00e9 uma mensagem informativa e nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. + +filetransfer.unsupported.operation=CWWKX7957E: A opera\u00e7\u00e3o {0} n\u00e3o \u00e9 suportada pelo cliente de transfer\u00eancia de arquivos para a conex\u00e3o {1}. +filetransfer.unsupported.operation.explanation=A opera\u00e7\u00e3o especificada n\u00e3o \u00e9 suportada pelo cliente de transfer\u00eancia de arquivos. +filetransfer.unsupported.operation.useraction=Solicite uma opera\u00e7\u00e3o que seja suportada pelo cliente de transfer\u00eancia de arquivos. + +filetransfer.upload.file=CWWKX7958I: A solicita\u00e7\u00e3o para fazer o upload do arquivo {0} foi bem-sucedida e seu conte\u00fado foi gravado no arquivo {1} usando a conex\u00e3o {2}. +filetransfer.upload.file.explanation=A solicita\u00e7\u00e3o de upload do arquivo especificado obteve \u00eaxito. +filetransfer.upload.file.useraction=Esta \u00e9 uma mensagem informativa e nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. + +filetransfer.delete.file=CWWKX7959I: A solicita\u00e7\u00e3o para excluir o arquivo {0} foi bem-sucedida usando a conex\u00e3o {1}. +filetransfer.delete.file.explanation=A solicita\u00e7\u00e3o de exclus\u00e3o do arquivo especificado obteve \u00eaxito. +filetransfer.delete.file.useraction=Esta \u00e9 uma mensagem informativa e nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. + +filetransfer.delete.all=CWWKX7960I: A solicita\u00e7\u00e3o para excluir todos os arquivos e pastas da cole\u00e7\u00e3o {0} foi bem-sucedida usando a conex\u00e3o {1}. +filetransfer.delete.all.explanation=A solicita\u00e7\u00e3o de exclus\u00e3o da cole\u00e7\u00e3o especificada foi bem-sucedida. +filetransfer.delete.all.useraction=Esta \u00e9 uma mensagem informativa e nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ro.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ro.nlsprops new file mode 100755 index 00000000000..db396c86498 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ro.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: Un nou client de transfer de fi\u015fiere s-a conectat cu identificatorul de conexiune {0}. +filetransfer.client.init.explanation=Un nou client de transfer de fi\u015fiere s-a conectat cu identificatorul de conexiune specificat. +filetransfer.client.init.useraction=Acesta este un mesaj informa\u0163ional \u015fi nu este necesar\u0103 nici o ac\u0163iune. + +filetransfer.client.error=CWWKX7952E: A ap\u0103rut un mesaj de eroare pe partea de client "{0}" pentru conexiunea {1}. +filetransfer.client.error.explanation=Partea de client a conectorului JMX REST a \u00eent\u00e2lnit o eroare \u015fi s-a generat mesajul specificat. +filetransfer.client.error.useraction=Folosi\u0163i mesajul de eroare generat pentru a identifica \u015fi a corecta problema care a cauzat eroarea, apoi rula\u0163i din nou opera\u0163ia. + +filetransfer.server.error=CWWKX7953E: A ap\u0103rut un mesaj de eroare pe partea de server "{0}" pentru conexiunea {1}. +filetransfer.server.error.explanation=Partea de server a conectorului JMX REST a \u00eent\u00e2lnit o eroare \u015fi s-a generat mesajul specificat. +filetransfer.server.error.useraction=Folosi\u0163i mesajul de eroare generat pentru a identifica \u015fi a corecta problema care a cauzat eroarea, apoi rula\u0163i din nou opera\u0163ia. + +filetransfer.client.bad.credentials=CWWKX7954E: Numele de utilizator sau parola specificat(\u0103) nu este autorizat(\u0103). Serverul a r\u0103spuns cu codul {0} \u015fi mesajul "{1}" pentru conexiunea {2}. +filetransfer.client.bad.credentials.explanation=Acredit\u0103rile furnizate la ob\u0163inerea conexiunii sunt incorecte. Utilizatorul s-ar putea s\u0103 nu existe, s-ar putea s\u0103 nu aib\u0103 autoriza\u0163ia de accesare a serverului sau parola ar putea fi incorect\u0103. +filetransfer.client.bad.credentials.useraction=Corecta\u0163i numele utilizator sau parola, apoi ob\u0163ine\u0163i o nou\u0103 conexiune. + +filetransfer.response.code.error=CWWKX7955E: Clientul de transfer de fi\u015fiere a primi codul de r\u0103spuns {0} cu mesajul "{1}" pentru conexiunea {2}. +filetransfer.response.code.error.explanation=Clientul de transfer de fi\u015fiere a primit un cod de r\u0103spuns nea\u015fteptat de la server. +filetransfer.response.code.error.useraction=Folosi\u0163i codul de r\u0103spuns client pentru a identifica \u015fi a rezolva cauza acestei probleme, apoi rula\u0163i din nou opera\u0163ia. + +filetransfer.download.file=CWWKX7956I: Cererea de desc\u0103rcare a fi\u015fierului {0} a avt succes \u015fi con\u0163inutul s\u0103u a fost scris \u00een fi\u015fierul {1} folosind conexiunea {2}. +filetransfer.download.file.explanation=Cererea de desc\u0103rcare a fi\u015fierului specificat a avut succes. +filetransfer.download.file.useraction=Acesta este un mesaj informa\u0163ional \u015fi nu este necesar\u0103 nici o ac\u0163iune. + +filetransfer.unsupported.operation=CWWKX7957E: Opera\u0163ia {0} nu este suportat\u0103 de clientul de transfer de fi\u015fiere pentru conexiunea {1}. +filetransfer.unsupported.operation.explanation=Opera\u0163ia specificat\u0103 nu este suportat\u0103 de clientul de transfer de fi\u015fiere. +filetransfer.unsupported.operation.useraction=Cere\u0163i o opera\u0163ie care este suportat\u0103 de clientul de transfer de fi\u015fiere. + +filetransfer.upload.file=CWWKX7958I: Cererea de \u00eenc\u0103rcare a fi\u015fierului {0} a avut succes \u015fi con\u0163inutul s\u0103u a fost scris \u00een fi\u015fierul {1} folosind conexiunea {2}. +filetransfer.upload.file.explanation=Cererea de \u00eenc\u0103rcare a fi\u015fierului specificat a avut succes. +filetransfer.upload.file.useraction=Acesta este un mesaj informa\u0163ional \u015fi nu este necesar\u0103 nici o ac\u0163iune. + +filetransfer.delete.file=CWWKX7959I: Cererea de \u015ftergere a fi\u015fierului {0} a avut succes folosind conexiunea {1}. +filetransfer.delete.file.explanation=Cererea de \u015ftergere a fi\u015fierului specificat a avut succes. +filetransfer.delete.file.useraction=Acesta este un mesaj informa\u0163ional \u015fi nu este necesar\u0103 nici o ac\u0163iune. + +filetransfer.delete.all=CWWKX7960I: Cererea de \u015ftergere a tuturor fi\u015fierelor \u015fi folderelor din colec\u0163ia {0} a reu\u015fit prin utilizarea conexiunii {1}. +filetransfer.delete.all.explanation=Cererea de \u015ftergere a colec\u0163iei specificate a avut succes. +filetransfer.delete.all.useraction=Acesta este un mesaj informa\u0163ional \u015fi nu este necesar\u0103 nici o ac\u0163iune. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ru.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ru.nlsprops new file mode 100755 index 00000000000..6ddbb0cf18e --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_ru.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {0}. +filetransfer.client.init.explanation=\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. +filetransfer.client.init.useraction=\u042d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + +filetransfer.client.error=CWWKX7952E: \u041e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c "{0}" \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {1}. +filetransfer.client.error.explanation=\u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST JMX \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0438 \u0432\u044b\u0434\u0430\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. +filetransfer.client.error.useraction=\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0438 \u043f\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u0435 \u0435\u0435 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. + +filetransfer.server.error=CWWKX7953E: \u041e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c "{0}" \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {1}. +filetransfer.server.error.explanation=\u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST JMX \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. +filetransfer.server.error.useraction=\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0438 \u043f\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u0435 \u0435\u0435 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. + +filetransfer.client.bad.credentials=CWWKX7954E: \u0423\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044e \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0421\u0435\u0440\u0432\u0435\u0440 \u0432\u0435\u0440\u043d\u0443\u043b \u043a\u043e\u0434 {0} \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 "{1}" \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {2}. +filetransfer.client.bad.credentials.explanation=\u041f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u044b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0438\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043b \u043f\u0430\u0440\u043e\u043b\u044c. +filetransfer.client.bad.credentials.useraction=\u0418\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. + +filetransfer.response.code.error=CWWKX7955E: \u041a\u043b\u0438\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 {0} \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c "{1}" \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {2}. +filetransfer.response.code.error.explanation=\u041a\u043b\u0438\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0442\u0432\u0435\u0442 \u0441 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. +filetransfer.response.code.error.useraction=\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0438 \u043f\u043e \u043a\u043e\u0434\u0443 \u043e\u0442\u0432\u0435\u0442\u0430, \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u0435 \u0435\u0435 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. + +filetransfer.download.file=CWWKX7956I: \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 {0} \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d, \u0438 \u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0444\u0430\u0439\u043b {1} \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 {2}. +filetransfer.download.file.explanation=\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0431\u044b\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0443\u0441\u043f\u0435\u0448\u043d\u043e. +filetransfer.download.file.useraction=\u042d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + +filetransfer.unsupported.operation=CWWKX7957E: \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f {0} \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {1}. +filetransfer.unsupported.operation.explanation=\u0423\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432. +filetransfer.unsupported.operation.useraction=\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432. + +filetransfer.upload.file=CWWKX7958I: \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 {0} \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d, \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0444\u0430\u0439\u043b {1} \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 {2}. +filetransfer.upload.file.explanation=\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d. +filetransfer.upload.file.useraction=\u042d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + +filetransfer.delete.file=CWWKX7959I: \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 {0} \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 {1}. +filetransfer.delete.file.explanation=\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d. +filetransfer.delete.file.useraction=\u042d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + +filetransfer.delete.all=CWWKX7960I: \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043f\u0430\u043f\u043e\u043a \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 {0} \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f {1}. +filetransfer.delete.all.explanation=\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d. +filetransfer.delete.all.useraction=\u042d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh.nlsprops new file mode 100755 index 00000000000..6e14a160637 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \u5df2\u8fde\u63a5\u5176\u8fde\u63a5\u6807\u8bc6\u4e3a {0} \u7684\u65b0\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u3002 +filetransfer.client.init.explanation=\u5df2\u8fde\u63a5\u5e26\u6709\u6307\u5b9a\u8fde\u63a5\u6807\u8bc6\u7684\u65b0\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u3002 +filetransfer.client.init.useraction=\u8fd9\u662f\u4e00\u6761\u53c2\u8003\u6d88\u606f\uff0c\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 + +filetransfer.client.error=CWWKX7952E: \u8fde\u63a5 {1} \u51fa\u73b0\u4e86\u5ba2\u6237\u7aef\u9519\u8bef\u6d88\u606f\u201c{0}\u201d\u3002 +filetransfer.client.error.explanation=JMX REST \u8fde\u63a5\u5668\u7684\u5ba2\u6237\u7aef\u9047\u5230\u4e86\u9519\u8bef\uff0c\u751f\u6210\u4e86\u6307\u5b9a\u6d88\u606f\u3002 +filetransfer.client.error.useraction=\u8bf7\u4f7f\u7528\u751f\u6210\u7684\u9519\u8bef\u6d88\u606f\u6765\u6807\u8bc6\u6b64\u9519\u8bef\uff0c\u66f4\u6b63\u5bfc\u81f4\u6b64\u9519\u8bef\u7684\u95ee\u9898\u5e76\u91cd\u65b0\u8fd0\u884c\u8be5\u64cd\u4f5c\u3002 + +filetransfer.server.error=CWWKX7953E: \u8fde\u63a5 {1} \u51fa\u73b0\u4e86\u670d\u52a1\u5668\u7aef\u9519\u8bef\u6d88\u606f\u201c{0}\u201d\u3002 +filetransfer.server.error.explanation=JMX REST \u8fde\u63a5\u5668\u7684\u670d\u52a1\u5668\u7aef\u9047\u5230\u4e86\u9519\u8bef\uff0c\u5e76\u751f\u6210\u4e86\u6307\u5b9a\u6d88\u606f\u3002 +filetransfer.server.error.useraction=\u8bf7\u4f7f\u7528\u751f\u6210\u7684\u9519\u8bef\u6d88\u606f\u6765\u6807\u8bc6\u6b64\u9519\u8bef\uff0c\u66f4\u6b63\u5bfc\u81f4\u6b64\u9519\u8bef\u7684\u95ee\u9898\u5e76\u91cd\u65b0\u8fd0\u884c\u8be5\u64cd\u4f5c\u3002 + +filetransfer.client.bad.credentials=CWWKX7954E: \u6307\u5b9a\u7684\u7528\u6237\u540d\u6216\u5bc6\u7801\u672a\u88ab\u6388\u6743\u3002\u5bf9\u4e8e\u8fde\u63a5 {2}\uff0c\u670d\u52a1\u5668\u4ee5\u4ee3\u7801 {0} \u548c\u6d88\u606f\u201c{1}\u201d\u4f5c\u4e3a\u54cd\u5e94\u3002 +filetransfer.client.bad.credentials.explanation=\u83b7\u53d6\u8fde\u63a5\u65f6\u63d0\u4f9b\u7684\u51ed\u8bc1\u4e0d\u6b63\u786e\u3002\u7528\u6237\u53ef\u80fd\u4e0d\u5b58\u5728\u6216\u4e0d\u5177\u6709\u8bbf\u95ee\u670d\u52a1\u5668\u7684\u6743\u9650\uff0c\u6216\u8005\u5bc6\u7801\u53ef\u80fd\u4e0d\u6b63\u786e\u3002 +filetransfer.client.bad.credentials.useraction=\u66f4\u6b63\u7528\u6237\u540d\u6216\u5bc6\u7801\uff0c\u7136\u540e\u83b7\u53d6\u4e00\u4e2a\u65b0\u8fde\u63a5\u3002 + +filetransfer.response.code.error=CWWKX7955E: \u5bf9\u4e8e\u8fde\u63a5 {2}\uff0c\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u63a5\u6536\u5230\u5e26\u6709\u6d88\u606f\u201c{1}\u201d\u7684\u54cd\u5e94\u4ee3\u7801 {0}\u3002 +filetransfer.response.code.error.explanation=\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u4ece\u670d\u52a1\u5668\u63a5\u6536\u5230\u610f\u5916\u54cd\u5e94\u4ee3\u7801\u3002 +filetransfer.response.code.error.useraction=\u8bf7\u4f7f\u7528\u5ba2\u6237\u673a\u54cd\u5e94\u4ee3\u7801\u6765\u6807\u8bc6\u6b64\u95ee\u9898\u5e76\u89e3\u51b3\u5bfc\u81f4\u6b64\u95ee\u9898\u7684\u539f\u56e0\uff0c\u7136\u540e\u91cd\u65b0\u8fd0\u884c\u8be5\u64cd\u4f5c\u3002 + +filetransfer.download.file=CWWKX7956I: \u4e0b\u8f7d\u6587\u4ef6 {0} \u7684\u8bf7\u6c42\u5df2\u6210\u529f\uff0c\u5df2\u4f7f\u7528\u8fde\u63a5 {2} \u5c06\u5176\u5185\u5bb9\u5199\u5165\u6587\u4ef6 {1}\u3002 +filetransfer.download.file.explanation=\u6307\u5b9a\u6587\u4ef6\u7684\u4e0b\u8f7d\u8bf7\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.download.file.useraction=\u8fd9\u662f\u4e00\u6761\u53c2\u8003\u6d88\u606f\uff0c\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 + +filetransfer.unsupported.operation=CWWKX7957E: \u5bf9\u4e8e\u8fde\u63a5 {1}\uff0c\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u4e0d\u652f\u6301\u64cd\u4f5c {0}\u3002 +filetransfer.unsupported.operation.explanation=\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u4e0d\u652f\u6301\u6307\u5b9a\u64cd\u4f5c\u3002 +filetransfer.unsupported.operation.useraction=\u8bf7\u8bf7\u6c42\u6587\u4ef6\u4f20\u8f93\u5ba2\u6237\u673a\u652f\u6301\u7684\u64cd\u4f5c\u3002 + +filetransfer.upload.file=CWWKX7958I: \u4e0a\u8f7d\u6587\u4ef6 {0} \u7684\u8bf7\u6c42\u5df2\u6210\u529f\uff0c\u5df2\u4f7f\u7528\u8fde\u63a5 {2} \u5c06\u5176\u5185\u5bb9\u5199\u5165\u6587\u4ef6 {1}\u3002 +filetransfer.upload.file.explanation=\u6307\u5b9a\u6587\u4ef6\u7684\u4e0a\u8f7d\u8bf7\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.upload.file.useraction=\u8fd9\u662f\u4e00\u6761\u53c2\u8003\u6d88\u606f\uff0c\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 + +filetransfer.delete.file=CWWKX7959I: \u5df2\u6210\u529f\u4f7f\u7528\u8fde\u63a5 {1} \u6267\u884c\u5220\u9664\u6587\u4ef6 {0} \u7684\u8bf7\u6c42\u3002 +filetransfer.delete.file.explanation=\u6307\u5b9a\u6587\u4ef6\u7684\u5220\u9664\u8bf7\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.delete.file.useraction=\u8fd9\u662f\u4e00\u6761\u53c2\u8003\u6d88\u606f\uff0c\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 + +filetransfer.delete.all=CWWKX7960I: \u5df2\u6210\u529f\u4f7f\u7528\u8fde\u63a5 {1} \u6267\u884c\u5220\u9664\u96c6\u5408 {0} \u4e2d\u6240\u6709\u6587\u4ef6\u548c\u6587\u4ef6\u5939\u7684\u8bf7\u6c42\u3002 +filetransfer.delete.all.explanation=\u6307\u5b9a\u96c6\u5408\u7684\u5220\u9664\u8bf7\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.delete.all.useraction=\u8fd9\u662f\u4e00\u6761\u53c2\u8003\u6d88\u606f\uff0c\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh_TW.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh_TW.nlsprops new file mode 100755 index 00000000000..feb4fc13064 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages_zh_TW.nlsprops @@ -0,0 +1,55 @@ +# IBM Confidential OCO Source Material +# (C) COPYRIGHT International Business Machines Corp. 2011, 2014. +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# ------------------------------------------------------------------------------------------------- +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessages.nlsprops +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR WebSphere Management File Transfer Client +#ISMESSAGEFILE TRUE +#NLS_MESSAGEFORMAT_VAR +#NLS_ENCODING=UNICODE +# ------------------------------------------------------------------------------------------------- + +# Message prefix block: CWWKX7951 - CWWKX7999 + +filetransfer.client.init=CWWKX7951I: \u65b0\u7684\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u5df2\u5229\u7528\u9023\u7dda ID {0} \u9032\u884c\u9023\u7dda\u3002 +filetransfer.client.init.explanation=\u65b0\u7684\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u5df2\u5229\u7528\u6307\u5b9a\u7684\u9023\u7dda ID \u9032\u884c\u9023\u7dda\u3002 +filetransfer.client.init.useraction=\u9019\u662f\u4e00\u5247\u53c3\u8003\u8a0a\u606f\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u52d5\u4f5c\u3002 + +filetransfer.client.error=CWWKX7952E: {1} \u9023\u7dda\u51fa\u73fe\u7528\u6236\u7aef\u932f\u8aa4\u8a0a\u606f "{0}"\u3002 +filetransfer.client.error.explanation=JMX REST \u9023\u63a5\u5668\u7684\u7528\u6236\u7aef\u767c\u73fe\u932f\u8aa4\uff0c\u7522\u751f\u6307\u5b9a\u7684\u8a0a\u606f\u3002 +filetransfer.client.error.useraction=\u8acb\u5229\u7528\u7522\u751f\u7684\u932f\u8aa4\u8a0a\u606f\u4f86\u8b58\u5225\u53ca\u66f4\u6b63\u9020\u6210\u9019\u500b\u932f\u8aa4\u7684\u554f\u984c\uff0c\u7136\u5f8c\u91cd\u65b0\u57f7\u884c\u4f5c\u696d\u3002 + +filetransfer.server.error=CWWKX7953E: {1} \u9023\u7dda\u51fa\u73fe\u4f3a\u670d\u5668\u7aef\u932f\u8aa4\u8a0a\u606f "{0}"\u3002 +filetransfer.server.error.explanation=JMX REST \u9023\u63a5\u5668\u7684\u4f3a\u670d\u5668\u7aef\u767c\u73fe\u932f\u8aa4\uff0c\u7522\u751f\u6307\u5b9a\u7684\u8a0a\u606f\u3002 +filetransfer.server.error.useraction=\u8acb\u5229\u7528\u7522\u751f\u7684\u932f\u8aa4\u8a0a\u606f\u4f86\u8b58\u5225\u53ca\u66f4\u6b63\u9020\u6210\u9019\u500b\u932f\u8aa4\u7684\u554f\u984c\uff0c\u7136\u5f8c\u91cd\u65b0\u57f7\u884c\u4f5c\u696d\u3002 + +filetransfer.client.bad.credentials=CWWKX7954E: \u6307\u5b9a\u7684\u4f7f\u7528\u8005\u540d\u7a31\u6216\u5bc6\u78bc\u672a\u7372\u6388\u6b0a\u3002\u4f3a\u670d\u5668\u91dd\u5c0d {2} \u9023\u7dda\u7684\u56de\u61c9\u78bc\u662f {0}\uff0c\u8a0a\u606f\u662f {1}\u3002 +filetransfer.client.bad.credentials.explanation=\u5728\u53d6\u5f97\u9023\u7dda\u6642\u6240\u63d0\u4f9b\u7684\u8a8d\u8b49\u4e0d\u6b63\u78ba\u3002\u53ef\u80fd\u662f\u4f7f\u7528\u8005\u4e0d\u5b58\u5728\u3001\u4e0d\u5177\u5099\u5b58\u53d6\u4f3a\u670d\u5668\u7684\u6b0a\u9650\uff0c\u6216\u8005\u5bc6\u78bc\u4e0d\u6b63\u78ba\u3002 +filetransfer.client.bad.credentials.useraction=\u8acb\u66f4\u6b63\u4f7f\u7528\u8005\u540d\u7a31\u6216\u5bc6\u78bc\uff0c\u7136\u5f8c\u53d6\u5f97\u65b0\u9023\u7dda\u3002 + +filetransfer.response.code.error=CWWKX7955E: \u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u91dd\u5c0d {2} \u9023\u7dda\u6536\u5230\u542b\u6709 {1} \u8a0a\u606f\u7684\u56de\u61c9\u78bc {0}\u3002 +filetransfer.response.code.error.explanation=\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u5f9e\u4f3a\u670d\u5668\u63a5\u6536\u5230\u975e\u9810\u671f\u7684\u56de\u61c9\u78bc\u3002 +filetransfer.response.code.error.useraction=\u8acb\u5229\u7528\u7528\u6236\u7aef\u56de\u61c9\u7a0b\u5f0f\u78bc\u4f86\u8b58\u5225\u53ca\u89e3\u6c7a\u9019\u500b\u554f\u984c\u7684\u539f\u56e0\uff0c\u7136\u5f8c\u91cd\u65b0\u57f7\u884c\u4f5c\u696d\u3002 + +filetransfer.download.file=CWWKX7956I: \u4e0b\u8f09 {0} \u6a94\u7684\u8981\u6c42\u5df2\u9806\u5229\u5b8c\u6210\uff0c\u5df2\u5229\u7528 {2} \u9023\u7dda\u5c07\u5176\u5167\u5bb9\u5beb\u5165 {1} \u6a94\u4e2d\u3002 +filetransfer.download.file.explanation=\u4e0b\u8f09\u6307\u5b9a\u6a94\u6848\u7684\u8981\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.download.file.useraction=\u9019\u662f\u4e00\u5247\u53c3\u8003\u8a0a\u606f\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u52d5\u4f5c\u3002 + +filetransfer.unsupported.operation=CWWKX7957E: {1} \u9023\u7dda\u7684\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u4e0d\u652f\u63f4 {0} \u4f5c\u696d\u3002 +filetransfer.unsupported.operation.explanation=\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u4e0d\u652f\u63f4\u6307\u5b9a\u7684\u4f5c\u696d\u3002 +filetransfer.unsupported.operation.useraction=\u8acb\u8981\u6c42\u6a94\u6848\u50b3\u9001\u7528\u6236\u7aef\u652f\u63f4\u7684\u4f5c\u696d\u3002 + +filetransfer.upload.file=CWWKX7958I: \u4e0a\u50b3 {0} \u6a94\u7684\u8981\u6c42\u5df2\u9806\u5229\u5b8c\u6210\uff0c\u5df2\u5229\u7528 {2} \u9023\u7dda\u5c07\u5176\u5167\u5bb9\u5beb\u5165 {1} \u6a94\u4e2d\u3002 +filetransfer.upload.file.explanation=\u4e0a\u50b3\u6307\u5b9a\u6a94\u6848\u7684\u8981\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.upload.file.useraction=\u9019\u662f\u4e00\u5247\u53c3\u8003\u8a0a\u606f\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u52d5\u4f5c\u3002 + +filetransfer.delete.file=CWWKX7959I: \u5df2\u5229\u7528 {1} \u9023\u7dda\u9806\u5229\u5b8c\u6210\u522a\u9664 {0} \u6a94\u7684\u8981\u6c42\u3002 +filetransfer.delete.file.explanation=\u522a\u9664\u6307\u5b9a\u6a94\u6848\u7684\u8981\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.delete.file.useraction=\u9019\u662f\u4e00\u5247\u53c3\u8003\u8a0a\u606f\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u52d5\u4f5c\u3002 + +filetransfer.delete.all=CWWKX7960I: \u5f9e\u96c6\u5408 {0} \u522a\u9664\u6240\u6709\u6a94\u6848\u548c\u8cc7\u6599\u593e\u7684\u8981\u6c42\u5df2\u4f7f\u7528 {1} \u9023\u7dda\u9806\u5229\u5b8c\u6210\u3002 +filetransfer.delete.all.explanation=\u522a\u9664\u6307\u5b9a\u96c6\u5408\u7684\u8981\u6c42\u5df2\u6210\u529f\u3002 +filetransfer.delete.all.useraction=\u9019\u662f\u4e00\u5247\u53c3\u8003\u8a0a\u606f\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u52d5\u4f5c\u3002 diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops new file mode 100755 index 00000000000..88b290eb885 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: The WebSphere Java Management Extensions REST client encountered an error while preparing the request to the server for URL {0} on connection {1} +jmx.rest.client.request.error.explanation=The WebSphere Java Management Extensions REST client encountered an error while preparing a request for the server +jmx.rest.client.request.error.useraction=Examine the server logs for further information. + +jmx.rest.client.response.error=CWWKX0202E: The WebSphere Java Management Extensions REST client was unable to process the response from the server for URL {0} on connection {1} +jmx.rest.client.response.error.explanation=The WebSphere Java Management Extensions REST client was unable to process a response from the server +jmx.rest.client.response.error.useraction=Examine the server logs for further information. + +jmx.rest.client.response.code.error=CWWKX0203E: The WebSphere Java Management Extensions REST client received an unexpected response code {0} with message ''{1}'' from the server for URL {2} on connection {3} +jmx.rest.client.response.code.error.explanation=The WebSphere Java Management Extensions REST client received an unexpected response code from the server +jmx.rest.client.response.code.error.useraction=Examine the server logs for further information. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Unable to parse Throwable from server error stream. +jmx.rest.client.server.throwable.exception.explanation=The server raised an exception handling the client request, but the client could not parse a Throwable object from the server error stream. The class of the Throwable object may not be available to the client. +jmx.rest.client.server.throwable.exception.useraction=Examine the server logs for further information. + +jmx.rest.client.not.connected=CWWKX0206E: The client is not connected to the server. +jmx.rest.client.not.connected.explanation=The connection to the server or was closed or has failed. +jmx.rest.client.not.connected.useraction=Check that the REST connector feature is enabled on the server and obtain a new connection to the server. + +jmx.rest.client.url.not.found=CWWKX0207E: The server reported that the URL requested by the client was not found. +jmx.rest.client.url.not.found.explanation=The client may have out-of-date information or the REST connector feature on the server may have been disabled. +jmx.rest.client.url.not.found.useraction=Check that the REST connector feature is enabled on the server and obtain a new connection to the server. + +jmx.rest.client.class.name.null=CWWKX0208E: The class name argument was null. +jmx.rest.client.class.name.null.explanation=The class name argument must not be null. +jmx.rest.client.class.name.null.useraction=Provide a non-null class name when calling the method. + +jmx.rest.client.attribute.name.null=CWWKX0209E: The attribute name argument was null. +jmx.rest.client.attribute.name.null.explanation=The attribute name argument must not be null. +jmx.rest.client.attribute.name.null.useraction=Provide a non-null attribute name when calling the method. + +jmx.rest.client.attribute.names.null=CWWKX0210E: The argument containing an array of attribute names was null. +jmx.rest.client.attribute.names.null.explanation=The argument containing an array of attribute names must not be null. +jmx.rest.client.attribute.names.null.useraction=Provide a non-null array of attribute names when calling the method. + +jmx.rest.client.attribute.null=CWWKX0211E: The Attribute argument was null. +jmx.rest.client.attribute.null.explanation=The Attribute argument must not be null. +jmx.rest.client.attribute.null.useraction=Provide a non-null Attribute when calling the method. + +jmx.rest.client.attribute.list.null=CWWKX0212E: The AttributeList argument was null. +jmx.rest.client.attribute.list.null.explanation=The AttributeList argument must not be null. +jmx.rest.client.attribute.list.null.useraction=Provide a non-null AttributeList when calling the method. + +jmx.rest.client.object.name.null=CWWKX0213E: The ObjectName argument was null. +jmx.rest.client.object.name.null.explanation=The ObjectName argument must not be null. +jmx.rest.client.object.name.null.useraction=Provide a non-null ObjectName when calling the method. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: An unexpected Throwable object was returned from the server. +jmx.rest.client.unexpected.server.throwable.explanation=The exception wraps a Throwable object returned from the server that is not normally expected for this operation. +jmx.rest.client.unexpected.server.throwable.useraction=Examine the server logs for further information. + +jmx.rest.client.bad.credentials=CWWKX0215E: There was a problem with the user name or password provided. The server responded with code {0} and message ''{1}'' +jmx.rest.client.bad.credentials.explanation=The credentials provided when obtaining the connection were incorrect. The user may not exist or may not have authority to access the server, or the password may be incorrect. +jmx.rest.client.bad.credentials.useraction=Correct the user name or password, then obtain a new connection. + +jmx.rest.client.object.name.pattern=CWWKX0216E: The ObjectName argument ''{0}'' is a pattern." +jmx.rest.client.object.name.pattern.explanation=The ObjectName argument is a pattern but the method requires an ObjectName matching exactly one MBean. +jmx.rest.client.object.name.pattern.useraction=Provide an ObjectName argument without wildcards that will match exactly one MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: No MBean is currently registered with the given ObjectName ''{0}'' +jmx.rest.client.instance.not.found.explanation=The operation requires a registered MBean, but no MBean with the given ObjectName was registered. +jmx.rest.client.instance.not.found.useraction=Ensure the MBean is registered before attempting to perform management operations on it. + +jmx.rest.client.attribute.not.found=CWWKX0218E: The MBean ''{0}'' does not have an attribute by the name ''{1}'' +jmx.rest.client.attribute.not.found.explanation=The MBean does not provide an attribute of the given name. +jmx.rest.client.attribute.not.found.useraction=Obtain the MBean information to confirm which attributes the MBean provides. + +jmx.rest.client.operation.not.found=CWWKX0219E: The MBean ''{0}'' does not have an operation by the name ''{1}'' +jmx.rest.client.operation.not.found.explanation=The MBean does not provide an operation of the given name. +jmx.rest.client.operation.not.found.useraction=Obtain the MBean information to confirm which operations the MBean provides. + +jmx.rest.client.listener.not.found=CWWKX0220E: The given NotificationListener is not currently registered to receive notifications from MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=The NotificationListener was not added or has already been removed and is not currently registered to receive notifications from the given MBean. +jmx.rest.client.listener.not.found.useraction=Make sure the calling code tracks which NotificationListeners have been added and removed or catch and handle the exception. + +jmx.rest.client.notification.lost=CWWKX0221I: The notification could not be delivered. +jmx.rest.client.notification.lost.explanation=A notification could not be delivered to one or more NotificationListeners because a registered NotificationListener was not found or there was an exception during delivery of the notification. +jmx.rest.client.notification.lost.useraction=If the notification should have been delivered to a registered NotificationListener, check the logs for exceptions. + +jmx.rest.client.connection.failed=CWWKX0222I: The connection to the server has failed. +jmx.rest.client.connection.failed.explanation=The server became unavailable and did not become available again within the configured maximum time allowable. +jmx.rest.client.connection.failed.useraction=Check the network connection and ensure that the server is running with the REST connector feature enabled. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: The connection to the server has been temporarily lost. +jmx.rest.client.connection.temporarily.lost.explanation=The server has become unavailable, but the client will attempt to restore the connection for the duration of the configured maximum time allowable. +jmx.rest.client.connection.temporarily.lost.useraction=If the server is intentionally restarting, no action is required. Otherwise, check the network connection and ensure that the server is running with the REST connector feature enabled. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: The connection was restored but exceptions were encountered when adding NotificationListeners. +jmx.rest.client.connection.restored.with.exceptions.explanation=The connection to the server was temporarily lost but has been restored successfully. Exceptions were encountered while adding NotificationListeners, so some notifications may not be received. +jmx.rest.client.connection.restored.with.exceptions.useraction=Check the exceptions included with the notification and re-register NotificationListeners after correcting the problems. + +jmx.rest.client.connection.restored=CWWKX0225I: The connection was restored successfully. +jmx.rest.client.connection.restored.explanation=The connection to the server was temporarily lost but has been restored successfully. Any registered NotificationListeners will continue to receive notifications. +jmx.rest.client.connection.restored.useraction=None + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: The parameter of type JMXServiceURL cannot be null. +jmx.rest.client.connection.illegal.argument.explanation=The value for the parameter 'serviceURL' cannot be null. +jmx.rest.client.connection.illegal.argument.useraction=Re-connect to the JMX REST Connector using a non-null JMXServiceURL value. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: The following is not a valid endpoint value: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=The specified endpoint value is not valid. +jmx.rest.client.connection.invalid.endpoint.useraction=Re-connect to the JMX REST Connector using a valid endpoint value that is of type String and has the format "host:port". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Could not find any available endpoints to initialize the connector. +jmx.rest.client.connection.no.endpoints.explanation=None of the specified endpoints were available during the JMX REST Connector's initialization. +jmx.rest.client.connection.no.endpoints.useraction=Re-connect to the JMX REST Connector using at least 1 available endpoint. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: There was a problem with the user credentials provided. The server responded with code {0} and message ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=The credentials provided are incorrect, expired, incomplete, or denied authorization. +jmx.rest.client.bad.user.credentials.useraction=Verify that the user credentials have correct authentication and authorization, then obtain a new connection. + +jmx.rest.client.connection.connect=CWWKX0230I: The collective member opened JMX client to the collective controller: {0} +jmx.rest.client.connection.connect.explanation=The member connected to the controller. +jmx.rest.client.connection.connect.useraction=No action required. + +jmx.rest.client.connection.disconnect=CWWKX0231I: The collective member closed JMX client from the collective controller: {0} +jmx.rest.client.connection.disconnect.explanation=The member disconnected from the controller. +jmx.rest.client.connection.disconnect.useraction=No action required. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_cs.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_cs.nlsprops new file mode 100755 index 00000000000..53a93c9de66 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_cs.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Klient REST WebSphere Java Management Extensions zjistil chybu p\u0159i p\u0159\u00edprav\u011b po\u017eadavku na server pro adresu URL {0} na p\u0159ipojen\u00ed {1} +jmx.rest.client.request.error.explanation=Klient REST WebSphere Java Management Extensions zjistil chybu p\u0159i p\u0159\u00edprav\u011b po\u017eadavku na server +jmx.rest.client.request.error.useraction=Zkontrolujte protokoly serveru, zda neobsahuj\u00ed dal\u0161\u00ed informace. + +jmx.rest.client.response.error=CWWKX0202E: Klientovi REST WebSphere Java Management Extensions se nezda\u0159ilo zpracovat odezvu ze serveru pro adresu URL {0} na p\u0159ipojen\u00ed {1} +jmx.rest.client.response.error.explanation=Klientovi REST WebSphere Java Management Extensions se nezda\u0159ilo zpracovat odezvu ze serveru +jmx.rest.client.response.error.useraction=Zkontrolujte protokoly serveru, zda neobsahuj\u00ed dal\u0161\u00ed informace. + +jmx.rest.client.response.code.error=CWWKX0203E: Klient REST WebSphere Java Management Extensions p\u0159ijal od serveru pro adresu URL {2} na p\u0159ipojen\u00ed {3} neo\u010dek\u00e1van\u00fd k\u00f3d odezvy {0} se zpr\u00e1vou ''{1}'' +jmx.rest.client.response.code.error.explanation=Klient REST WebSphere Java Management Extensions p\u0159ijal od serveru neo\u010dek\u00e1van\u00fd k\u00f3d odezvy +jmx.rest.client.response.code.error.useraction=Zkontrolujte protokoly serveru, zda neobsahuj\u00ed dal\u0161\u00ed informace. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Nelze analyzovat objekt Throwable z proudu chyb serveru. +jmx.rest.client.server.throwable.exception.explanation=Server vr\u00e1til v\u00fdjimku p\u0159i zpracov\u00e1n\u00ed \u017e\u00e1dosti klienta, ale klient nedok\u00e1zat analyzovat objekt Throwable z proudu chyb serveru. Mo\u017en\u00e1 nen\u00ed t\u0159\u00edda objekt\u016f Throwable pro klienta dostupn\u00e1. +jmx.rest.client.server.throwable.exception.useraction=Zkontrolujte protokoly serveru, zda neobsahuj\u00ed dal\u0161\u00ed informace. + +jmx.rest.client.not.connected=CWWKX0206E: Klient nen\u00ed p\u0159ipojen k serveru. +jmx.rest.client.not.connected.explanation=P\u0159ipojen\u00ed k serveru bylo uzav\u0159eno nebo se nezda\u0159ilo. +jmx.rest.client.not.connected.useraction=Zkontrolujte, zda je na serveru povolena funkce konektoru REST, a z\u00edskejte nov\u00e9 p\u0159ipojen\u00ed k serveru. + +jmx.rest.client.url.not.found=CWWKX0207E: Server ohl\u00e1sil, \u017ee adresa URL, kterou klient po\u017eaduje, nebyla nalezena. +jmx.rest.client.url.not.found.explanation=Mo\u017en\u00e1 m\u00e1 klient zastaral\u00e9 informace nebo m\u016f\u017ee b\u00fdt na serveru zak\u00e1z\u00e1na funkce konektoru REST. +jmx.rest.client.url.not.found.useraction=Zkontrolujte, zda je na serveru povolena funkce konektoru REST, a z\u00edskejte nov\u00e9 p\u0159ipojen\u00ed k serveru. + +jmx.rest.client.class.name.null=CWWKX0208E: Argument n\u00e1zev t\u0159\u00eddy m\u011bl hodnotu null. +jmx.rest.client.class.name.null.explanation=Argument n\u00e1zev t\u0159\u00eddy nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.class.name.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte n\u00e1zev t\u0159\u00eddy s jinou hodnotou ne\u017e null. + +jmx.rest.client.attribute.name.null=CWWKX0209E: Argument n\u00e1zev atributu m\u011bl hodnotu null. +jmx.rest.client.attribute.name.null.explanation=Argument n\u00e1zev atributu nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.attribute.name.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte n\u00e1zev atributu s jinou hodnotou ne\u017e null. + +jmx.rest.client.attribute.names.null=CWWKX0210E: Argument obsahuj\u00edc\u00ed pole s n\u00e1zvy atribut\u016f m\u011bl hodnotu null. +jmx.rest.client.attribute.names.null.explanation=Argument obsahuj\u00edc\u00ed pole s n\u00e1zvy atribut\u016f nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.attribute.names.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte pole s n\u00e1zvy atribut\u016f s jinou hodnotou ne\u017e null. + +jmx.rest.client.attribute.null=CWWKX0211E: Argument Attribute m\u011bl hodnotu null. +jmx.rest.client.attribute.null.explanation=Argument Attribute nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.attribute.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte argument Attribute s jinou hodnotou ne\u017e null. + +jmx.rest.client.attribute.list.null=CWWKX0212E: Argument AttributeList m\u011bl hodnotu null. +jmx.rest.client.attribute.list.null.explanation=Argument AttributeList nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.attribute.list.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte argument AttributeList s jinou hodnotou ne\u017e null. + +jmx.rest.client.object.name.null=CWWKX0213E: Argument ObjectName m\u011bl hodnotu null. +jmx.rest.client.object.name.null.explanation=Argument ObjectName nesm\u00ed m\u00edt hodnotu null. +jmx.rest.client.object.name.null.useraction=P\u0159i vol\u00e1n\u00ed t\u00e9to metody zadejte argument ObjectName s jinou hodnotou ne\u017e null. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Ze serveru se vr\u00e1til neo\u010dek\u00e1van\u00fd objekt Throwable. +jmx.rest.client.unexpected.server.throwable.explanation=Ve v\u00fdjimce je zabalen objekt Throwable vr\u00e1cen\u00fd ze serveru, kter\u00fd u t\u00e9to operace obvykle nen\u00ed o\u010dek\u00e1v\u00e1n. +jmx.rest.client.unexpected.server.throwable.useraction=Zkontrolujte protokoly serveru, zda neobsahuj\u00ed dal\u0161\u00ed informace. + +jmx.rest.client.bad.credentials=CWWKX0215E: Do\u0161lo k probl\u00e9mu se zadan\u00fdm jm\u00e9nem u\u017eivatele nebo heslem. Server odpov\u011bd\u011bl k\u00f3dem {0} a zpr\u00e1vou ''{1}''. +jmx.rest.client.bad.credentials.explanation=Pov\u011b\u0159en\u00ed uveden\u00e1 p\u0159i z\u00edsk\u00e1v\u00e1n\u00ed p\u0159ipojen\u00ed byla chybn\u00e1. Mo\u017en\u00e1 u\u017eivatel neexistuje, nem\u00e1 opr\u00e1vn\u011bn\u00ed pro p\u0159\u00edstup k serveru nebo je \u0161patn\u00e9 heslo. +jmx.rest.client.bad.credentials.useraction=Opravte jm\u00e9no u\u017eivatele nebo heslo a pot\u00e9 z\u00edskejte nov\u00e9 p\u0159ipojen\u00ed. + +jmx.rest.client.object.name.pattern=CWWKX0216E: Argument ObjectName ''{0}'' je vzor." +jmx.rest.client.object.name.pattern.explanation=Argument ObjectName je vzor, ale tato metoda vy\u017eaduje ObjectName odpov\u00eddaj\u00edc\u00ed pr\u00e1v\u011b jednomu objektu typu MBean. +jmx.rest.client.object.name.pattern.useraction=Zadejte argument ObjectName bez z\u00e1stupn\u00fdch znak\u016f, kter\u00fd odpov\u00edd\u00e1 pr\u00e1v\u011b jednomu objektu typu MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Aktu\u00e1ln\u011b nen\u00ed registrovan\u00fd \u017e\u00e1dn\u00fd objekt typu MBean s dan\u00fdm atributem ObjectName ''{0}''. +jmx.rest.client.instance.not.found.explanation=Operace vy\u017eaduje registrovan\u00fd objekt typu MBean, ale \u017e\u00e1dn\u00fd objekt typu MBean s uveden\u00fdm atributem ObjectName nebyl zaregistrov\u00e1n. +jmx.rest.client.instance.not.found.useraction=Ne\u017e se pokus\u00edte prov\u00e1d\u011bt na objektu typu MBean operace spr\u00e1vy, zajist\u011bte, aby byl zaregistrovan\u00fd. + +jmx.rest.client.attribute.not.found=CWWKX0218E: Objekt typu MBean ''{0}'' nem\u00e1 atribut s n\u00e1zvem ''{1}''. +jmx.rest.client.attribute.not.found.explanation=Objekt typu MBean nem\u00e1 atribut s dan\u00fdm n\u00e1zvem. +jmx.rest.client.attribute.not.found.useraction=Z\u00edskejte informace o objektu typu MBean a ov\u011b\u0159te, jak\u00e9 atributy tento objekt typu MBean m\u00e1. + +jmx.rest.client.operation.not.found=CWWKX0219E: Objekt typu MBean ''{0}'' nem\u00e1 operaci s n\u00e1zvem ''{1}''. +jmx.rest.client.operation.not.found.explanation=Objekt typu MBean nem\u00e1 operaci s dan\u00fdm n\u00e1zvem. +jmx.rest.client.operation.not.found.useraction=Z\u00edskejte informace o objektu typu MBean a ov\u011b\u0159te, jak\u00e9 operace tento objekt typu MBean m\u00e1. + +jmx.rest.client.listener.not.found=CWWKX0220E: Dan\u00fd modul NotificationListener nen\u00ed v sou\u010dasn\u00e9 dob\u011b registrovan\u00fd pro p\u0159\u00edjem ozn\u00e1men\u00ed z objektu typu MBean ''{0}''. +jmx.rest.client.listener.not.found.explanation=Modul NotificationListener nebyl p\u0159id\u00e1n nebo ji\u017e byl odebr\u00e1n a v sou\u010dasnosti nen\u00ed registrov\u00e1n pro p\u0159\u00edjem ozn\u00e1men\u00ed z dan\u00e9ho objektu typu MBean. +jmx.rest.client.listener.not.found.useraction=Ujist\u011bte se, \u017ee k\u00f3d vol\u00e1n\u00ed sleduje, kter\u00e9 moduly NotificationListener byly p\u0159id\u00e1ny a odebr\u00e1ny, nebo tuto v\u00fdjimku zachy\u0165te a o\u0161et\u0159ete. + +jmx.rest.client.notification.lost=CWWKX0221I: Ozn\u00e1men\u00ed nebylo mo\u017en\u00e9 doru\u010dit. +jmx.rest.client.notification.lost.explanation=Nebylo mo\u017en\u00e9 doru\u010dit ozn\u00e1men\u00ed nejm\u00e9n\u011b jednomu modulu NotificationListener, proto\u017ee nebyl nalezen registrovan\u00fd modul NotificationListener nebo p\u0159i doru\u010dov\u00e1n\u00ed ozn\u00e1men\u00ed do\u0161lo k v\u00fdjimce. +jmx.rest.client.notification.lost.useraction=Pokud m\u011blo b\u00fdt ozn\u00e1men\u00ed doru\u010deno registrovan\u00e9mu modulu NotificationListener, zkontrolujte, zda protokoly neobsahuj\u00ed v\u00fdjimky. + +jmx.rest.client.connection.failed=CWWKX0222I: P\u0159ipojen\u00ed k serveru se nezda\u0159ilo. +jmx.rest.client.connection.failed.explanation=Server se stal nedostupn\u00fdm a v nakonfigurovan\u00e9m maxim\u00e1ln\u00edm povolen\u00e9m \u010dase nebyl znovu dostupn\u00fd. +jmx.rest.client.connection.failed.useraction=Zkontrolujte s\u00ed\u0165ov\u00e9 p\u0159ipojen\u00ed a ujist\u011bte se, \u017ee je server spu\u0161t\u011bn a je povolena funkce konektoru REST. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: P\u0159ipojen\u00ed k serveru bylo do\u010dasn\u011b ztraceno. +jmx.rest.client.connection.temporarily.lost.explanation=Server se stal nedostupn\u00fdm, ale klient se bude pokou\u0161et obnovit p\u0159ipojen\u00ed po dobu nakonfigurovan\u00e9ho maxim\u00e1ln\u00edho povolen\u00e9ho \u010dasu. +jmx.rest.client.connection.temporarily.lost.useraction=Pokud je server \u00famysln\u011b restartov\u00e1n, nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. Jinak zkontrolujte s\u00ed\u0165ov\u00e9 p\u0159ipojen\u00ed a ujist\u011bte se, \u017ee je server spu\u0161t\u011bn a je povolena funkce konektoru REST. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: P\u0159ipojen\u00ed bylo obnoveno, ale p\u0159i p\u0159id\u00e1v\u00e1n\u00ed modul\u016f NotificationListener se vyskytly v\u00fdjimky. +jmx.rest.client.connection.restored.with.exceptions.explanation=P\u0159ipojen\u00ed k serveru bylo do\u010dasn\u011b ztraceno, ale bylo \u00fasp\u011b\u0161n\u011b obnoveno. P\u0159i p\u0159id\u00e1v\u00e1n\u00ed modul\u016f NotificationListener se vyskytly v\u00fdjimky, tak\u017ee mo\u017en\u00e1 nebudou p\u0159ijata n\u011bkter\u00e1 ozn\u00e1men\u00ed. +jmx.rest.client.connection.restored.with.exceptions.useraction=Zkontrolujte v\u00fdjimky uveden\u00e9 u ozn\u00e1men\u00ed a po opraven\u00ed probl\u00e9m\u016f znovu zaregistrujte moduly NotificationListener. + +jmx.rest.client.connection.restored=CWWKX0225I: P\u0159ipojen\u00ed bylo \u00fasp\u011b\u0161n\u011b obnoveno. +jmx.rest.client.connection.restored.explanation=P\u0159ipojen\u00ed k serveru bylo do\u010dasn\u011b ztraceno, ale bylo \u00fasp\u011b\u0161n\u011b obnoveno. V\u0161echny zaregistrovan\u00e9 moduly NotificationListener budou i nad\u00e1le p\u0159ij\u00edmat ozn\u00e1men\u00ed. +jmx.rest.client.connection.restored.useraction=Nen\u00ed + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Parametr typu JMXServiceURL nem\u016f\u017ee b\u00fdt null. +jmx.rest.client.connection.illegal.argument.explanation=Hodnota parametru 'serviceURL' nem\u016f\u017ee b\u00fdt null. +jmx.rest.client.connection.illegal.argument.useraction=Znovu se p\u0159ipojte ke konektoru JMX REST Connector pomoc\u00ed nenulov\u00e9 hodnoty JMXServiceURL. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: D\u00e1le uveden\u00e9 nen\u00ed platnou hodnotou koncov\u00e9ho bodu: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=Ur\u010den\u00e1 hodnota koncov\u00e9ho bodu nen\u00ed platn\u00e1. +jmx.rest.client.connection.invalid.endpoint.useraction=Znovu se p\u0159ipojte ke konektoru JMX REST Connector pomoc\u00ed platn\u00e9 hodnoty koncov\u00e9ho bodu, kter\u00e1 je typem String a je ve form\u00e1tu "host:port". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Nelze naj\u00edt \u017e\u00e1dn\u00e9 dostupn\u00e9 koncov\u00e9 body pro inicializaci konektoru. +jmx.rest.client.connection.no.endpoints.explanation=\u017d\u00e1dn\u00fd z uveden\u00fdch koncov\u00fdch bod\u016f nebyl k dispozici b\u011bhem inicializace konektoru JMX REST Connector. +jmx.rest.client.connection.no.endpoints.useraction=Znovu se p\u0159ipojte ke konektoru JMX REST Connector pomoc\u00ed alespo\u0148 1 dostupn\u00e9ho koncov\u00e9ho bodu. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Do\u0161lo k probl\u00e9mu se zadan\u00fdmi u\u017eivatelsk\u00fdmi pov\u011b\u0159en\u00edmi. Server odpov\u011bd\u011bl k\u00f3dem {0} a zpr\u00e1vou ''{1}''. +jmx.rest.client.bad.user.credentials.explanation=Zadan\u00e1 pov\u011b\u0159en\u00ed jsou chybn\u00e1, vypr\u0161ela platnost, ne\u00fapln\u00e1 nebo byl odep\u0159ena autorizace. +jmx.rest.client.bad.user.credentials.useraction=Ov\u011b\u0159te, \u017ee u\u017eivatelsk\u00e1 pov\u011b\u0159en\u00ed maj\u00ed spr\u00e1vn\u00e9 ov\u011b\u0159en\u00ed a autorizaci, potom z\u00edskejte nov\u00e9 p\u0159ipojen\u00ed. + +jmx.rest.client.connection.connect=CWWKX0230I: \u010clen kolektivu otev\u0159el klienta JMX ke kolektivn\u00edmu \u0159adi\u010di: {0} +jmx.rest.client.connection.connect.explanation=\u010clen p\u0159ipojen\u00fd k \u0159adi\u010di. +jmx.rest.client.connection.connect.useraction=Nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + +jmx.rest.client.connection.disconnect=CWWKX0231I: \u010clen kolektivu zav\u0159el klienta JMX z kolektivn\u00edho \u0159adi\u010de: {0} +jmx.rest.client.connection.disconnect.explanation=\u010clen odpojen\u00fd od \u0159adi\u010de. +jmx.rest.client.connection.disconnect.useraction=Nen\u00ed pot\u0159eba \u017e\u00e1dn\u00e1 akce. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_de.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_de.nlsprops new file mode 100755 index 00000000000..39cfc72695d --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_de.nlsprops @@ -0,0 +1,145 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Im REST-Client von WebSphere Java Management Extensions ist beim Vorbereiten der Anforderung an den Server f\u00fcr den URL {0} in der Verbindung {1} ein Fehler aufgetreten. +jmx.rest.client.request.error.explanation=Im REST-Client von WebSphere Java Management Extensions ist beim Vorbereiten einer Anforderung f\u00fcr den Server ein Fehler aufgetreten. +jmx.rest.client.request.error.useraction=Suchen Sie in den Serverprotokollen nach weiteren Informationen. + +jmx.rest.client.response.error=CWWKX0202E: Der REST-Client von WebSphere Java Management Extensions konnte die Antwort des Servers f\u00fcr den URL {0} in der Verbindung {1} nicht verarbeiten. +jmx.rest.client.response.error.explanation=Der REST-Client von WebSphere Java Management Extensions konnte eine Antwort des Servers nicht verarbeiten. +jmx.rest.client.response.error.useraction=Suchen Sie in den Serverprotokollen nach weiteren Informationen. + +jmx.rest.client.response.code.error=CWWKX0203E: Der REST-Client von WebSphere Java Management Extensions hat den unerwarteten Antwortcode {0} mit der Nachricht ''{1}'' vom Server f\u00fcr den URL {2} in der Verbindung {3} empfangen. +jmx.rest.client.response.code.error.explanation=Der REST-Client von WebSphere Java Management Extensions hat einen unerwarteten Antwortcode vom Server empfangen. +jmx.rest.client.response.code.error.useraction=Suchen Sie in den Serverprotokollen nach weiteren Informationen. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Throwable aus Fehlerdatenstrom des Servers kann nicht geparst werden. +jmx.rest.client.server.throwable.exception.explanation=Der Server hat bei der Verarbeitung der Clientanforderung eine Ausnahme ausgel\u00f6st, aber der Client konnte ein Throwable-Objekt aus dem Fehlerdatenstrom des Servers nicht parsen. Die Klasse des Throwable-Objekts steht dem Client m\u00f6glicherweise nicht zur Verf\u00fcgung. +jmx.rest.client.server.throwable.exception.useraction=Suchen Sie in den Serverprotokollen nach weiteren Informationen. + +jmx.rest.client.not.connected=CWWKX0206E: Der Client ist nicht mit dem Server verbunden. +jmx.rest.client.not.connected.explanation=Die Verbindung zum Server wurde geschlossen oder ist fehlgeschlagen. +jmx.rest.client.not.connected.useraction=Vergewissern Sie sich, dass das REST-Connector-Feature im Server aktiviert ist, und fordern Sie eine neue Verbindung zum Server an. + +jmx.rest.client.url.not.found=CWWKX0207E: Der Server hat gemeldet, dass der vom Client angeforderte URL nicht gefunden wurde. +jmx.rest.client.url.not.found.explanation=Der Client hat m\u00f6glicherweise Informationen, die nicht auf dem neuesten Stand sind, oder das REST-Connector-Feature im Server wurde aktiviert. +jmx.rest.client.url.not.found.useraction=Vergewissern Sie sich, dass das REST-Connector-Feature im Server aktiviert ist, und fordern Sie eine neue Verbindung zum Server an. +jmx.rest.client.class.name.null=CWWKX0208E: Das Argument f\u00fcr den Klassennamen ist null. +jmx.rest.client.class.name.null.explanation=Das Argument f\u00fcr den Klassennamen darf nicht null sein. +jmx.rest.client.class.name.null.useraction=Geben Sie einen Klassennamen ungleich null beim Aufruf der Methode an. + +jmx.rest.client.attribute.name.null=CWWKX0209E: Das Argument f\u00fcr den Attributnamen ist null. +jmx.rest.client.attribute.name.null.explanation=Das Argument f\u00fcr den Attributnamen darf nicht null sein. +jmx.rest.client.attribute.name.null.useraction=Geben Sie einen Attributnamen ungleich null beim Aufruf der Methode an. + +jmx.rest.client.attribute.names.null=CWWKX0210E: Das Argument, das ein Array von Attributnamen enth\u00e4lt, ist null. +jmx.rest.client.attribute.names.null.explanation=Das Argument, das ein Array von Attributnamen enth\u00e4lt, darf nicht null sein. +jmx.rest.client.attribute.names.null.useraction=Geben Sie ein Array mit Attributnamen ungleich null beim Aufruf der Methode an. + +jmx.rest.client.attribute.null=CWWKX0211E: Das Argument Attribute ist null. +jmx.rest.client.attribute.null.explanation=Das Argument Attribute darf nicht null sein. +jmx.rest.client.attribute.null.useraction=Geben Sie ein Argument Attribute ungleich null beim Aufruf der Methode an. + +jmx.rest.client.attribute.list.null=CWWKX0212E: Das Argument AttributeList ist null. +jmx.rest.client.attribute.list.null.explanation=Das Argument AttributeList darf nicht null sein. +jmx.rest.client.attribute.list.null.useraction=Geben Sie ein Argument AttributeList ungleich null beim Aufruf der Methode an. + +jmx.rest.client.object.name.null=CWWKX0213E: Das Argument ObjectName ist null. +jmx.rest.client.object.name.null.explanation=Das Argument ObjectName darf nicht null sein. +jmx.rest.client.object.name.null.useraction=Geben Sie ein Argument ObjectName ungleich null beim Aufruf der Methode an. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Es wurde ein nicht erwartetes Throwable-Objekt vom Server zur\u00fcckgegeben. +jmx.rest.client.unexpected.server.throwable.explanation=Die Ausnahme schlie\u00dft ein vom Server zur\u00fcckgegebenes Throwable-Objekt ein, das f\u00fcr diese Operation normalerweise nicht erwartet wird. +jmx.rest.client.unexpected.server.throwable.useraction=Suchen Sie in den Serverprotokollen nach weiteren Informationen. + +jmx.rest.client.bad.credentials=CWWKX0215E: Es liegt ein Problem mit dem angegebenen Benutzernamen oder Kennwort vor. Der Server hat mit dem Code {0} und der Nachricht ''{1}'' geantwortet. +jmx.rest.client.bad.credentials.explanation=Die beim Anfordern der Verbindung angegebenen Berechtigungsnachweise sind nicht g\u00fcltig. M\u00f6glicherweise ist der Benutzer nicht vorhanden, oder er hat keine Berechtigung f\u00fcr den Zugriff auf den Server, oder das Kennwort ist ung\u00fcltig. +jmx.rest.client.bad.credentials.useraction=Korrigieren Sie den Benutzernamen bzw. das Kennwort, und fordern Sie dann eine neue Verbindung an. + +jmx.rest.client.object.name.pattern=CWWKX0216E: Das ObjectName-Argument ''{0}'' ist ein Muster. +jmx.rest.client.object.name.pattern.explanation=Das ObjectName-Argument ist ein Muster, aber die Methode erfordert ein ObjectName-Argument, das einer einzigen MBean entspricht. +jmx.rest.client.object.name.pattern.useraction=Geben Sie ein ObjectName-Argument ohne Platzhalterzeichen ein, das einer einzigen MBean entspricht. + +jmx.rest.client.instance.not.found=CWWKX0217E: Es ist momentan keine MBean mit dem angegebenen ObjectName ''{0}'' registriert. +jmx.rest.client.instance.not.found.explanation=Die Operation erfordert eine registrierte MBean, aber es wurde keine MBean mit dem angegebenen ObjectName registriert. +jmx.rest.client.instance.not.found.useraction=Stellen Sie sicher, dass die MBean registriert ist, bevor Sie versuchen, Verwaltungsoperationen f\u00fcr die MBean auszuf\u00fchren. + +jmx.rest.client.attribute.not.found=CWWKX0218E: Die MBean ''{0}'' hat kein Attribut mit dem Namen ''{1}''. +jmx.rest.client.attribute.not.found.explanation=Die MBean hat kein Attribut mit dem angegebenen Namen. +jmx.rest.client.attribute.not.found.useraction=Fordern Sie die MBean-Informationen an, um festzustellen, welche Attribute die MBean enth\u00e4lt. + +jmx.rest.client.operation.not.found=CWWKX0219E: Die MBean ''{0}'' hat keine Operation mit dem Namen ''{1}''. +jmx.rest.client.operation.not.found.explanation=Die MBean hat keine Operation mit dem angegebenen Namen. +jmx.rest.client.operation.not.found.useraction=Fordern Sie die MBean-Informationen an, um festzustellen, welche Operationen die MBean enth\u00e4lt. + +jmx.rest.client.listener.not.found=CWWKX0220E: Der angegebene NotificationListener ist momentan nicht f\u00fcr den Empfang von Benachrichtigungen von der MBean ''{0}'' registriert. +jmx.rest.client.listener.not.found.explanation=Der NotificationListener wurde nicht hinzugef\u00fcgt oder bereits entfernt und ist momentan nicht f\u00fcr den Empfang von Benachrichtigungen von der angegebenen MBean registriert. +jmx.rest.client.listener.not.found.useraction=Stellen Sie sicher, dass der aufrufende Code \u00fcberwacht, welche NotificationListener hinzugef\u00fcgt und entfernt werden, bzw. die Ausnahme abf\u00e4ngt und behandelt. + +jmx.rest.client.notification.lost=CWWKX0221I: Die Benachrichtigung konnte nicht zugestellt werden. +jmx.rest.client.notification.lost.explanation=Eine Benachrichtigung konnte mindestens einem NotificationListener nicht zugestellt werden, weil der registrierte NotificationListener nicht gefunden wurde oder weil w\u00e4hrend der Zustellung der Benachrichtigung eine Ausnahme eingetreten ist. +jmx.rest.client.notification.lost.useraction=Wenn die Benachrichtigung einem registrierten NotificationListener h\u00e4tte zugestellt werden m\u00fcssen, suchen Sie in den Protokollen nach Ausnahmen. + +jmx.rest.client.connection.failed=CWWKX0222I: Die Verbindung zum Server ist fehlgeschlagen. +jmx.rest.client.connection.failed.explanation=Der Server war nicht verf\u00fcgbar und wurde auch nicht innerhalb des konfigurierten maximal zul\u00e4ssigen Zeitraums wiederhergestellt. +jmx.rest.client.connection.failed.useraction=\u00dcberpr\u00fcfen Sie die Netzverbindung, und stellen Sie sicher, dass der Server mit aktiviertem REST-Connector-Feature aktiv ist. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: Die Verbindung zum Server ist vor\u00fcbergehend nicht mehr vorhanden. +jmx.rest.client.connection.temporarily.lost.explanation=Der Server ist nicht verf\u00fcgbar, aber der Client versucht, die Verbindung innerhalb der konfigurierten maximal zul\u00e4ssigen Zeit wiederherzustellen. +jmx.rest.client.connection.temporarily.lost.useraction=Wenn der Server absichtlich erneut gestartet wird, ist keine Aktion erforderlich. War der Neustart nicht beabsichtigt, \u00fcberpr\u00fcfen Sie die Netzverbindung, und stellen Sie sicher, dass der Server mit aktiviertem REST-Connector-Feature aktiv ist. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: Die Verbindung wurde wiederhergestellt, aber beim Hinzuf\u00fcgen der NotificationListener sind Ausnahmen eingetreten. +jmx.rest.client.connection.restored.with.exceptions.explanation=Die Verbindung zum Server war vor\u00fcbergehend nicht mehr vorhanden, wurde aber erfolgreich wiederhergestellt. Beim Hinzuf\u00fcgen der NotificationListeners sind Ausnahmen eingetreten, und deshalb wurden m\u00f6glicherweise einige Benachrichtigungen nicht empfangen. +jmx.rest.client.connection.restored.with.exceptions.useraction=\u00dcberpr\u00fcfen Sie die Ausnahmen, die in der Benachrichtigung enthalten sind, und registrieren Sie die NotificationListener erneut, nachdem Sie die Probleme behoben haben. + +jmx.rest.client.connection.restored=CWWKX0225I: Die Verbindung wurde erfolgreich wiederhergestellt. +jmx.rest.client.connection.restored.explanation=Die Verbindung zum Server war vor\u00fcbergehend nicht mehr vorhanden, wurde aber erfolgreich wiederhergestellt. Alle registrierten NotificationListener empfangen wieder Benachrichtigungen. +jmx.rest.client.connection.restored.useraction=Keine. + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Der Parameter des Typs JMXServiceURL darf nicht null sein. +jmx.rest.client.connection.illegal.argument.explanation=Der Wert f\u00fcr den Parameter 'serviceURL' darf nicht null sein. +jmx.rest.client.connection.illegal.argument.useraction=Wiederholen Sie die Herstellung der Verbindung zum JMX-REST-Connector mit einem JMXServiceURL-Wert ungleich null. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: Der folgende Endpunktwert ist nicht g\u00fcltig: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=Der angegebene Endpunktwert ist nicht g\u00fcltig. +jmx.rest.client.connection.invalid.endpoint.useraction=Wiederholen Sie die Herstellung der Verbindung zum JMX-REST-Connector mit einem g\u00fcltigen Endpunktwert, der den Datentyp String und das Format "Host:Port" hat. + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Es wurden keine verf\u00fcgbaren Endpunkte f\u00fcr die Initalisierung des Connectors gefunden. +jmx.rest.client.connection.no.endpoints.explanation=Keiner der angegebenen Endpunkte war w\u00e4hrend der Initialisierung des JMX-REST-Connectors verf\u00fcgbar. +jmx.rest.client.connection.no.endpoints.useraction=Wiederholen Sie die Herstellung der Verbindung zum JMX-REST-Connector mit mindestens einem verf\u00fcgbaren Endpunkt. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Es liegt ein Problem mit den angegebenen Benutzerberechtigungsnachweisen vor. Der Server hat mit dem Code {0} und der Nachricht ''{1}'' geantwortet. +jmx.rest.client.bad.user.credentials.explanation=Die angegebenen Berechtigungsnachweise sind falsch, abgelaufen, unvollst\u00e4ndig oder die Berechtigung wurde verweigert. +jmx.rest.client.bad.user.credentials.useraction=Vergewissern Sie sich, dass die Benutzerberechtigungsnachweise die ordnungsgem\u00e4\u00dfe Authentifizierung und Berechtigung haben, und stellen Sie anschlie\u00dfend eine neue Verbindung her. + +jmx.rest.client.connection.connect=CWWKX0230I: Das Verbundmember hat den JMX-Client zum Verbundcontroller ge\u00f6ffnet: {0} +jmx.rest.client.connection.connect.explanation=Das Member hat eine Verbindung zum Controller hergestellt. +jmx.rest.client.connection.connect.useraction=Es ist keine Aktion erforderlich. + +jmx.rest.client.connection.disconnect=CWWKX0231I: Das Verbundmember hat den JMX-Client zum Verbundcontroller geschlossen: {0} +jmx.rest.client.connection.disconnect.explanation=Das Member hat die Verbindung zum Controller getrennt. +jmx.rest.client.connection.disconnect.useraction=Es ist keine Aktion erforderlich. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_es.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_es.nlsprops new file mode 100755 index 00000000000..721b1580b0d --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_es.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: El cliente REST de WebSphere Java Management Extensions ha encontrado un error mientras preparaba la solicitud en el servidor para el URL {0} en la conexi\u00f3n {1} +jmx.rest.client.request.error.explanation=El cliente REST de WebSphere Java Management Extensions ha encontrado un error mientras preparaba una solicitud para el servidor +jmx.rest.client.request.error.useraction=Examine los registros del servidor para obtener m\u00e1s informaci\u00f3n. + +jmx.rest.client.response.error=CWWKX0202E: El cliente REST de WebSphere Java Management Extensions no ha podido procesar la respuesta del servidor para el URL {0} en la conexi\u00f3n {1} +jmx.rest.client.response.error.explanation=El cliente REST de WebSphere Java Management Extensions no ha podido procesar una respuesta del servidor +jmx.rest.client.response.error.useraction=Examine los registros del servidor para obtener m\u00e1s informaci\u00f3n. + +jmx.rest.client.response.code.error=CWWKX0203E: El cliente REST de WebSphere Java Management Extensions ha recibido un c\u00f3digo de respuesta inesperado {0} con el mensaje ''{1}'' del servidor para el URL {2} en la conexi\u00f3n {3} +jmx.rest.client.response.code.error.explanation=El cliente REST de WebSphere Java Management Extensions ha recibido un c\u00f3digo de respuesta inesperado del servidor +jmx.rest.client.response.code.error.useraction=Examine los registros del servidor para obtener m\u00e1s informaci\u00f3n. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: No se puede analizar Throwable de la corriente de error del servidor. +jmx.rest.client.server.throwable.exception.explanation=El servidor ha generado una excepci\u00f3n al manejar la solicitud del cliente, pero el cliente no ha podido analizar un objeto Throwable de la corriente de error del servidor. Es posible que la clase del objeto Throwable no est\u00e9 disponible para el cliente. +jmx.rest.client.server.throwable.exception.useraction=Examine los registros del servidor para obtener m\u00e1s informaci\u00f3n. + +jmx.rest.client.not.connected=CWWKX0206E: El cliente no est\u00e1 conectado al servidor. +jmx.rest.client.not.connected.explanation=La conexi\u00f3n con el servidor se ha cerrado o ha fallado. +jmx.rest.client.not.connected.useraction=Compruebe que la caracter\u00edstica del conector REST est\u00e9 habilitada en el servidor y obtenga una nueva conexi\u00f3n con el servidor. + +jmx.rest.client.url.not.found=CWWKX0207E: El servidor inform\u00f3 que no ha encontrado el URL solicitado por el cliente. +jmx.rest.client.url.not.found.explanation=Es posible que el cliente tenga informaci\u00f3n no actualizada o que la caracter\u00edstica del conector REST del servidor no est\u00e9 habilitada. +jmx.rest.client.url.not.found.useraction=Compruebe que la caracter\u00edstica del conector REST est\u00e9 habilitada en el servidor y obtenga una nueva conexi\u00f3n con el servidor. + +jmx.rest.client.class.name.null=CWWKX0208E: El argumento de nombre de clase era nulo. +jmx.rest.client.class.name.null.explanation=El argumento de nombre de clase no debe ser nulo. +jmx.rest.client.class.name.null.useraction=Proporcione un nombre de clase no nulo cuando llame al m\u00e9todo. + +jmx.rest.client.attribute.name.null=CWWKX0209E: El argumento de nombre de atributo era nulo. +jmx.rest.client.attribute.name.null.explanation=El argumento de nombre de atributo no debe ser nulo. +jmx.rest.client.attribute.name.null.useraction=Proporcione un nombre de atributo no nulo cuando llame al m\u00e9todo. + +jmx.rest.client.attribute.names.null=CWWKX0210E: El argumento que contiene una matriz de nombres de atributo era nulo. +jmx.rest.client.attribute.names.null.explanation=El argumento que contiene una matriz de nombres de atributo no debe ser nulo. +jmx.rest.client.attribute.names.null.useraction=Proporcione una matriz no nula de nombres de atributo cuando llame al m\u00e9todo. + +jmx.rest.client.attribute.null=CWWKX0211E: El argumento Attribute era nulo. +jmx.rest.client.attribute.null.explanation=El argumento Attribute no debe ser nulo. +jmx.rest.client.attribute.null.useraction=Proporcione un Attribute no nulo cuando llame al m\u00e9todo. + +jmx.rest.client.attribute.list.null=CWWKX0212E: El argumento AttributeList era nulo. +jmx.rest.client.attribute.list.null.explanation=El argumento AttributeList no debe ser nulo. +jmx.rest.client.attribute.list.null.useraction=Proporcione un AttributeList no nulo cuando llame al m\u00e9todo. + +jmx.rest.client.object.name.null=CWWKX0213E: El argumento ObjectName era nulo. +jmx.rest.client.object.name.null.explanation=El argumento ObjectName no debe ser nulo. +jmx.rest.client.object.name.null.useraction=Proporcione un ObjectName no nulo cuando llame al m\u00e9todo. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: El servidor ha devuelto un objeto Throwable inesperado. +jmx.rest.client.unexpected.server.throwable.explanation=La excepci\u00f3n incluye un objeto Throwable devuelto desde el servidor que no se espera normalmente para esta operaci\u00f3n. +jmx.rest.client.unexpected.server.throwable.useraction=Examine los registros del servidor para obtener m\u00e1s informaci\u00f3n. + +jmx.rest.client.bad.credentials=CWWKX0215E: Ha habido un problema con el nombre de usuario o contrase\u00f1a especificados. El servidor respondi\u00f3 con el c\u00f3digo {0} y el mensaje ''{1}'' +jmx.rest.client.bad.credentials.explanation=Las credenciales proporcionadas al obtener la conexi\u00f3n eran incorrectas. Es posible que el usuario no exista o que no tenga autoridad para acceder al servidor, o que la contrase\u00f1a sea incorrecta. +jmx.rest.client.bad.credentials.useraction=Corrija el nombre de usuario o la contrase\u00f1a y despu\u00e9s obtenga una nueva conexi\u00f3n. + +jmx.rest.client.object.name.pattern=CWWKX0216E: El argumento ObjectName ''{0}'' es un patr\u00f3n. " +jmx.rest.client.object.name.pattern.explanation=El argumento ObjectName es un patr\u00f3n pero el m\u00e9todo requiere un ObjectName que coincida exactamente con un MBean. +jmx.rest.client.object.name.pattern.useraction=Proporcione un argumento ObjectName sin comodines y que coincida exactamente con un MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Actualmente no hay registrado ning\u00fan MBean con el ObjectName ''{0}'' indicado +jmx.rest.client.instance.not.found.explanation=La operaci\u00f3n requiere un MBean registrado, pero no se ha registrado ning\u00fan MBean con el ObjectName indicado. +jmx.rest.client.instance.not.found.useraction=Aseg\u00farese de que el MBean est\u00e9 registrado antes de intentar realizar operaciones de gesti\u00f3n en \u00e9l. + +jmx.rest.client.attribute.not.found=CWWKX0218E: El MBean ''{0}'' no tiene ning\u00fan atributo con el nombre ''{1}'' +jmx.rest.client.attribute.not.found.explanation=El MBean no proporciona ning\u00fan atributo del nombre indicado. +jmx.rest.client.attribute.not.found.useraction=Obtenga la informaci\u00f3n del MBean para confirmar qu\u00e9 atributos proporciona el MBean. + +jmx.rest.client.operation.not.found=CWWKX0219E: El MBean ''{0}'' no tiene ninguna operaci\u00f3n con el nombre ''{1}'' +jmx.rest.client.operation.not.found.explanation=El MBean no proporciona ninguna operaci\u00f3n del nombre indicado. +jmx.rest.client.operation.not.found.useraction=Obtenga la informaci\u00f3n del MBean para confirmar qu\u00e9 operaciones proporciona el MBean. + +jmx.rest.client.listener.not.found=CWWKX0220E: El NotificationListener indicado no est\u00e1 actualmente registrado para recibir notificaciones del MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=No se ha a\u00f1adido el NotificationListener o se ha eliminado y no est\u00e1 registrado actualmente para recibir notificaciones del MBean indicado. +jmx.rest.client.listener.not.found.useraction=Aseg\u00farese de que el c\u00f3digo de llamada hace un seguimiento de qu\u00e9 NotificationListeners se ha a\u00f1adido y eliminado o que capture y gestione la excepci\u00f3n. + +jmx.rest.client.notification.lost=CWWKX0221I: No se ha podido entregar la notificaci\u00f3n. +jmx.rest.client.notification.lost.explanation=No se ha podido entregar la notificaci\u00f3n a uno o m\u00e1s NotificationListeners porque no se ha encontrado un NotificationListener registrado o se ha producido una excepci\u00f3n durante la entrega de la notificaci\u00f3n. +jmx.rest.client.notification.lost.useraction=Si la notificaci\u00f3n deber\u00eda haberse entregado a un NotificationListener registrado busque excepciones en los registros. + +jmx.rest.client.connection.failed=CWWKX0222I: Ha fallado la conexi\u00f3n con el servidor. +jmx.rest.client.connection.failed.explanation=El servidor ha dejado de estar disponible y no ha vuelto a estar disponible dentro del tiempo m\u00e1ximo configurado permitido. +jmx.rest.client.connection.failed.useraction=Compruebe la conexi\u00f3n de red y aseg\u00farese de que el servidor est\u00e9 en ejecuci\u00f3n con la caracter\u00edstica del conector REST habilitada. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: Se ha perdido temporalmente la conexi\u00f3n con el servidor. +jmx.rest.client.connection.temporarily.lost.explanation=El servidor ha dejado de estar disponible, pero el cliente intentar\u00e1 restablecer la conexi\u00f3n durante el tiempo m\u00e1ximo configurado permitido. +jmx.rest.client.connection.temporarily.lost.useraction=Si el servidor se est\u00e1 reiniciando de manera intencionada, no hay que realizar ninguna acci\u00f3n. En caso contrario, compruebe la conexi\u00f3n de red y aseg\u00farese de que el servidor est\u00e9 en ejecuci\u00f3n con la caracter\u00edstica del conector REST habilitada. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: Se ha restablecido la conexi\u00f3n pero se han encontrado excepciones al a\u00f1adir los NotificationListeners. +jmx.rest.client.connection.restored.with.exceptions.explanation=Se hab\u00eda perdido temporalmente la conexi\u00f3n con el servidor pero se restableci\u00f3 satisfactoriamente. Se encontraron excepciones al a\u00f1adir los NotificationListeners, por lo que es posible que algunas notificaciones no se hayan recibido. +jmx.rest.client.connection.restored.with.exceptions.useraction=Compruebe las excepciones incluidas con la notificaci\u00f3n y vuelva a registrar los NotificationListeners despu\u00e9s de corregir los problemas. + +jmx.rest.client.connection.restored=CWWKX0225I: La conexi\u00f3n se ha restablecido satisfactoriamente. +jmx.rest.client.connection.restored.explanation=Se hab\u00eda perdido temporalmente la conexi\u00f3n con el servidor pero se restableci\u00f3 satisfactoriamente. Los NotificationListeners registrados seguir\u00e1n recibiendo notificaciones. +jmx.rest.client.connection.restored.useraction=Ninguna. + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: El par\u00e1metro de tipo JMXServiceURL no puede ser nulo. +jmx.rest.client.connection.illegal.argument.explanation=El valor del par\u00e1metro 'serviceURL' no puede ser nulo. +jmx.rest.client.connection.illegal.argument.useraction=Vuelva a conectar con JMX REST Connector utilizando un valor JMXServiceURL no nulo. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: El siguiente valor no es un valor de punto final v\u00e1lido: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=El valor de punto final especificado no es v\u00e1lido. +jmx.rest.client.connection.invalid.endpoint.useraction=Vuelva a conectar con JMX REST Connector utilizando un valor de punto final v\u00e1lido que sea de tipo String y tenga el formato "host:puerto". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: No se ha podido encontrar ning\u00fan punto final disponible para inicializar el conector. +jmx.rest.client.connection.no.endpoints.explanation=Ninguno de los puntos finales especificados estaba disponible durante la inicializaci\u00f3n de JMX REST Connector. +jmx.rest.client.connection.no.endpoints.useraction=Vuelva a conectar con JMX REST Connector utilizando al menos un punto final disponible. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Ha habido un problema con las credenciales de usuario proporcionadas. El servidor respondi\u00f3 con el c\u00f3digo {0} y el mensaje ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=Las credenciales proporcionadas son incorrectas, caducadas, incompletas o se ha rechazado la autorizaci\u00f3n. +jmx.rest.client.bad.user.credentials.useraction=Verifique que las credenciales de usuario tengan la autenticaci\u00f3n y la autorizaci\u00f3n correctas y, a continuaci\u00f3n obtenga una nueva conexi\u00f3n. + +jmx.rest.client.connection.connect=CWWKX0230I: El miembro de colectivo ha abierto el cliente JMX al controlador colectivo: {0} +jmx.rest.client.connection.connect.explanation=El miembro se ha conectado al controlador. +jmx.rest.client.connection.connect.useraction=No se requiere ninguna acci\u00f3n. + +jmx.rest.client.connection.disconnect=CWWKX0231I: El miembro de colectivo ha cerrado el cliente JMX del controlador colectivo: {0} +jmx.rest.client.connection.disconnect.explanation=El miembro se ha desconectado del controlador. +jmx.rest.client.connection.disconnect.useraction=No se requiere ninguna acci\u00f3n. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_fr.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_fr.nlsprops new file mode 100755 index 00000000000..a2726a64fab --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_fr.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Le client REST WebSphere Java Management Extensions a d\u00e9tect\u00e9 une erreur lors de la pr\u00e9paration de la demande au serveur de l''URL {0} sur la connexion {1} +jmx.rest.client.request.error.explanation=Le client REST WebSphere Java Management Extensions a d\u00e9tect\u00e9 une erreur lors de la pr\u00e9paration d'une demande pour le serveur +jmx.rest.client.request.error.useraction=Examinez les journaux du serveur pour plus d'informations. + +jmx.rest.client.response.error=CWWKX0202E: Le client REST WebSphere Java Management Extensions n''a pas pu traiter la r\u00e9ponse du serveur pour l''URL {0} sur la connexion {1} +jmx.rest.client.response.error.explanation=Le client REST WebSphere Java Management Extensions n'a pas pu traiter une r\u00e9ponse du serveur +jmx.rest.client.response.error.useraction=Examinez les journaux du serveur pour plus d'informations. + +jmx.rest.client.response.code.error=CWWKX0203E: Le client REST WebSphere Java Management Extensions a re\u00e7u un code de r\u00e9ponse inattendu {0} avec le message ''{1}'' du serveur pour l''URL {2} sur la connexion {3} +jmx.rest.client.response.code.error.explanation=Le client REST WebSphere Java Management Extensions a re\u00e7u un code de r\u00e9ponse inattendu du serveur +jmx.rest.client.response.code.error.useraction=Examinez les journaux du serveur pour plus d'informations. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Impossible d'interpr\u00e9ter un objet Throwable dans le flux d'erreurs du serveur. +jmx.rest.client.server.throwable.exception.explanation=Le serveur a lev\u00e9 une exception en traitant la demande du client, mais le client n'a pas pu interpr\u00e9ter un objet Throwable \u00e0 partir du flux d'erreurs du serveur. Il est possible que le client ne dispose pas de la classe de l'objet Throwable. +jmx.rest.client.server.throwable.exception.useraction=Examinez les journaux du serveur pour plus d'informations. + +jmx.rest.client.not.connected=CWWKX0206E: Le client n'est pas connect\u00e9 au serveur. +jmx.rest.client.not.connected.explanation=La connexion au serveur a \u00e9t\u00e9 ferm\u00e9e ou a \u00e9chou\u00e9. +jmx.rest.client.not.connected.useraction=V\u00e9rifiez que la fonction connecteur REST est activ\u00e9e sur le serveur, puis obtenez une nouvelle connexion au serveur. + +jmx.rest.client.url.not.found=CWWKX0207E: Le serveur signale que l'URL demand\u00e9e par le client est introuvable. +jmx.rest.client.url.not.found.explanation=Les informations dont dispose le client sont peut-\u00eatre obsol\u00e8tes, ou bien la fonction connecteur REST sur le serveur a peut-\u00eatre \u00e9t\u00e9 d\u00e9sactiv\u00e9e. +jmx.rest.client.url.not.found.useraction=V\u00e9rifiez que la fonction connecteur REST est activ\u00e9e sur le serveur, puis obtenez une nouvelle connexion au serveur. + +jmx.rest.client.class.name.null=CWWKX0208E: L'argument de nom de classe \u00e9tait Null. +jmx.rest.client.class.name.null.explanation=L'argument de nom de classe ne doit pas \u00eatre Null. +jmx.rest.client.class.name.null.useraction=Fournissez un nom de classe non Null lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.attribute.name.null=CWWKX0209E: L'argument de nom d'attribut \u00e9tait Null. +jmx.rest.client.attribute.name.null.explanation=L'argument de nom d'attribut ne doit pas \u00eatre Null. +jmx.rest.client.attribute.name.null.useraction=Fournissez un nom d'attribut non Null lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.attribute.names.null=CWWKX0210E: L'argument suppos\u00e9 contenir un tableau de noms d'attribut \u00e9tait Null. +jmx.rest.client.attribute.names.null.explanation=L'argument suppos\u00e9 contenir un tableau de noms d'attribut ne doit pas \u00eatre Null. +jmx.rest.client.attribute.names.null.useraction=Fournissez un tableau non Null de noms d'attribut lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.attribute.null=CWWKX0211E: L'argument Attribute \u00e9tait Null. +jmx.rest.client.attribute.null.explanation=L'argument Attribute ne doit pas \u00eatre Null. +jmx.rest.client.attribute.null.useraction=Fournissez un argument Attribute non Null lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.attribute.list.null=CWWKX0212E: L'argument AttributeList \u00e9tait Null. +jmx.rest.client.attribute.list.null.explanation=L'argument AttributeList ne doit pas \u00eatre Null. +jmx.rest.client.attribute.list.null.useraction=Fournissez un argument AttributeList non Null lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.object.name.null=CWWKX0213E: L'argument ObjectName \u00e9tait Null. +jmx.rest.client.object.name.null.explanation=L'argument ObjectName ne doit pas \u00eatre Null. +jmx.rest.client.object.name.null.useraction=Fournissez un argument ObjectName non Null lorsque vous appelez la m\u00e9thode. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Un objet Throwable inattendu a \u00e9t\u00e9 renvoy\u00e9 par le serveur. +jmx.rest.client.unexpected.server.throwable.explanation=L'exception encapsule un objet Throwable renvoy\u00e9 par le serveur qui n'est normalement pas pr\u00e9vu pour cette op\u00e9ration. +jmx.rest.client.unexpected.server.throwable.useraction=Examinez les journaux du serveur pour plus d'informations. + +jmx.rest.client.bad.credentials=CWWKX0215E: Un probl\u00e8me est survenu avec le nom d''utilisateur ou le mot de passe fourni. Le serveur a r\u00e9pondu avec le code {0} et le message ''{1}'' +jmx.rest.client.bad.credentials.explanation=Les donn\u00e9es d'identification fournies lors de l'obtention de la connexion \u00e9taient incorrectes. L'utilisateur n'existe peut-\u00eatre pas ; ou alors, s'il existe, il n'a peut-\u00eatre pas le droit d'acc\u00e9der au serveur ou le mot de passe indiqu\u00e9 est incorrect. +jmx.rest.client.bad.credentials.useraction=Corrigez le nom d'utilisateur ou le mot de passe, puis obtenez une nouvelle connexion. + +jmx.rest.client.object.name.pattern=CWWKX0216E: L''argument ObjectName ''{0}'' est un masque g\u00e9n\u00e9rique. +jmx.rest.client.object.name.pattern.explanation=L'argument ObjectName est un masque g\u00e9n\u00e9rique alors que la m\u00e9thode requiert un ObjectName correspondant pr\u00e9cis\u00e9ment \u00e0 un unique bean g\u00e9r\u00e9 (MBean). +jmx.rest.client.object.name.pattern.useraction=Fournissez un argument ObjectName sans partie g\u00e9n\u00e9rique afin de d\u00e9signer pr\u00e9cis\u00e9ment un unique MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Aucun MBean n''est actuellement enregistr\u00e9 avec l''ObjectName indiqu\u00e9, ''{0}'' +jmx.rest.client.instance.not.found.explanation=L'op\u00e9ration n\u00e9cessite un MBean enregistr\u00e9, mais aucun ne l'a \u00e9t\u00e9 avec l'ObjectName indiqu\u00e9. +jmx.rest.client.instance.not.found.useraction=Assurez-vous que le MBean est bien enregistr\u00e9 avant de tenter toute op\u00e9ration de gestion dessus. + +jmx.rest.client.attribute.not.found=CWWKX0218E: Le MBean ''{0}'' n''a pas d''attribut nomm\u00e9 ''{1}'' +jmx.rest.client.attribute.not.found.explanation=Le MBean ne fournit pas d'attribut portant le nom indiqu\u00e9. +jmx.rest.client.attribute.not.found.useraction=Obtenez les informations du MBean afin de d\u00e9terminer quels attributs il fournit. + +jmx.rest.client.operation.not.found=CWWKX0219E: Le MBean ''{0}'' n''a pas d''op\u00e9ration nomm\u00e9e ''{1}'' +jmx.rest.client.operation.not.found.explanation=Le MBean ne fournit pas d'op\u00e9ration portant le nom indiqu\u00e9. +jmx.rest.client.operation.not.found.useraction=Obtenez les informations du MBean afin de d\u00e9terminer quelles op\u00e9rations il fournit. + +jmx.rest.client.listener.not.found=CWWKX0220E: Le NotificationListener fourni n''est pas actuellement enregistr\u00e9 pour recevoir des notifications du MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=Le NotificationListener n'a pas \u00e9t\u00e9 ajout\u00e9, ou bien s'il l'a \u00e9t\u00e9, il est d\u00e9j\u00e0 retir\u00e9 et n'est donc pas actuellement enregistr\u00e9 pour recevoir des notifications du MBean indiqu\u00e9. +jmx.rest.client.listener.not.found.useraction=Assurez-vous que le code appelant tient \u00e0 jour la liste des NotificationListeners ayant \u00e9t\u00e9 ajout\u00e9s et retir\u00e9s ou que l'exception est intercept\u00e9e (catch) et trait\u00e9e. + +jmx.rest.client.notification.lost=CWWKX0221I: La notification n'a pas pu \u00eatre livr\u00e9e. +jmx.rest.client.notification.lost.explanation=Une notification n'a pas pu \u00eatre livr\u00e9e \u00e0 un ou plusieurs NotificationListeners car aucun NotificationListener enregistr\u00e9 n'a \u00e9t\u00e9 trouv\u00e9 ou bien une exception s'est produite lors de la livraison de la notification. +jmx.rest.client.notification.lost.useraction=Si la notification aurait due \u00eatre envoy\u00e9e \u00e0 un programme d'\u00e9coute NotificationListener enregistr\u00e9, recherchez des exceptions dans les journaux. + +jmx.rest.client.connection.failed=CWWKX0222I: La connexion au serveur a \u00e9chou\u00e9. +jmx.rest.client.connection.failed.explanation=Le serveur est devenu indisponible et sa disponibilit\u00e9 n'a pas \u00e9t\u00e9 r\u00e9tablie dans le d\u00e9lai imparti configur\u00e9. +jmx.rest.client.connection.failed.useraction=V\u00e9rifiez la connexion r\u00e9seau et assurez-vous que le serveur est ex\u00e9cut\u00e9 avec la fonction connecteur REST activ\u00e9e. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: La connexion au serveur a \u00e9t\u00e9 temporairement perdue. +jmx.rest.client.connection.temporarily.lost.explanation=Le serveur est devenu indisponible, mais le client va tenter de restaurer la connexion dans le d\u00e9lai imparti configur\u00e9. +jmx.rest.client.connection.temporarily.lost.useraction=Si le serveur red\u00e9marre intentionnellement, aucune action n'est requise. Sinon, v\u00e9rifiez la connexion r\u00e9seau et assurez-vous que le serveur est ex\u00e9cut\u00e9 avec la fonction connecteur REST activ\u00e9e. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: La connexion a \u00e9t\u00e9 restaur\u00e9e, mais des exceptions ont \u00e9t\u00e9 rencontr\u00e9es lors de l'ajout des NotificationListeners. +jmx.rest.client.connection.restored.with.exceptions.explanation=La connexion au serveur a \u00e9t\u00e9 perdue temporairement, mais elle a ensuite \u00e9t\u00e9 correctement r\u00e9tablie. Des exceptions ont toutefois \u00e9t\u00e9 rencontr\u00e9es lors de l'ajout des NotificationListeners, de sorte que certaines notifications risquent de ne pas \u00eatre re\u00e7ues. +jmx.rest.client.connection.restored.with.exceptions.useraction=V\u00e9rifiez les exceptions incluses avec la notification et, une fois les probl\u00e8mes corrig\u00e9s, r\u00e9enregistrez les NotificationListeners. + +jmx.rest.client.connection.restored=CWWKX0225I: La connexion a \u00e9t\u00e9 restaur\u00e9e correctement. +jmx.rest.client.connection.restored.explanation=La connexion au serveur a \u00e9t\u00e9 perdue temporairement, mais elle a ensuite \u00e9t\u00e9 correctement r\u00e9tablie. Tous les NotificationListeners enregistr\u00e9s continueront \u00e0 recevoir les notifications. +jmx.rest.client.connection.restored.useraction=Aucun + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Le param\u00e8tre de type JMXServiceURL ne peut pas avoir la valeur NULL. +jmx.rest.client.connection.illegal.argument.explanation=La valeur du param\u00e8tre 'serviceURL' ne peut pas \u00eatre NULL. +jmx.rest.client.connection.illegal.argument.useraction=Connectez-vous \u00e0 nouveau au connecteur JMX REST \u00e0 l'aide d'une valeur JMXServiceURL non NULL. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: La valeur de noeud final suivante n''est pas valide : {0} +jmx.rest.client.connection.invalid.endpoint.explanation=La valeur de noeud final indiqu\u00e9e n'est pas valide. +jmx.rest.client.connection.invalid.endpoint.useraction=Connectez-vous \u00e0 nouveau au connecteur JMX REST \u00e0 l'aide d'une valeur de noeud final valide de type cha\u00eene et au format "h\u00f4te:port". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Aucun noeud final disponible ne peut \u00eatre localis\u00e9 pour initialiser le connecteur. +jmx.rest.client.connection.no.endpoints.explanation=Aucun des noeuds finaux indiqu\u00e9s n'\u00e9tait disponible pendant l'initialisation du connecteur JMX REST. +jmx.rest.client.connection.no.endpoints.useraction=Connectez-vous \u00e0 nouveau au connecteur JMX REST \u00e0 l'aide d'au moins un noeud final disponible. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Un probl\u00e8me est survenu avec les donn\u00e9es d''identification de l''utilisateur fournies. Le serveur a r\u00e9pondu avec le code {0} et le message ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=Les donn\u00e9es d'identification fournies sont incorrectes, expir\u00e9es, incompl\u00e8tes ou non autoris\u00e9es. +jmx.rest.client.bad.user.credentials.useraction=V\u00e9rifiez que les donn\u00e9es d'identification de l'utilisateur disposent d'une authentification et d'une autorisation correctes, puis obtenez une nouvelle connexion. + +jmx.rest.client.connection.connect=CWWKX0230I: Le membre de collectivit\u00e9 a ouvert le client JMX dans le contr\u00f4leur de collectivit\u00e9 : {0} +jmx.rest.client.connection.connect.explanation=Le membre est connect\u00e9 au contr\u00f4leur. +jmx.rest.client.connection.connect.useraction=Aucune action n'est requise. + +jmx.rest.client.connection.disconnect=CWWKX0231I: Le membre de collectivit\u00e9 a ferm\u00e9 le client JMX dans le contr\u00f4leur de collectivit\u00e9 : {0} +jmx.rest.client.connection.disconnect.explanation=Le membre est d\u00e9connect\u00e9 du contr\u00f4leur. +jmx.rest.client.connection.disconnect.useraction=Aucune action n'est requise. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_hu.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_hu.nlsprops new file mode 100755 index 00000000000..b0e0c628dc2 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_hu.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l hib\u00e1ba \u00fctk\u00f6z\u00f6tt, mik\u00f6zben el\u0151k\u00e9sz\u00edtette a kiszolg\u00e1l\u00f3hoz k\u00fcldend\u0151 k\u00e9r\u00e9st a(z) {1} kapcsolaton tal\u00e1lhat\u00f3 {0} URL eset\u00e9ben +jmx.rest.client.request.error.explanation=A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l hib\u00e1ba \u00fctk\u00f6z\u00f6tt, mik\u00f6zben el\u0151k\u00e9sz\u00edtette a kiszolg\u00e1l\u00f3hoz k\u00fcldend\u0151 k\u00e9r\u00e9st +jmx.rest.client.request.error.useraction=Tov\u00e1bbi inform\u00e1ci\u00f3k\u00e9rt vizsg\u00e1lja meg a kiszolg\u00e1l\u00f3napl\u00f3kat. + +jmx.rest.client.response.error=CWWKX0202E: A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l nem tudta feldolgozni a kiszolg\u00e1l\u00f3t\u00f3l \u00e9rkezett v\u00e1laszt a(z) {1} kapcsolaton tal\u00e1lhat\u00f3 {0} URL eset\u00e9ben +jmx.rest.client.response.error.explanation=A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l nem tudott feldolgozni egy kiszolg\u00e1l\u00f3t\u00f3l \u00e9rkezett v\u00e1laszt +jmx.rest.client.response.error.useraction=Tov\u00e1bbi inform\u00e1ci\u00f3k\u00e9rt vizsg\u00e1lja meg a kiszolg\u00e1l\u00f3napl\u00f3kat. + +jmx.rest.client.response.code.error=CWWKX0203E: A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l a(z) {0} v\u00e1ratlan v\u00e1laszk\u00f3dot kapta a(z) "{1}" \u00fczenettel a kiszolg\u00e1l\u00f3t\u00f3l a(z) {3} kapcsolaton tal\u00e1lhat\u00f3 {2} URL eset\u00e9ben +jmx.rest.client.response.code.error.explanation=A WebSphere Java Management Extensions REST \u00fcgyf\u00e9l egy v\u00e1ratlan v\u00e1laszk\u00f3dot kapta a kiszolg\u00e1l\u00f3t\u00f3l +jmx.rest.client.response.code.error.useraction=Tov\u00e1bbi inform\u00e1ci\u00f3k\u00e9rt vizsg\u00e1lja meg a kiszolg\u00e1l\u00f3napl\u00f3kat. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Nem lehet \u00e9rtelmezni egy Throwable objektumot a kiszolg\u00e1l\u00f3 hibafolyam\u00e1b\u00f3l. +jmx.rest.client.server.throwable.exception.explanation=A kiszolg\u00e1l\u00f3 kiv\u00e9telt adott az \u00fcgyf\u00e9lk\u00e9r\u00e9s kezel\u00e9sekor, de az \u00fcgyf\u00e9l nem tudott \u00e9rtelmezni egy Throwable objektumot a kiszolg\u00e1l\u00f3 hibafolyam\u00e1b\u00f3l. Lehet, hogy a Throwable objektum oszt\u00e1lya nem el\u00e9rhet\u0151 az \u00fcgyf\u00e9l sz\u00e1m\u00e1ra. +jmx.rest.client.server.throwable.exception.useraction=Tov\u00e1bbi inform\u00e1ci\u00f3k\u00e9rt vizsg\u00e1lja meg a kiszolg\u00e1l\u00f3napl\u00f3kat. + +jmx.rest.client.not.connected=CWWKX0206E: Az \u00fcgyf\u00e9l nem kapcsol\u00f3dik a kiszolg\u00e1l\u00f3hoz. +jmx.rest.client.not.connected.explanation=A kapcsolat a kiszolg\u00e1l\u00f3val megszakadt vagy sikertelen. +jmx.rest.client.not.connected.useraction=Ellen\u0151rizze, hogy enged\u00e9lyezve van-e a REST csatol\u00f3 szolg\u00e1ltat\u00e1s a kiszolg\u00e1l\u00f3n, \u00e9s hozzon l\u00e9tre \u00faj kapcsolatot a kiszolg\u00e1l\u00f3val. + +jmx.rest.client.url.not.found=CWWKX0207E: A kiszolg\u00e1l\u00f3 jelezte, hogy az \u00fcgyf\u00e9l \u00e1ltal k\u00e9rt URL nem tal\u00e1lhat\u00f3. +jmx.rest.client.url.not.found.explanation=Lehet, hogy az \u00fcgyf\u00e9l elavult inform\u00e1ci\u00f3kkal rendelkezik vagy a REST csatol\u00f3 funkci\u00f3 a kiszolg\u00e1l\u00f3n le van tiltva. +jmx.rest.client.url.not.found.useraction=Ellen\u0151rizze, hogy enged\u00e9lyezve van-e a REST csatol\u00f3 szolg\u00e1ltat\u00e1s a kiszolg\u00e1l\u00f3n, \u00e9s hozzon l\u00e9tre \u00faj kapcsolatot a kiszolg\u00e1l\u00f3val. + +jmx.rest.client.class.name.null=CWWKX0208E: Az oszt\u00e1lyn\u00e9v argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.class.name.null.explanation=Az oszt\u00e1lyn\u00e9v argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.class.name.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 oszt\u00e1lynevet a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.attribute.name.null=CWWKX0209E: Az attrib\u00fatumn\u00e9v argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.attribute.name.null.explanation=Az attrib\u00fatumn\u00e9v argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.attribute.name.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 attrib\u00fatumnevet a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.attribute.names.null=CWWKX0210E: Az attrib\u00fatumneveket tartalmaz\u00f3 argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.attribute.names.null.explanation=Az attrib\u00fatumneveket tartalmaz\u00f3 argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.attribute.names.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 attrib\u00fatumn\u00e9v t\u00f6mb\u00f6t a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.attribute.null=CWWKX0211E: Az Attribute argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.attribute.null.explanation=Az Attribute argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.attribute.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 Attribute argumentumot a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.attribute.list.null=CWWKX0212E: Az AttributeList argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.attribute.list.null.explanation=Az AttributeList argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.attribute.list.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 AttributeList argumentumot a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.object.name.null=CWWKX0213E: Az ObjectName argumentum null \u00e9rt\u00e9k\u0171 volt. +jmx.rest.client.object.name.null.explanation=Az ObjectName argumentum nem lehet null \u00e9rt\u00e9k\u0171. +jmx.rest.client.object.name.null.useraction=Adjon meg nem null \u00e9rt\u00e9k\u0171 ObjectName argumentumot a met\u00f3dus h\u00edv\u00e1sakor. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Nem v\u00e1rt Throwable objektumot adott vissza a program. +jmx.rest.client.unexpected.server.throwable.explanation=A kiv\u00e9tel a m\u0171velethez a kiszolg\u00e1l\u00f3r\u00f3l visszaadott nem v\u00e1rt Throwable objektumot tartalmaz. +jmx.rest.client.unexpected.server.throwable.useraction=Tov\u00e1bbi inform\u00e1ci\u00f3k\u00e9rt vizsg\u00e1lja meg a kiszolg\u00e1l\u00f3napl\u00f3kat. + +jmx.rest.client.bad.credentials=CWWKX0215E: Probl\u00e9ma volt a megadott felhaszn\u00e1l\u00f3n\u00e9vvel vagy jelsz\u00f3val. A kiszolg\u00e1l\u00f3 {0} k\u00f3ddal \u00e9s ''{1}'' \u00fczenettel v\u00e1laszolt. +jmx.rest.client.bad.credentials.explanation=A kapcsolat l\u00e9trehoz\u00e1sakor megadott hiteles\u00edt\u00e9si adatok helytelenek voltak. Lehet, hogy a felhaszn\u00e1l\u00f3 nem l\u00e9tezik vagy nincs jogosults\u00e1ga a kiszolg\u00e1l\u00f3 el\u00e9r\u00e9s\u00e9hez, vagy helytelen a jelsz\u00f3. +jmx.rest.client.bad.credentials.useraction=Jav\u00edtsa ki a felhaszn\u00e1l\u00f3nevet vagy jelsz\u00f3t, majd hozzon l\u00e9tre \u00faj kapcsolatot. + +jmx.rest.client.object.name.pattern=CWWKX0216E: A(z) ''{0}'' ObjectName argumentum egy minta." +jmx.rest.client.object.name.pattern.explanation=Az ObjectName argumentum egy minta, de a met\u00f3dus sz\u00e1m\u00e1ra pontosan egy MBean elemmel egyez\u0151 ObjectName sz\u00fcks\u00e9ges. +jmx.rest.client.object.name.pattern.useraction=Adjon meg helyettes\u00edt\u0151 karakterek n\u00e9lk\u00fcl egy ObjectName argumentumot, ami pontosan egy MBean elemmel egyezik. + +jmx.rest.client.instance.not.found=CWWKX0217E: Jelenleg nincs MBean regisztr\u00e1lva a megadott ''{0}'' ObjectName argumentummal. +jmx.rest.client.instance.not.found.explanation=A m\u0171velethez regisztr\u00e1lt MBean sz\u00fcks\u00e9ges, de a megadott ObjectName argumentummal nem volt MBean regisztr\u00e1lva. +jmx.rest.client.instance.not.found.useraction=Gondoskodjon arr\u00f3l, hogy az MBean regisztr\u00e1lva legyen, miel\u0151tt kezel\u00e9si m\u0171veleteket pr\u00f3b\u00e1l meg v\u00e9grehajtani rajta. + +jmx.rest.client.attribute.not.found=CWWKX0218E: A(z) ''{0}'' MBean nem rendelkezik ''{1}'' nev\u0171 attrib\u00fatummal. +jmx.rest.client.attribute.not.found.explanation=Az MBean nem biztos\u00edtja a megadott nev\u0171 attrib\u00fatumot. +jmx.rest.client.attribute.not.found.useraction=Az MBean inform\u00e1ci\u00f3i megszerz\u00e9s\u00e9vel gy\u0151z\u0151dj\u00f6n meg arr\u00f3l, hogy milyen attrib\u00fatumokat biztos\u00edt az MBean. + +jmx.rest.client.operation.not.found=CWWKX0219E: A(z) ''{0}'' MBean nem rendelkezik ''{1}'' nev\u0171 m\u0171velettel. +jmx.rest.client.operation.not.found.explanation=Az MBean nem biztos\u00edtja a megadott nev\u0171 m\u0171veletet. +jmx.rest.client.operation.not.found.useraction=Az MBean inform\u00e1ci\u00f3i megszerz\u00e9s\u00e9vel gy\u0151z\u0151dj\u00f6n meg arr\u00f3l, hogy milyen m\u0171veleteket biztos\u00edt az MBean. + +jmx.rest.client.listener.not.found=CWWKX0220E: A megadott NotificationListener jelenleg nincs regisztr\u00e1lva, hogy \u00e9rtes\u00edt\u00e9seket fogadjon ''{0}'' MBean \u00f6sszetev\u0151t\u0151l. +jmx.rest.client.listener.not.found.explanation=A NotificationListener nem lett hozz\u00e1adva vagy m\u00e1r el lett t\u00e1vol\u00edtva, \u00e9s jelenleg nincs regisztr\u00e1lva \u00e9rtes\u00edt\u00e9sek fogad\u00e1s\u00e1ra a megadott MBean \u00f6sszetev\u0151t\u0151l. +jmx.rest.client.listener.not.found.useraction=Gondoskodjon arr\u00f3l, hogy a h\u00edv\u00f3 k\u00f3d nyomon k\u00f6vesse, hogy melyik NotificationListener \u00f6sszetev\u0151k lettek hozz\u00e1adva \u00e9s elt\u00e1vol\u00edtva, vagy fogja el \u00e9s kezelje a kiv\u00e9telt. + +jmx.rest.client.notification.lost=CWWKX0221I: Az \u00e9rtes\u00edt\u00e9st nem lehetett k\u00e9zbes\u00edteni. +jmx.rest.client.notification.lost.explanation=Egy \u00e9rtes\u00edt\u00e9st nem lehetett k\u00e9zbes\u00edteni n\u00e9h\u00e1ny NotificationListener sz\u00e1m\u00e1ra, mert egy regisztr\u00e1lt NotificationListener nem volt megtal\u00e1lhat\u00f3 vagy kiv\u00e9tel t\u00f6rt\u00e9nt az \u00e9rtes\u00edt\u00e9s k\u00e9zbes\u00edt\u00e9se sor\u00e1n. +jmx.rest.client.notification.lost.useraction=Ha az \u00e9rtes\u00edt\u00e9st k\u00e9zbes\u00edteni kellett volna egy regisztr\u00e1lt NotificationListener sz\u00e1m\u00e1ra, akkor ellen\u0151rizze a napl\u00f3kban a kiv\u00e9teleket. + +jmx.rest.client.connection.failed=CWWKX0222I: A kapcsolat a kiszolg\u00e1l\u00f3val sikertelen. +jmx.rest.client.connection.failed.explanation=A kiszolg\u00e1l\u00f3 el\u00e9rhetetlenn\u00e9 v\u00e1lt, \u00e9s nem lett \u00fajb\u00f3l el\u00e9rhet\u0151 a be\u00e1ll\u00edtott rendelkez\u00e9sre \u00e1ll\u00f3 maxim\u00e1lis id\u0151n bel\u00fcl. +jmx.rest.client.connection.failed.useraction=Ellen\u0151rizze a h\u00e1l\u00f3zati kapcsolatot, \u00e9s gondoskodjon arr\u00f3l, hogy a kiszolg\u00e1l\u00f3 enged\u00e9lyezett REST csatol\u00f3 funkci\u00f3val fusson. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: A kapcsolat a kiszolg\u00e1l\u00f3val ideiglenesen elveszett. +jmx.rest.client.connection.temporarily.lost.explanation=A kiszolg\u00e1l\u00f3 el\u00e9rhetetlenn\u00e9 v\u00e1lt, de az \u00fcgyf\u00e9l megpr\u00f3b\u00e1lja vissza\u00e1ll\u00edtani a kapcsolatot a be\u00e1ll\u00edtott rendelkez\u00e9sre \u00e1ll\u00f3 maxim\u00e1lis id\u0151n bel\u00fcl. +jmx.rest.client.connection.temporarily.lost.useraction=Ha a kiszolg\u00e1l\u00f3 sz\u00e1nd\u00e9kosan indul \u00fajra, akkor nincs teend\u0151. Ellenkez\u0151 esetben ellen\u0151rizze a h\u00e1l\u00f3zati kapcsolatot, \u00e9s gondoskodjon arr\u00f3l, hogy a kiszolg\u00e1l\u00f3 enged\u00e9lyezett REST csatol\u00f3 funkci\u00f3val fusson. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: A kapcsolat vissza\u00e1llt, de kiv\u00e9telek fordultak el\u0151 a NotificationListener elemek hozz\u00e1ad\u00e1sakor. +jmx.rest.client.connection.restored.with.exceptions.explanation=A kapcsolat a kiszolg\u00e1l\u00f3val ideiglenesen elveszett, de sikeresen helyre\u00e1llt. Kiv\u00e9telek fordultak el\u0151 a NotificationListener elemek hozz\u00e1ad\u00e1sakor, ez\u00e9rt lehet, hogy n\u00e9h\u00e1ny \u00e9rtes\u00edt\u00e9st nem lehetett fogadni. +jmx.rest.client.connection.restored.with.exceptions.useraction=Ellen\u0151rizze az \u00e9rtes\u00edt\u00e9s tartalmazott kiv\u00e9teleit, \u00e9s regisztr\u00e1lja \u00fajra a NotificationListener elemeket a probl\u00e9m\u00e1k kijav\u00edt\u00e1sa ut\u00e1n. + +jmx.rest.client.connection.restored=CWWKX0225I: A kapcsolat helyre\u00e1ll\u00edt\u00e1sa siker\u00fclt. +jmx.rest.client.connection.restored.explanation=A kapcsolat a kiszolg\u00e1l\u00f3val ideiglenesen elveszett, de sikeresen helyre\u00e1llt. A regisztr\u00e1lt NotificationListener elemek tov\u00e1bbra is kapnak \u00e9rtes\u00edt\u00e9seket. +jmx.rest.client.connection.restored.useraction=Nincs + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: A JMXServiceURL t\u00edpus\u00fa param\u00e9ter nem lehet null\u00e9rt\u00e9k. +jmx.rest.client.connection.illegal.argument.explanation=A 'serviceURL' param\u00e9ter \u00e9rt\u00e9ke nem lehet null\u00e9rt\u00e9k. +jmx.rest.client.connection.illegal.argument.useraction=Csatlakozzon \u00fajra a JMX REST csatol\u00f3hoz nem null\u00e9rt\u00e9k\u0171 JMXServiceURL \u00e9rt\u00e9kkel. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: A k\u00f6vetkez\u0151 nem \u00e9rv\u00e9nyes v\u00e9gpont\u00e9rt\u00e9k: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=A megadott v\u00e9gpont\u00e9rt\u00e9k \u00e9rv\u00e9nytelen. +jmx.rest.client.connection.invalid.endpoint.useraction=Csatlakozzon \u00fajra a JMX REST csatol\u00f3hoz karaktersorozat t\u00edpus\u00fa, "hoszt:port" form\u00e1tum\u00fa \u00e9rv\u00e9nyes v\u00e9gpont\u00e9rt\u00e9kkel. + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: A csatol\u00f3 inicializ\u00e1l\u00e1s\u00e1hoz nem tal\u00e1lhat\u00f3 el\u00e9rhet\u0151 v\u00e9gpont. +jmx.rest.client.connection.no.endpoints.explanation=A JMX REST csatol\u00f3 inicializ\u00e1l\u00e1sa sor\u00e1n egyik megadott v\u00e9gpont sem \u00e9rhet\u0151 el. +jmx.rest.client.connection.no.endpoints.useraction=Csatlakozzon \u00fajra a JMX REST csatol\u00f3hoz legal\u00e1bb 1 el\u00e9rhet\u0151 v\u00e9gpont haszn\u00e1lat\u00e1val. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Probl\u00e9ma volt a megadott felhaszn\u00e1l\u00f3 hiteles\u00edt\u00e9si adatokkal. A kiszolg\u00e1l\u00f3 {0} k\u00f3ddal \u00e9s ''{1}'' \u00fczenettel v\u00e1laszolt. +jmx.rest.client.bad.user.credentials.explanation=A megadott hiteles\u00edt\u00e9si adatok helytelenek, lej\u00e1rtak vagy jogosults\u00e1guk megtagad\u00e1sra ker\u00fclt. +jmx.rest.client.bad.user.credentials.useraction=Gy\u0151z\u0151dj\u00f6n meg r\u00f3la, hogy a felhaszn\u00e1l\u00f3 hiteles\u00edt\u00e9si adatok hiteles\u00edt\u00e9se \u00e9s jogosults\u00e1ga helyes, majd alak\u00edtson ki \u00faj kapcsolatot. + +jmx.rest.client.connection.connect=CWWKX0230I: Az egy\u00fcttes tag megnyitotta az JMX \u00fcgyfelet az egy\u00fcttes vez\u00e9rl\u0151h\u00f6z: {0} +jmx.rest.client.connection.connect.explanation=A tag csatlakoztat\u00e1sra ker\u00fclt a vez\u00e9rl\u0151h\u00f6z. +jmx.rest.client.connection.connect.useraction=Semmit sem kell tennie. + +jmx.rest.client.connection.disconnect=CWWKX0231I: Az egy\u00fcttes tag lez\u00e1rta az JMX \u00fcgyfelet az egy\u00fcttes vez\u00e9rl\u0151vel: {0} +jmx.rest.client.connection.disconnect.explanation=A tag vez\u00e9rl\u0151h\u00f6z val\u00f3 csatlakoz\u00e1sa megsz\u0171nt. +jmx.rest.client.connection.disconnect.useraction=Semmit sem kell tennie. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_it.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_it.nlsprops new file mode 100755 index 00000000000..f127d779fc3 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_it.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Il client REST WebSphere Java Management Extensions ha rilevato un errore durante la preparazione della richiesta al server per l''URL {0} sulla connessione {1} +jmx.rest.client.request.error.explanation=Il client REST WebSphere Java Management Extensions ha rilevato un errore durante la preparazione di una richiesta per il server. +jmx.rest.client.request.error.useraction=Per ulteriori informazioni, esaminare i log del server. + +jmx.rest.client.response.error=CWWKX0202E: Il client REST WebSphere Java Management Extensions non \u00e8 riuscito ad elaborare la risposta dal server per l''URL {0} sulla connessione {1} +jmx.rest.client.response.error.explanation=Il client REST WebSphere Java Management Extensions non \u00e8 riuscito ad elaborare una risposta dal server +jmx.rest.client.response.error.useraction=Per ulteriori informazioni, esaminare i log del server. + +jmx.rest.client.response.code.error=CWWKX0203E: Il client REST WebSphere Java Management Extensions ha ricevuto un codice di risposta imprevisto {0} con il messaggio ''{1}'' dal server per l''URL {2} sulla connessione {3} +jmx.rest.client.response.code.error.explanation=Il client REST WebSphere Java Management Extensions ha ricevuto un codice di risposta imprevisto dal server +jmx.rest.client.response.code.error.useraction=Per ulteriori informazioni, esaminare i log del server. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Impossibile analizzare l'oggetto Throwable dal flusso di errori del server. +jmx.rest.client.server.throwable.exception.explanation=Il server ha generato un'eccezione durante la gestione della richiesta del client, ma il client non \u00e8 stato in grado di analizzare l'oggetto Throwable proveniente dal flusso di errori del server. La classe dell'oggetto Throwable potrebbe non essere disponibile per il client. +jmx.rest.client.server.throwable.exception.useraction=Per ulteriori informazioni, esaminare i log del server. + +jmx.rest.client.not.connected=CWWKX0206E: Il client non \u00e8 connesso al server. +jmx.rest.client.not.connected.explanation=La connessione al server \u00e8 stata chiusa o ha avuto esito negativo. +jmx.rest.client.not.connected.useraction=Controllare che la funzione connettore REST sia abilitata sul server e ottenere una nuova connessione al server. + +jmx.rest.client.url.not.found=CWWKX0207E: Il server ha notificato che l'URL richiesto dal client non \u00e8 stato trovato. +jmx.rest.client.url.not.found.explanation=\u00c8 possibile che il client abbia informazioni non aggiornate o che la funzione connettore REST sul server sia stata disabilitata. +jmx.rest.client.url.not.found.useraction=Controllare che la funzione connettore REST sia abilitata sul server e ottenere una nuova connessione al server. + +jmx.rest.client.class.name.null=CWWKX0208E: L'argomento nome classe \u00e8 null. +jmx.rest.client.class.name.null.explanation=L'argomento nome classe non deve essere null. +jmx.rest.client.class.name.null.useraction=Fornire un nome classe che non sia null durante la chiamata del metodo. + +jmx.rest.client.attribute.name.null=CWWKX0209E: L'argomento nome attributo \u00e8 null. +jmx.rest.client.attribute.name.null.explanation=L'argomento nome attributo non deve essere null. +jmx.rest.client.attribute.name.null.useraction=Fornire un nome attributo che non sia null durante la chiamata del metodo. + +jmx.rest.client.attribute.names.null=CWWKX0210E: L'argomento contenente un array di nomi attributo \u00e8 null. +jmx.rest.client.attribute.names.null.explanation=L'argomento contenente un array di nomi attributo non deve essere null. +jmx.rest.client.attribute.names.null.useraction=Fornire un array non null di nomi attributo durante la chiamata del metodo. + +jmx.rest.client.attribute.null=CWWKX0211E: L'argomento Attribute \u00e8 null. +jmx.rest.client.attribute.null.explanation=L'argomento Attribute non deve essere null. +jmx.rest.client.attribute.null.useraction=Fornire un argomento Attribute che non sia null durante la chiamata del metodo. + +jmx.rest.client.attribute.list.null=CWWKX0212E: L'argomento AttributeList \u00e8 null. +jmx.rest.client.attribute.list.null.explanation=L'argomento AttributeList non deve essere null. +jmx.rest.client.attribute.list.null.useraction=Fornire un argomento AttributeList che non sia null durante la chiamata del metodo. + +jmx.rest.client.object.name.null=CWWKX0213E: L'argomento ObjectName \u00e8 null. +jmx.rest.client.object.name.null.explanation=L'argomento ObjectName non deve essere null. +jmx.rest.client.object.name.null.useraction=Fornire un argomento ObjectName che non sia null durante la chiamata del metodo. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Un oggetto Throwable imprevisto \u00e8 stato restituito dal server. +jmx.rest.client.unexpected.server.throwable.explanation=L'eccezione include un oggetto Throwable restituito dal server che normalmente non \u00e8 previsto per questa operazione. +jmx.rest.client.unexpected.server.throwable.useraction=Per ulteriori informazioni, esaminare i log del server. + +jmx.rest.client.bad.credentials=CWWKX0215E: Si \u00e8 verificato un problema con il nome utente o la password forniti. Il server ha risposto con il codice {0} e il messaggio ''{1}'' +jmx.rest.client.bad.credentials.explanation=Le credenziali fornite durante il tentativo di ottenere una connessione non erano corrette. L'utente non esiste o non dispone dell'autorizzazione per accedere al server, oppure la password non \u00e8 corretta. +jmx.rest.client.bad.credentials.useraction=Correggere il nome utente o la password, quindi ottenere la connessione. + +jmx.rest.client.object.name.pattern=CWWKX0216E: L''argomento ObjectName ''{0}'' \u00e8 un pattern." +jmx.rest.client.object.name.pattern.explanation=L'argomento ObjectName \u00e8 un pattern, ma il metodo richiede un ObjectName che corrisponda esattamente a un MBean. +jmx.rest.client.object.name.pattern.useraction=Fornire un argomento ObjectName, senza caratteri jolly, che corrisponda esattamente a un MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Nessun MBean correntemente registrato con l''ObjectName fornito ''{0}'' +jmx.rest.client.instance.not.found.explanation=L'operazione richiede un MBean registrato, ma non \u00e8 stato registrato alcun MBean con l'ObjectName fornito. +jmx.rest.client.instance.not.found.useraction=Verificare che l'MBean sia registrato prima di tentare di eseguire operazioni di gestione su esso. + +jmx.rest.client.attribute.not.found=CWWKX0218E: L''MBean ''{0}'' non dispone di un attributo con il nome ''{1}'' +jmx.rest.client.attribute.not.found.explanation=L'MBean non fornisce un attributo con il nome indicato. +jmx.rest.client.attribute.not.found.useraction=Richiamare le informazioni dell'MBean per verificare quali attributi fornisce. + +jmx.rest.client.operation.not.found=CWWKX0219E: L''MBean ''{0}'' non dispone di un''operazione con il nome ''{1}'' +jmx.rest.client.operation.not.found.explanation=L'MBean non fornisce un'operazione con il nome indicato. +jmx.rest.client.operation.not.found.useraction=Richiamare le informazioni dell'MBean per verificare quali operazioni fornisce. + +jmx.rest.client.listener.not.found=CWWKX0220E: Il NotificationListener fornito non \u00e8 correntemente registrato per ricevere notifiche dall''MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=Il NotificationListener non \u00e8 stato aggiunto o \u00e8 gi\u00e0 stato rimosso e non \u00e8 correntemente registrato per ricevere notifiche dall'MBean indicato. +jmx.rest.client.listener.not.found.useraction=Assicurarsi che il codice chiamante tenga traccia di quali NotificationListener sono stati aggiunti e rimossi o catturi e gestisca l'eccezione. + +jmx.rest.client.notification.lost=CWWKX0221I: Impossibile consegnare la notifica. +jmx.rest.client.notification.lost.explanation=Non \u00e8 stato possibile consegnare una notifica a uno o pi\u00f9 NotificationListener perch\u00e9 non \u00e8 stato trovato un NotificationListener registrato o si \u00e8 verificata un'eccezione durante la consegna della notifica. +jmx.rest.client.notification.lost.useraction=Se la notifica doveva essere consegnata a un NotificationListener registrato, cercare eventuali eccezioni nei log. + +jmx.rest.client.connection.failed=CWWKX0222I: La connessione al server ha avuto esito negativo. +jmx.rest.client.connection.failed.explanation=Il server \u00e8 diventato indisponibile e non \u00e8 tornato disponibile entro il tempo massimo consentito configurato. +jmx.rest.client.connection.failed.useraction=Controllare la connessione di rete e assicurarsi che il server sia in esecuzione con la funzione connettore REST abilitata. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: La connessione al server \u00e8 stata temporaneamente persa. +jmx.rest.client.connection.temporarily.lost.explanation=Il server \u00e8 diventato indisponibile, ma il client tenter\u00e0 di ripristinare la connessione per la durata del tempo massimo consentito configurato. +jmx.rest.client.connection.temporarily.lost.useraction=Se il riavvio del server \u00e8 intenzionale, non sono richieste azioni. In caso contrario, controllare la connessione di rete e assicurarsi che il server sia in esecuzione con la funzione connettore REST abilitata. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: La connessione \u00e8 stata ripristinata, ma si sono verificate eccezioni durante l'aggiunta dei NotificationListener. +jmx.rest.client.connection.restored.with.exceptions.explanation=La connessione al server \u00e8 stata temporaneamente persa, ma \u00e8 stata correttamente ripristinata. Si sono verificate eccezioni durante l'aggiunta dei NotificationListener, quindi \u00e8 possibile che non si ricevano alcune notifiche. +jmx.rest.client.connection.restored.with.exceptions.useraction=Controllare le eccezioni incluse con la notifica e registrare nuovamente i NotificationListener dopo aver risolto i problemi. + +jmx.rest.client.connection.restored=CWWKX0225I: La connessione \u00e8 stata ripristinata correttamente. +jmx.rest.client.connection.restored.explanation=La connessione al server \u00e8 stata temporaneamente persa, ma \u00e8 stata correttamente ripristinata. Tutti i NotificationListener registrati continueranno a ricevere le notifiche. +jmx.rest.client.connection.restored.useraction=Nessuno + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Il parametro di tipo JMXServiceURL non pu\u00f2 essere null. +jmx.rest.client.connection.illegal.argument.explanation=Il valore per il parametro 'serviceURL' non pu\u00f2 essere null. +jmx.rest.client.connection.illegal.argument.useraction=Ripetere la connessione al connettore REST JMX utilizzando un valore JMXServiceURL che non sia null. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: Il seguente valore endpoint non \u00e8 valido: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=Il valore endpoint specificato non \u00e8 valido. +jmx.rest.client.connection.invalid.endpoint.useraction=Ripetere la connessione al connettore REST JMX utilizzando un valore endpoint valido di tipo stringa e nel formato "host:porta". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Impossibile trovare endpoint disponibili per inizializzare il connettore. +jmx.rest.client.connection.no.endpoints.explanation=Nessuno degli endpoint specificati era disponibile durante l'inizializzazione del connettore REST JMX. +jmx.rest.client.connection.no.endpoints.useraction=Ripetere la connessione al connettore REST JMX utilizzando almeno un endpoint disponibile. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Si \u00e8 verificato un problema con le credenziali utente fornite. Il server ha risposto con il codice {0} e il messaggio ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=Le credenziali utente fornite non sono corrette, sono scadute, incomplete oppure non dispongono dell'autorizzazione. +jmx.rest.client.bad.user.credentials.useraction=Verificare che le credenziali utente dispongano dell'autenticazione e dell'autorizzazione corrette, quindi ottenere una nuova connessione. + +jmx.rest.client.connection.connect=CWWKX0230I: Il membro collective ha aperto il client JMX sul collective controller: {0} +jmx.rest.client.connection.connect.explanation=Il membro \u00e8 connesso al controllore. +jmx.rest.client.connection.connect.useraction=Nessuna azione richiesta. + +jmx.rest.client.connection.disconnect=CWWKX0231I: Il membro collective ha chiuso il client JMX dal collective controller: {0} +jmx.rest.client.connection.disconnect.explanation=Il membro \u00e8 disconnesso dal controllore. +jmx.rest.client.connection.disconnect.useraction=Nessuna azione richiesta. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ja.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ja.nlsprops new file mode 100755 index 00000000000..fd285d2741d --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ja.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u63a5\u7d9a {1} \u4e0a\u306e URL {0} \u306b\u95a2\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u8981\u6c42\u306e\u6e96\u5099\u4e2d\u306b\u30a8\u30e9\u30fc\u3092\u691c\u51fa\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.request.error.explanation=WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u8981\u6c42\u306e\u6e96\u5099\u4e2d\u306b\u30a8\u30e9\u30fc\u3092\u691c\u51fa\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.request.error.useraction=\u3055\u3089\u306a\u308b\u60c5\u5831\u304c\u306a\u3044\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.response.error=CWWKX0202E: WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u63a5\u7d9a {1} \u4e0a\u306e URL {0} \u306b\u95a2\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u306e\u5fdc\u7b54\u3092\u51e6\u7406\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.response.error.explanation=WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u306e\u5fdc\u7b54\u3092\u51e6\u7406\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.response.error.useraction=\u3055\u3089\u306a\u308b\u60c5\u5831\u304c\u306a\u3044\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.response.code.error=CWWKX0203E: WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u63a5\u7d9a {3} \u4e0a\u306e URL {2} \u306b\u95a2\u3059\u308b\u30e1\u30c3\u30bb\u30fc\u30b8 ''{1}'' \u4ed8\u304d\u306e\u4e88\u671f\u3057\u306a\u3044\u5fdc\u7b54\u30b3\u30fc\u30c9 {0} \u3092\u53d7\u4fe1\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.response.code.error.explanation=WebSphere Java Management Extensions REST \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3001\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u4e88\u671f\u3057\u306a\u3044\u5fdc\u7b54\u30b3\u30fc\u30c9\u3092\u53d7\u4fe1\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.response.code.error.useraction=\u3055\u3089\u306a\u308b\u60c5\u5831\u304c\u306a\u3044\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.server.throwable.exception=CWWKX0204E: \u30b5\u30fc\u30d0\u30fc\u30fb\u30a8\u30e9\u30fc\u30fb\u30b9\u30c8\u30ea\u30fc\u30e0\u304b\u3089 Throwable \u3092\u89e3\u6790\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.server.throwable.exception.explanation=\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u8981\u6c42\u306e\u51e6\u7406\u4e2d\u306b\u30b5\u30fc\u30d0\u30fc\u3067\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u304c\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306f\u30b5\u30fc\u30d0\u30fc\u30fb\u30a8\u30e9\u30fc\u30fb\u30b9\u30c8\u30ea\u30fc\u30e0\u304b\u3089 Throwable \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u89e3\u6790\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 Throwable \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30af\u30e9\u30b9\u304c\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3067\u4f7f\u7528\u3067\u304d\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +jmx.rest.client.server.throwable.exception.useraction=\u3055\u3089\u306a\u308b\u60c5\u5831\u304c\u306a\u3044\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.not.connected=CWWKX0206E: \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306f\u30b5\u30fc\u30d0\u30fc\u306b\u63a5\u7d9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +jmx.rest.client.not.connected.explanation=\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u304c\u30af\u30ed\u30fc\u30ba\u3057\u305f\u304b\u3001\u307e\u305f\u306f\u5931\u6557\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.not.connected.useraction=REST \u30b3\u30cd\u30af\u30bf\u30fc\u30fb\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u304c\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067\u4f7f\u7528\u53ef\u80fd\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3001\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u65b0\u898f\u63a5\u7d9a\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.url.not.found=CWWKX0207E: \u30b5\u30fc\u30d0\u30fc\u3067\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u3088\u3063\u3066\u8981\u6c42\u3055\u308c\u305f URL \u304c\u898b\u3064\u304b\u3089\u306a\u3044\u3053\u3068\u304c\u5831\u544a\u3055\u308c\u307e\u3057\u305f\u3002 +jmx.rest.client.url.not.found.explanation=\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u53e4\u3044\u60c5\u5831\u304c\u4fdd\u6301\u3055\u308c\u3066\u3044\u308b\u304b\u3001\u307e\u305f\u306f\u30b5\u30fc\u30d0\u30fc\u4e0a\u306e REST \u30b3\u30cd\u30af\u30bf\u30fc\u30fb\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u304c\u4f7f\u7528\u4e0d\u53ef\u306b\u306a\u3063\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +jmx.rest.client.url.not.found.useraction=REST \u30b3\u30cd\u30af\u30bf\u30fc\u30fb\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u304c\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067\u4f7f\u7528\u53ef\u80fd\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3001\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u65b0\u898f\u63a5\u7d9a\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.class.name.null=CWWKX0208E: \u30af\u30e9\u30b9\u540d\u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.class.name.null.explanation=\u30af\u30e9\u30b9\u540d\u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.class.name.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e\u30af\u30e9\u30b9\u540d\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.attribute.name.null=CWWKX0209E: \u5c5e\u6027\u540d\u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.attribute.name.null.explanation=\u5c5e\u6027\u540d\u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.attribute.name.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e\u5c5e\u6027\u540d\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.attribute.names.null=CWWKX0210E: \u5c5e\u6027\u540d\u306e\u914d\u5217\u3092\u542b\u3080\u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.attribute.names.null.explanation=\u5c5e\u6027\u540d\u306e\u914d\u5217\u3092\u542b\u3080\u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.attribute.names.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e\u5c5e\u6027\u540d\u306e\u914d\u5217\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.attribute.null=CWWKX0211E: Attribute \u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.attribute.null.explanation=Attribute \u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.attribute.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e Attribute \u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.attribute.list.null=CWWKX0212E: AttributeList \u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.attribute.list.null.explanation=AttributeList \u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.attribute.list.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e AttributeList \u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.object.name.null=CWWKX0213E: ObjectName \u5f15\u6570\u304c NULL \u3067\u3057\u305f\u3002 +jmx.rest.client.object.name.null.explanation=ObjectName \u5f15\u6570\u3092 NULL \u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.object.name.null.useraction=\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u6642\u306b NULL \u4ee5\u5916\u306e ObjectName \u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: \u30b5\u30fc\u30d0\u30fc\u304b\u3089\u4e88\u671f\u3057\u306a\u3044 Throwable \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u8fd4\u3055\u308c\u307e\u3057\u305f\u3002 +jmx.rest.client.unexpected.server.throwable.explanation=\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u8fd4\u3055\u308c\u305f\u3001\u3053\u306e\u64cd\u4f5c\u306b\u5bfe\u3057\u3066\u901a\u5e38\u306f\u4e88\u671f\u3055\u308c\u306a\u3044 Throwable \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4f8b\u5916\u306b\u3088\u308a\u30e9\u30c3\u30d7\u3055\u308c\u3066\u3044\u307e\u3059\u3002 +jmx.rest.client.unexpected.server.throwable.useraction=\u3055\u3089\u306a\u308b\u60c5\u5831\u304c\u306a\u3044\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u30fb\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.bad.credentials=CWWKX0215E: \u6307\u5b9a\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u540d\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u306b\u554f\u984c\u304c\u3042\u308a\u307e\u3059\u3002 \u30b5\u30fc\u30d0\u30fc\u306f\u3001\u30b3\u30fc\u30c9 {0}\u3001\u30e1\u30c3\u30bb\u30fc\u30b8 ''{1}'' \u3067\u5fdc\u7b54\u3057\u307e\u3057\u305f +jmx.rest.client.bad.credentials.explanation=\u63a5\u7d9a\u306e\u53d6\u5f97\u6642\u306b\u6307\u5b9a\u3057\u305f\u8cc7\u683c\u60c5\u5831\u306b\u8aa4\u308a\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u30e6\u30fc\u30b6\u30fc\u304c\u5b58\u5728\u3057\u306a\u3044\u304b\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u304c\u306a\u3044\u304b\u3001\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u306b\u8aa4\u308a\u304c\u3042\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +jmx.rest.client.bad.credentials.useraction=\u30e6\u30fc\u30b6\u30fc\u540d\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a02\u6b63\u3057\u3066\u304b\u3089\u65b0\u898f\u63a5\u7d9a\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.object.name.pattern=CWWKX0216E: ObjectName \u5f15\u6570 ''{0}'' \u306f\u30d1\u30bf\u30fc\u30f3\u3067\u3059\u3002 +jmx.rest.client.object.name.pattern.explanation=ObjectName \u5f15\u6570\u304c\u30d1\u30bf\u30fc\u30f3\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u30e1\u30bd\u30c3\u30c9\u306b\u306f\u30011 \u3064\u306e MBean \u3068\u5b8c\u5168\u306b\u4e00\u81f4\u3059\u308b ObjectName \u304c\u5fc5\u8981\u3067\u3059\u3002 +jmx.rest.client.object.name.pattern.useraction=1 \u3064\u306e MBean \u3068\u5b8c\u5168\u306b\u4e00\u81f4\u3059\u308b\u3001\u30ef\u30a4\u30eb\u30c9\u30ab\u30fc\u30c9\u306a\u3057\u306e ObjectName \u5f15\u6570\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.instance.not.found=CWWKX0217E: \u6307\u5b9a\u3055\u308c\u305f ObjectName ''{0}'' \u306b\u73fe\u5728\u767b\u9332\u6e08\u307f\u306e MBean \u306f\u3042\u308a\u307e\u305b\u3093 +jmx.rest.client.instance.not.found.explanation=\u3053\u306e\u64cd\u4f5c\u306b\u306f\u767b\u9332\u6e08\u307f\u306e MBean \u304c\u5fc5\u8981\u3067\u3059\u304c\u3001\u6307\u5b9a\u3055\u308c\u305f ObjectName \u306e MBean \u306f\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.instance.not.found.useraction=MBean \u304c\u767b\u9332\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u3001\u3053\u308c\u306b\u5bfe\u3059\u308b\u7ba1\u7406\u64cd\u4f5c\u3092\u5b9f\u884c\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.attribute.not.found=CWWKX0218E: MBean ''{0}'' \u306b ''{1}'' \u3068\u3044\u3046\u540d\u524d\u306e\u5c5e\u6027\u306f\u3042\u308a\u307e\u305b\u3093 +jmx.rest.client.attribute.not.found.explanation=\u6307\u5b9a\u3055\u308c\u305f\u540d\u524d\u306e\u5c5e\u6027\u306f MBean \u3067\u306f\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +jmx.rest.client.attribute.not.found.useraction=MBean \u60c5\u5831\u3092\u53d6\u5f97\u3057\u3066\u3001MBean \u304c\u63d0\u4f9b\u3059\u308b\u5c5e\u6027\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.operation.not.found=CWWKX0219E: MBean ''{0}'' \u306b ''{1}'' \u3068\u3044\u3046\u540d\u524d\u306e\u64cd\u4f5c\u306f\u3042\u308a\u307e\u305b\u3093 +jmx.rest.client.operation.not.found.explanation=\u6307\u5b9a\u3055\u308c\u305f\u540d\u524d\u306e\u64cd\u4f5c\u306f MBean \u3067\u306f\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +jmx.rest.client.operation.not.found.useraction=MBean \u60c5\u5831\u3092\u53d6\u5f97\u3057\u3066\u3001MBean \u304c\u63d0\u4f9b\u3059\u308b\u64cd\u4f5c\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.listener.not.found=CWWKX0220E: \u6307\u5b9a\u3055\u308c\u305f NotificationListener \u306f\u73fe\u5728\u3001MBean ''{0}'' \u304b\u3089\u306e\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b\u3088\u3046\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u305b\u3093 +jmx.rest.client.listener.not.found.explanation=NotificationListener \u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u306a\u3044\u304b\u3001\u307e\u305f\u306f\u65e2\u306b\u524a\u9664\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u73fe\u5728\u3001\u6307\u5b9a\u3055\u308c\u305f MBean \u304b\u3089\u306e\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b\u3088\u3046\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +jmx.rest.client.listener.not.found.useraction=\u547c\u3073\u51fa\u3057\u30b3\u30fc\u30c9\u3067\u3001\u3069\u306e NotificationListener \u304c\u8ffd\u52a0\u304a\u3088\u3073\u524a\u9664\u3055\u308c\u305f\u304b\u3092\u8ffd\u8de1\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u304b\u3001\u307e\u305f\u306f\u4f8b\u5916\u3092\u30ad\u30e3\u30c3\u30c1\u3057\u3066\u51e6\u7406\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.notification.lost=CWWKX0221I: \u901a\u77e5\u3092\u9001\u4fe1\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.notification.lost.explanation=\u767b\u9332\u6e08\u307f\u306e NotificationListener \u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u304b\u3001\u901a\u77e5\u306e\u9001\u4fe1\u4e2d\u306b\u4f8b\u5916\u304c\u767a\u751f\u3057\u305f\u305f\u3081\u30011 \u3064\u4ee5\u4e0a\u306e NotificationListener \u306b\u3053\u306e\u901a\u77e5\u3092\u9001\u4fe1\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.notification.lost.useraction=\u767b\u9332\u6e08\u307f\u306e NotificationListener \u306b\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u3066\u3044\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u4f8b\u5916\u304c\u306a\u3044\u304b\u30ed\u30b0\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.failed=CWWKX0222I: \u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u304c\u5931\u6557\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.failed.explanation=\u30b5\u30fc\u30d0\u30fc\u304c\u4f7f\u7528\u4e0d\u53ef\u306b\u306a\u308a\u3001\u3055\u3089\u306b\u3001\u69cb\u6210\u6e08\u307f\u306e\u6700\u5927\u8a31\u5bb9\u6642\u9593\u5185\u306b\u518d\u5ea6\u4f7f\u7528\u53ef\u80fd\u306b\u306a\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.connection.failed.useraction=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u63a5\u7d9a\u3092\u78ba\u8a8d\u3057\u3001REST \u30b3\u30cd\u30af\u30bf\u30fc\u30fb\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u304c\u4f7f\u7528\u53ef\u80fd\u306a\u72b6\u614b\u3067\u30b5\u30fc\u30d0\u30fc\u304c\u7a3c\u50cd\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: \u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u304c\u4e00\u6642\u7684\u306b\u5931\u308f\u308c\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.temporarily.lost.explanation=\u30b5\u30fc\u30d0\u30fc\u306f\u4f7f\u7528\u4e0d\u53ef\u306b\u306a\u308a\u307e\u3057\u305f\u304c\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306f\u69cb\u6210\u6e08\u307f\u306e\u6700\u5927\u8a31\u5bb9\u6642\u9593\u4e2d\u306b\u63a5\u7d9a\u306e\u5fa9\u5143\u3092\u8a66\u884c\u3057\u307e\u3059\u3002 +jmx.rest.client.connection.temporarily.lost.useraction=\u30b5\u30fc\u30d0\u30fc\u304c\u610f\u56f3\u7684\u306b\u518d\u59cb\u52d5\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u51e6\u7f6e\u306f\u4e0d\u8981\u3067\u3059\u3002 \u305d\u308c\u4ee5\u5916\u306e\u5834\u5408\u306b\u306f\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u63a5\u7d9a\u3092\u78ba\u8a8d\u3057\u3001REST \u30b3\u30cd\u30af\u30bf\u30fc\u30fb\u30d5\u30a3\u30fc\u30c1\u30e3\u30fc\u304c\u4f7f\u7528\u53ef\u80fd\u306a\u72b6\u614b\u3067\u30b5\u30fc\u30d0\u30fc\u304c\u7a3c\u50cd\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: \u63a5\u7d9a\u306f\u5fa9\u5143\u3055\u308c\u307e\u3057\u305f\u304c\u3001NotificationListener \u306e\u8ffd\u52a0\u6642\u306b\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.restored.with.exceptions.explanation=\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u306f\u4e00\u6642\u7684\u306b\u5931\u308f\u308c\u307e\u3057\u305f\u304c\u3001\u6b63\u5e38\u306b\u5fa9\u5143\u3055\u308c\u307e\u3057\u305f\u3002 NotificationListener \u306e\u8ffd\u52a0\u6642\u306b\u4f8b\u5916\u304c\u767a\u751f\u3057\u305f\u305f\u3081\u3001\u4e00\u90e8\u306e\u901a\u77e5\u304c\u53d7\u3051\u53d6\u3089\u308c\u3066\u3044\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +jmx.rest.client.connection.restored.with.exceptions.useraction=\u901a\u77e5\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u4f8b\u5916\u3092\u78ba\u8a8d\u3057\u3001\u554f\u984c\u306e\u8a02\u6b63\u5f8c\u306b NotificationListener \u3092\u518d\u767b\u9332\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.restored=CWWKX0225I: \u63a5\u7d9a\u304c\u6b63\u5e38\u306b\u5fa9\u5143\u3055\u308c\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.restored.explanation=\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u306f\u4e00\u6642\u7684\u306b\u5931\u308f\u308c\u307e\u3057\u305f\u304c\u3001\u6b63\u5e38\u306b\u5fa9\u5143\u3055\u308c\u307e\u3057\u305f\u3002 \u767b\u9332\u6e08\u307f\u306e NotificationListener \u306f\u5f15\u304d\u7d9a\u304d\u901a\u77e5\u306e\u53d7\u3051\u53d6\u308a\u3092\u884c\u3044\u307e\u3059\u3002 +jmx.rest.client.connection.restored.useraction=\u306a\u3057 + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: \u30bf\u30a4\u30d7 JMXServiceURL \u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306f\u30cc\u30eb\u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.connection.illegal.argument.explanation=\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u300cserviceURL\u300d\u306e\u5024\u3092\u30cc\u30eb\u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +jmx.rest.client.connection.illegal.argument.useraction=\u30cc\u30eb\u4ee5\u5916\u306e JMXServiceURL \u306e\u5024\u3092\u4f7f\u7528\u3057\u3066 JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306b\u518d\u63a5\u7d9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: \u6b21\u306e\u5024\u306f\u6709\u52b9\u306a\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u5024\u3067\u306f\u3042\u308a\u307e\u305b\u3093: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=\u6307\u5b9a\u3055\u308c\u305f\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u5024\u304c\u7121\u52b9\u3067\u3059\u3002 +jmx.rest.client.connection.invalid.endpoint.useraction=\u30bf\u30a4\u30d7\u304c\u30b9\u30c8\u30ea\u30f3\u30b0\u3067\u3001\u300chost:port\u300d\u306e\u5f62\u5f0f\u306e\u6709\u52b9\u306a\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u5024\u3092\u4f7f\u7528\u3057\u3066 JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306b\u518d\u63a5\u7d9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: \u30b3\u30cd\u30af\u30bf\u30fc\u3092\u521d\u671f\u8a2d\u5b9a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u53ef\u80fd\u306a\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u898b\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.connection.no.endpoints.explanation=\u6307\u5b9a\u3055\u308c\u305f\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306f\u3001JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306e\u521d\u671f\u8a2d\u5b9a\u6642\u306b\u3044\u305a\u308c\u3082\u4f7f\u7528\u53ef\u80fd\u3067\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +jmx.rest.client.connection.no.endpoints.useraction=\u4f7f\u7528\u53ef\u80fd\u306a\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u5c11\u306a\u304f\u3068\u3082 1 \u3064\u4f7f\u7528\u3057\u3066 JMX REST \u30b3\u30cd\u30af\u30bf\u30fc\u306b\u518d\u63a5\u7d9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.bad.user.credentials=CWWKX0229E: \u6307\u5b9a\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u8cc7\u683c\u60c5\u5831\u306b\u554f\u984c\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u30b5\u30fc\u30d0\u30fc\u306f\u3001\u30b3\u30fc\u30c9 {0}\u3001\u30e1\u30c3\u30bb\u30fc\u30b8 ''{1}'' \u3067\u5fdc\u7b54\u3057\u307e\u3057\u305f +jmx.rest.client.bad.user.credentials.explanation=\u6307\u5b9a\u3055\u308c\u305f\u8cc7\u683c\u60c5\u5831\u306f\u3001\u8aa4\u3063\u3066\u3044\u308b\u304b\u3001\u6709\u52b9\u671f\u9650\u304c\u5207\u308c\u3066\u3044\u308b\u304b\u3001\u4e0d\u5b8c\u5168\u3067\u3042\u308b\u304b\u3001\u307e\u305f\u306f\u8a31\u53ef\u304c\u62d2\u5426\u3055\u308c\u3066\u3044\u307e\u3059\u3002 +jmx.rest.client.bad.user.credentials.useraction=\u30e6\u30fc\u30b6\u30fc\u8cc7\u683c\u60c5\u5831\u304c\u3001\u6b63\u3057\u304f\u8a8d\u8a3c\u304a\u3088\u3073\u8a31\u53ef\u3055\u308c\u308b\u3082\u306e\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u3001\u65b0\u898f\u63a5\u7d9a\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002 + +jmx.rest.client.connection.connect=CWWKX0230I: \u96c6\u5408\u30e1\u30f3\u30d0\u30fc\u306f\u3001\u96c6\u5408\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u5bfe\u3057\u3066 JMX \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u958b\u304d\u307e\u3057\u305f: {0} +jmx.rest.client.connection.connect.explanation=\u30e1\u30f3\u30d0\u30fc\u304c\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u63a5\u7d9a\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.connect.useraction=\u30a2\u30af\u30b7\u30e7\u30f3\u306f\u4e0d\u8981\u3067\u3059\u3002 + +jmx.rest.client.connection.disconnect=CWWKX0231I: \u96c6\u5408\u30e1\u30f3\u30d0\u30fc\u306f\u3001\u96c6\u5408\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304b\u3089\u306e JMX \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u9589\u3058\u307e\u3057\u305f: {0} +jmx.rest.client.connection.disconnect.explanation=\u30e1\u30f3\u30d0\u30fc\u304c\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3068\u306e\u63a5\u7d9a\u3092\u5207\u65ad\u3057\u307e\u3057\u305f\u3002 +jmx.rest.client.connection.disconnect.useraction=\u30a2\u30af\u30b7\u30e7\u30f3\u306f\u4e0d\u8981\u3067\u3059\u3002 + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ko.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ko.nlsprops new file mode 100755 index 00000000000..5b0b222d7fb --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ko.nlsprops @@ -0,0 +1,144 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc5f0\uacb0 {1}\uc5d0\uc11c URL {0}\uc758 \uc11c\ubc84\ub85c \uc694\uccad\uc744 \uc900\ube44\ud558\ub294 \ub3d9\uc548 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.request.error.explanation=WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84\uc758 \uc694\uccad\uc744 \uc900\ube44\ud558\ub294 \ub3d9\uc548 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.request.error.useraction=\uc790\uc138\ud55c \uc815\ubcf4\ub294 \uc11c\ubc84 \ub85c\uadf8\ub97c \uc0b4\ud3b4\ubcf4\uc2ed\uc2dc\uc624. + +jmx.rest.client.response.error=CWWKX0202E: WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc5f0\uacb0 {1}\uc5d0\uc11c URL {0}\uc758 \uc11c\ubc84\uc5d0\uc11c \uc751\ub2f5\uc744 \ucc98\ub9ac\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.response.error.explanation=WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84\uc5d0\uc11c \uc751\ub2f5\uc744 \ucc98\ub9ac\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.response.error.useraction=\uc790\uc138\ud55c \uc815\ubcf4\ub294 \uc11c\ubc84 \ub85c\uadf8\ub97c \uc0b4\ud3b4\ubcf4\uc2ed\uc2dc\uc624. + +jmx.rest.client.response.code.error=CWWKX0203E: WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc5f0\uacb0 {3}\uc5d0\uc11c URL {2}\uc758 \uc11c\ubc84\uc5d0\uc11c \uba54\uc2dc\uc9c0 ''{1}''\uc774(\uac00) \ud45c\uc2dc\ub418\ub294 \uc608\uc0c1\uce58 \uc54a\uc740 \uc751\ub2f5 \ucf54\ub4dc{0}\uc744(\ub97c) \uc218\uc2e0\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.response.code.error.explanation=WebSphere Java Management Extensions REST \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84\uc5d0\uc11c \uc608\uc0c1\uce58 \uc54a\uc740 \uc751\ub2f5 \ucf54\ub4dc\ub97c \uc218\uc2e0\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.response.code.error.useraction=\uc790\uc138\ud55c \uc815\ubcf4\ub294 \uc11c\ubc84 \ub85c\uadf8\ub97c \uc0b4\ud3b4\ubcf4\uc2ed\uc2dc\uc624. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: \uc11c\ubc84 \uc624\ub958 \uc2a4\ud2b8\ub9bc\uc5d0\uc11c Throwable\uc744 \uad6c\ubb38 \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.server.throwable.exception.explanation=\uc11c\ubc84\uc5d0\uc11c \ud074\ub77c\uc774\uc5b8\ud2b8 \uc694\uccad\uc744 \ucc98\ub9ac\ud558\ub294 \uc911\uc5d0 \uc608\uc678\uac00 \ubc1c\uc0dd\ud588\uc9c0\ub9cc \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84 \uc624\ub958 \uc2a4\ud2b8\ub9bc\uc5d0\uc11c Throwable \uc624\ube0c\uc81d\ud2b8\ub97c \uad6c\ubb38 \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0\uc11c Throwable \uc624\ube0c\uc81d\ud2b8\uc758 \ud074\ub798\uc2a4\uac00 \uc0ac\uc6a9 \uac00\ub2a5\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.server.throwable.exception.useraction=\uc790\uc138\ud55c \uc815\ubcf4\ub294 \uc11c\ubc84 \ub85c\uadf8\ub97c \uc0b4\ud3b4\ubcf4\uc2ed\uc2dc\uc624. + +jmx.rest.client.not.connected=CWWKX0206E: \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc11c\ubc84\uc5d0 \uc5f0\uacb0\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4. +jmx.rest.client.not.connected.explanation=\uc11c\ubc84\uc5d0 \ub300\ud55c \uc5f0\uacb0\uc774 \ub2eb\ud614\uac70\ub098 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.not.connected.useraction=\uc11c\ubc84\uc5d0\uc11c REST \ucee4\ub125\ud130 \uae30\ub2a5\uc774 \uc0ac\uc6a9 \uac00\ub2a5\ud55c\uc9c0 \ud655\uc778\ud558\uace0 \uc11c\ubc84\uc5d0 \ub300\ud55c \uc0c8 \uc5f0\uacb0\uc744 \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +jmx.rest.client.url.not.found=CWWKX0207E: \uc11c\ubc84\ub294 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc694\uccad\ud55c URL\uc744 \ucc3e\uc744 \uc218 \uc5c6\ub2e4\uace0 \ubcf4\uace0\ud569\ub2c8\ub2e4. +jmx.rest.client.url.not.found.explanation=\ud074\ub77c\uc774\uc5b8\ud2b8\uc758 \uc815\ubcf4\uac00 \uc720\ud6a8 \uae30\uac04\uc774 \uc9c0\ub0ac\uac70\ub098 \uc11c\ubc84\uc758 REST \ucee4\ub125\ud130 \uae30\ub2a5\uc744 \uc0ac\uc6a9 \uc548\ud569\ub2c8\ub2e4. +jmx.rest.client.url.not.found.useraction=\uc11c\ubc84\uc5d0\uc11c REST \ucee4\ub125\ud130 \uae30\ub2a5\uc774 \uc0ac\uc6a9 \uac00\ub2a5\ud55c\uc9c0 \ud655\uc778\ud558\uace0 \uc11c\ubc84\uc5d0 \ub300\ud55c \uc0c8 \uc5f0\uacb0\uc744 \uc5bb\uc73c\uc2ed\uc2dc\uc624. +jmx.rest.client.class.name.null=CWWKX0208E: \ud074\ub798\uc2a4 \uc774\ub984 \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.class.name.null.explanation=\ud074\ub798\uc2a4 \uc774\ub984 \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.class.name.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc \ud074\ub798\uc2a4 \uc774\ub984\uc744 \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.attribute.name.null=CWWKX0209E: \uc18d\uc131 \uc774\ub984 \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.attribute.name.null.explanation=\uc18d\uc131 \uc774\ub984 \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.attribute.name.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc \uc18d\uc131 \uc774\ub984\uc744 \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.attribute.names.null=CWWKX0210E: \uc18d\uc131 \uc774\ub984 \ubc30\uc5f4\uc744 \ud3ec\ud568\ud558\ub294 \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.attribute.names.null.explanation=\uc18d\uc131 \uc774\ub984 \ubc30\uc5f4\uc744 \ud3ec\ud568\ud558\ub294 \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.attribute.names.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc \uc18d\uc131 \uc774\ub984 \ubc30\uc5f4\uc744 \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.attribute.null=CWWKX0211E: \uc18d\uc131 \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.attribute.null.explanation=\uc18d\uc131 \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.attribute.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc \uc18d\uc131\uc744 \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.attribute.list.null=CWWKX0212E: AttributeList \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.attribute.list.null.explanation=AttributeList \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.attribute.list.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc AttributeList\ub97c \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.object.name.null=CWWKX0213E: ObjectName \uc778\uc218\uac00 \ub110\uc785\ub2c8\ub2e4. +jmx.rest.client.object.name.null.explanation=ObjectName \uc778\uc218\ub294 \ub110\uc774 \uc544\ub2c8\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.object.name.null.useraction=\uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \ub54c \ub110\uc774 \uc544\ub2cc ObjectName\uc744 \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: \uc11c\ubc84\uc5d0\uc11c \uc608\uae30\uce58 \ubabb\ud55c Throwable \uc624\ube0c\uc81d\ud2b8\uac00 \ub9ac\ud134\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.unexpected.server.throwable.explanation=\uc608\uc678\uac00 \uc11c\ubc84\uc5d0\uc11c \ub9ac\ud134\ub41c Throwable \uc624\ube0c\uc81d\ud2b8(\uc77c\ubc18\uc801\uc73c\ub85c \uc774 \uc870\uc791\uc5d0\ub294 \ubc1c\uc0dd\ud558\uc9c0 \uc54a\uc74c)\ub97c \ub7a9\ud551\ud569\ub2c8\ub2e4. +jmx.rest.client.unexpected.server.throwable.useraction=\uc790\uc138\ud55c \uc815\ubcf4\ub294 \uc11c\ubc84 \ub85c\uadf8\ub97c \uc0b4\ud3b4\ubcf4\uc2ed\uc2dc\uc624. + +jmx.rest.client.bad.credentials=CWWKX0215E: \uc81c\uacf5\ub41c \uc0ac\uc6a9\uc790 \uc774\ub984 \ub610\ub294 \ube44\ubc00\ubc88\ud638\uc5d0 \ubb38\uc81c\uc810\uc774 \uc788\uc2b5\ub2c8\ub2e4. \uc11c\ubc84\uac00 \ucf54\ub4dc {0} \ubc0f ''{1}'' \uba54\uc2dc\uc9c0\ub85c \uc751\ub2f5\ud569\ub2c8\ub2e4. +jmx.rest.client.bad.credentials.explanation=\uc5f0\uacb0\uc744 \uc5bb\uc744 \ub54c \uc81c\uacf5\ub41c \uc2e0\uc784 \uc815\ubcf4\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \uc0ac\uc6a9\uc790\uac00 \uc5c6\uac70\ub098 \uc11c\ubc84\uc5d0 \uc561\uc138\uc2a4\ud560 \uad8c\ud55c\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. \ub610\ub294 \ube44\ubc00\ubc88\ud638\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.bad.credentials.useraction=\uc0ac\uc6a9\uc790 \uc774\ub984 \ub610\ub294 \ube44\ubc00\ubc88\ud638\ub97c \uc815\uc815\ud55c \ub2e4\uc74c \uc0c8 \uc5f0\uacb0\uc744 \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +jmx.rest.client.object.name.pattern=CWWKX0216E: ObjectName \uc778\uc218 ''{0}''\uc774(\uac00) \ud328\ud134\uc785\ub2c8\ub2e4." +jmx.rest.client.object.name.pattern.explanation=ObjectName \uc778\uc218\uac00 \ud328\ud134\uc785\ub2c8\ub2e4. \uadf8\ub7ec\ub098 \uba54\uc18c\ub4dc\uc5d0\ub294 \ub2e8 \ud558\ub098\uc758 MBean\uacfc \uc77c\uce58\ud558\ub294 ObjectName\uc774 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4. +jmx.rest.client.object.name.pattern.useraction=\ub2e8 \ud558\ub098\uc758 MBean\uacfc \uc77c\uce58\ud558\ub3c4\ub85d \uc640\uc77c\ub4dc\uce74\ub4dc\uac00 \uc5c6\ub294 ObjectName \uc778\uc218\ub97c \uc81c\uacf5\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.instance.not.found=CWWKX0217E: \ud604\uc7ac \uc9c0\uc815\ub41c ObjectName ''{0}''(\uc73c)\ub85c \ub4f1\ub85d\ub41c MBean\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.instance.not.found.explanation=\uc870\uc791\uc744 \uc218\ud589\ud558\ub824\uba74 \ub4f1\ub85d\ub41c MBean\uc774 \ud544\uc694\ud558\uc9c0\ub9cc \uc9c0\uc815\ub41c ObjectName\uc73c\ub85c \ub4f1\ub85d\ub41c MBean\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.instance.not.found.useraction=\uad00\ub9ac \uc870\uc791\uc744 \uc218\ud589\ud558\uae30 \uc804\uc5d0 MBean\uc774 \ub4f1\ub85d\ub418\uc5c8\ub294\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.attribute.not.found=CWWKX0218E: MBean ''{0}''\uc5d0 ''{1}''(\uc774)\ub77c\ub294 \uc18d\uc131\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.attribute.not.found.explanation=MBean\uc774 \uc9c0\uc815\ub41c \uc774\ub984\uc758 \uc18d\uc131\uc744 \uc81c\uacf5\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.attribute.not.found.useraction=MBean\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 \uc18d\uc131\uc744 \ud655\uc778\ud558\ub824\uba74 MBean \uc815\ubcf4\ub97c \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +jmx.rest.client.operation.not.found=CWWKX0219E: MBean ''{0}''\uc5d0 ''{1}''(\uc774)\ub77c\ub294 \uc870\uc791\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.operation.not.found.explanation=MBean\uc774 \uc9c0\uc815\ub41c \uc774\ub984\uc758 \uc870\uc791\uc744 \uc81c\uacf5\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.operation.not.found.useraction=MBean\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 \uc870\uc791\uc744 \ud655\uc778\ud558\ub824\uba74 MBean \uc815\ubcf4\ub97c \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +jmx.rest.client.listener.not.found=CWWKX0220E: \ud604\uc7ac \uc9c0\uc815\ub41c NotificationListener\uac00 MBean ''{0}''\uc5d0\uc11c \uc54c\ub9bc\uc744 \uc218\uc2e0\ud558\ub3c4\ub85d \ub4f1\ub85d\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4. +jmx.rest.client.listener.not.found.explanation=NotificationListener\uac00 \ucd94\uac00\ub418\uc9c0 \uc54a\uc558\uac70\ub098 \uc774\ubbf8 \uc81c\uac70\ub418\uc5c8\uc73c\uba70 \ud604\uc7ac \uc9c0\uc815\ub41c MBean\uc5d0\uc11c \uc54c\ub9bc\uc744 \uc218\uc2e0\ud558\ub3c4\ub85d \ub4f1\ub85d\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4. +jmx.rest.client.listener.not.found.useraction=\ud638\ucd9c \ucf54\ub4dc\uac00 \ucd94\uac00 \ubc0f \uc81c\uac70\ub41c NotificationListener\ub97c \ucd94\uc801\ud558\uac70\ub098 \uc608\uc678\ub97c \ubc1c\uacac\ud558\uace0 \ucc98\ub9ac\ud558\ub3c4\ub85d \ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.notification.lost=CWWKX0221I: \uc54c\ub9bc\uc744 \uc804\ub2ec\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.notification.lost.explanation=\ub4f1\ub85d\ub41c NotificationListener\ub97c \ucc3e\uc744 \uc218 \uc5c6\uac70\ub098 \uc54c\ub9bc\uc744 \uc804\ub2ec\ud558\ub294 \uc911\uc5d0 \uc608\uc678\uac00 \ubc1c\uc0dd\ud588\uc73c\ubbc0\ub85c \uc54c\ub9bc\uc744 \ud558\ub098 \uc774\uc0c1\uc758 NotificationListener\uc5d0 \uc804\ub2ec\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.notification.lost.useraction=\ub4f1\ub85d\ub41c NotificationListener\uc5d0 \uc54c\ub9bc\uc744 \uc804\ub2ec\ud588\uc5b4\uc57c \ud558\ub294 \uacbd\uc6b0 \uc608\uc678\uc5d0 \ub300\ud55c \ub85c\uadf8\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.failed=CWWKX0222I: \uc11c\ubc84\uc5d0 \uc5f0\uacb0\ud558\ub294 \ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.failed.explanation=\uc11c\ubc84\uac00 \uc0ac\uc6a9 \ubd88\uac00\ub2a5\ud558\uac8c \ub418\uc5c8\uac70\ub098 \ud5c8\uc6a9 \uac00\ub2a5\ud558\ub3c4\ub85d \uad6c\uc131\ub41c \ucd5c\ub300 \uc2dc\uac04 \uc548\uc5d0 \ub2e4\uc2dc \uc0ac\uc6a9 \uac00\ub2a5\ud558\uac8c \ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.failed.useraction=\ub124\ud2b8\uc6cc\ud06c \uc5f0\uacb0\uc744 \ud655\uc778\ud558\uace0 \uc11c\ubc84\uac00 REST \ucee4\ub125\ud130 \uae30\ub2a5\uc774 \uc0ac\uc6a9\ub418\uc5b4 \uc2e4\ud589 \uc911\uc778\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: \uc11c\ubc84\uc5d0 \ub300\ud55c \uc5f0\uacb0\uc774 \uc784\uc2dc\ub85c \uc720\uc2e4\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.temporarily.lost.explanation=\uc11c\ubc84\uac00 \uc0ac\uc6a9 \ubd88\uac00\ub2a5\ud558\uc9c0\ub9cc \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \ud5c8\uc6a9 \uac00\ub2a5\ud558\ub3c4\ub85d \uad6c\uc131\ub41c \ucd5c\ub300 \uc2dc\uac04 \ub3d9\uc548 \uc5f0\uacb0\uc744 \ubcf5\uc6d0\ud558\ub824\uace0 \uc2dc\ub3c4\ud569\ub2c8\ub2e4. +jmx.rest.client.connection.temporarily.lost.useraction=\uc11c\ubc84\ub97c \uc758\ub3c4\uc801\uc73c\ub85c \ub2e4\uc2dc \uc2dc\uc791\ud558\ub294 \uacbd\uc6b0 \uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \uadf8\ub807\uc9c0 \uc54a\uc73c\uba74 \ub124\ud2b8\uc6cc\ud06c \uc5f0\uacb0\uc744 \ud655\uc778\ud558\uace0 \uc11c\ubc84\uac00 REST \ucee4\ub125\ud130 \uae30\ub2a5\uc774 \uc0ac\uc6a9\ub418\uc5b4 \uc2e4\ud589 \uc911\uc778\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: \uc5f0\uacb0\uc774 \ubcf5\uc6d0\ub418\uc5c8\uc9c0\ub9cc NotificationListener\ub97c \ucd94\uac00\ud560 \ub54c \uc608\uc678\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.restored.with.exceptions.explanation=\uc11c\ubc84\uc5d0 \ub300\ud55c \uc5f0\uacb0\uc774 \uc784\uc2dc\ub85c \uc720\uc2e4\ub418\uc5c8\uc9c0\ub9cc \uc131\uacf5\uc801\uc73c\ub85c \ubcf5\uc6d0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. NotificationListener\ub97c \ucd94\uac00\ud558\ub294 \uc911\uc5d0 \uc608\uc678\uac00 \ubc1c\uc0dd\ud588\uc73c\ubbc0\ub85c \uc77c\ubd80 \uc54c\ub9bc\uc740 \uc218\uc2e0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.restored.with.exceptions.useraction=\uc54c\ub9bc\uc5d0 \ud3ec\ud568\ub41c \uc608\uc678\ub97c \ud655\uc778\ud558\uace0 \ubb38\uc81c\uc810\uc744 \uc815\uc815\ud55c \ub2e4\uc74c NotificationListener\ub97c \ub2e4\uc2dc \ub4f1\ub85d\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.restored=CWWKX0225I: \uc5f0\uacb0\uc774 \ubcf5\uc6d0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.restored.explanation=\uc11c\ubc84\uc5d0 \ub300\ud55c \uc5f0\uacb0\uc774 \uc784\uc2dc\ub85c \uc720\uc2e4\ub418\uc5c8\uc9c0\ub9cc \uc131\uacf5\uc801\uc73c\ub85c \ubcf5\uc6d0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \ub4f1\ub85d\ub41c \ubaa8\ub4e0 NotificationListener\uac00 \uacc4\uc18d \uc54c\ub9bc\uc744 \uc218\uc2e0\ud569\ub2c8\ub2e4. +jmx.rest.client.connection.restored.useraction=\uc5c6\uc74c + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: JMXServiceURL \uc720\ud615\uc758 \ub9e4\uac1c\ubcc0\uc218\ub294 \ub110\uc77c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.illegal.argument.explanation='serviceURL' \ub9e4\uac1c\ubcc0\uc218 \uac12\uc740 \ub110\uc77c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.illegal.argument.useraction=\ub110\uc774 \uc544\ub2cc JMXServiceURL \uac12\uc744 \uc0ac\uc6a9\ud558\uc5ec JMX REST Connector\uc5d0 \ub2e4\uc2dc \uc5f0\uacb0\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: \ub2e4\uc74c\uc740 \uc720\ud6a8\ud55c \uc5d4\ub4dc\ud3ec\uc778\ud2b8 \uac12\uc774 \uc544\ub2d9\ub2c8\ub2e4. {0} +jmx.rest.client.connection.invalid.endpoint.explanation=\uc9c0\uc815\ub41c \uc5d4\ub4dc\ud3ec\uc778\ud2b8 \uac12\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.invalid.endpoint.useraction=\ubb38\uc790\uc5f4 \uc720\ud615\uc774\uace0 "host:port" \ud615\uc2dd\uc744 \uac00\uc9c0\ub294 \uc720\ud6a8\ud55c \uc5d4\ub4dc\ud3ec\uc778\ud2b8 \uac12\uc744 \uc0ac\uc6a9\ud558\uc5ec JMX REST Connector\uc5d0 \ub2e4\uc2dc \uc5f0\uacb0\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: \ucee4\ub125\ud130\ub97c \ucd08\uae30\ud654\ud560 \uc0ac\uc6a9 \uac00\ub2a5\ud55c \uc5d4\ub4dc\ud3ec\uc778\ud2b8\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.no.endpoints.explanation=JMX REST Connector\uc758 \ucd08\uae30\ud654 \uc911\uc5d0, \uc9c0\uc815\ub41c \uc5d4\ud2b8\ud3ec\uc778\ud2b8\uac00 \uc0ac\uc6a9 \uac00\ub2a5\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.no.endpoints.useraction=\ud558\ub098 \uc774\uc0c1\uc758 \uc0ac\uc6a9 \uac00\ub2a5\ud55c \uc5d4\ub4dc\ud3ec\uc778\ud2b8\ub97c \uc0ac\uc6a9\ud558\uc5ec JMX REST Connector\uc5d0 \ub2e4\uc2dc \uc5f0\uacb0\ud558\uc2ed\uc2dc\uc624. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: \uc81c\uacf5\ub41c \uc0ac\uc6a9\uc790 \uc2e0\uc784 \uc815\ubcf4\uc5d0 \ubb38\uc81c\uc810\uc774 \uc788\uc2b5\ub2c8\ub2e4. \uc11c\ubc84\uac00 \ucf54\ub4dc {0} \ubc0f ''{1}'' \uba54\uc2dc\uc9c0\ub85c \uc751\ub2f5\ud569\ub2c8\ub2e4. +jmx.rest.client.bad.user.credentials.explanation=\uc81c\uacf5\ub41c \uc2e0\uc784 \uc815\ubcf4\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uace0 \ub9cc\uae30\ub418\uc5c8\uac70\ub098 \ubd88\uc644\uc804\ud558\uba70 \ub610\ub294 \uad8c\ud55c\uc774 \uac70\ubd80\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.bad.user.credentials.useraction=\uc0ac\uc6a9\uc790 \uc2e0\uc784 \uc815\ubcf4\uc5d0 \uc62c\ubc14\ub978 \uc778\uc99d \ubc0f \uad8c\ud55c\uc774 \uc788\ub294\uc9c0 \ud655\uc778\ud55c \ub2e4\uc74c \uc0c8 \uc5f0\uacb0\uc744 \uc5bb\uc73c\uc2ed\uc2dc\uc624. + +jmx.rest.client.connection.connect=CWWKX0230I: Collective \uba64\ubc84\uac00 Collective \uc81c\uc5b4\uae30\uc5d0 JMX \ud074\ub77c\uc774\uc5b8\ud2b8\ub97c \uc5f4\uc5c8\uc2b5\ub2c8\ub2e4. {0} +jmx.rest.client.connection.connect.explanation=\uba64\ubc84\uac00 \uc81c\uc5b4\uae30\uc5d0 \uc5f0\uacb0\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.connect.useraction=\uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.disconnect=CWWKX0231I: Collective \uba64\ubc84\uac00 Collective \uc81c\uc5b4\uae30\uc5d0\uc11c JMX \ud074\ub77c\uc774\uc5b8\ud2b8\ub97c \ub2eb\uc558\uc2b5\ub2c8\ub2e4. {0} +jmx.rest.client.connection.disconnect.explanation=\uba64\ubc84\uac00 \uc81c\uc5b4\uae30\uc5d0\uc11c \uc5f0\uacb0 \ud574\uc81c\ub418\uc5c8\uc2b5\ub2c8\ub2e4. +jmx.rest.client.connection.disconnect.useraction=\uc870\uce58\uac00 \ud544\uc694\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pl.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pl.nlsprops new file mode 100755 index 00000000000..8babd6083d8 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pl.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Klient REST produktu WebSphere Java Management Extensions napotka\u0142 b\u0142\u0105d podczas przygotowywania \u017c\u0105dania dla serwera zwi\u0105zanego z adresem URL {0} w po\u0142\u0105czeniu {1} +jmx.rest.client.request.error.explanation=Klient REST produktu WebSphere Java Management Extensions napotka\u0142 b\u0142\u0105d podczas przygotowywania \u017c\u0105dania dla serwera +jmx.rest.client.request.error.useraction=Dodatkowe informacje s\u0105 zawarte w plikach dziennik\u00f3w serwera. + +jmx.rest.client.response.error=CWWKX0202E: Klient REST produktu WebSphere Java Management Extensions nie m\u00f3g\u0142 przetworzy\u0107 \u017c\u0105dania z serwera zwi\u0105zanego z adresem URL {0} w po\u0142\u0105czeniu {1} +jmx.rest.client.response.error.explanation=Klient REST produktu WebSphere Java Management Extensions nie m\u00f3g\u0142 przetworzy\u0107 \u017c\u0105dania z serwera +jmx.rest.client.response.error.useraction=Dodatkowe informacje s\u0105 zawarte w plikach dziennik\u00f3w serwera. + +jmx.rest.client.response.code.error=CWWKX0203E: Klient REST produktu WebSphere Java Management Extensions odebra\u0142 nieoczekiwany kod odpowiedzi {0} z komunikatem {1} od serwera zwi\u0105zanego z adresem URL {2} w po\u0142\u0105czeniu {3} +jmx.rest.client.response.code.error.explanation=Klient REST produktu WebSphere Java Management Extensions odebra\u0142 nieoczekiwany kod odpowiedzi od serwera +jmx.rest.client.response.code.error.useraction=Dodatkowe informacje s\u0105 zawarte w plikach dziennik\u00f3w serwera. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Nie mo\u017cna przeanalizowa\u0107 wyj\u0105tku Throwable ze strumienia b\u0142\u0119d\u00f3w serwera. +jmx.rest.client.server.throwable.exception.explanation=Serwer zg\u0142osi\u0142 wyj\u0105tek podczas obs\u0142ugiwania \u017c\u0105dania klienta, ale klient nie mo\u017ce przeanalizowa\u0107 obiektu Throwable ze strumienia b\u0142\u0119d\u00f3w serwera. Klasa obiektu Throwable mo\u017ce by\u0107 niedost\u0119pna dla klienta. +jmx.rest.client.server.throwable.exception.useraction=Dodatkowe informacje s\u0105 zawarte w plikach dziennik\u00f3w serwera. + +jmx.rest.client.not.connected=CWWKX0206E: Klient nie jest po\u0142\u0105czony z serwerem. +jmx.rest.client.not.connected.explanation=Po\u0142\u0105czenie z serwerem zosta\u0142o zamkni\u0119te lub utracone. +jmx.rest.client.not.connected.useraction=Sprawd\u017a, czy na serwerze w\u0142\u0105czono funkcj\u0119 konektora REST i nawi\u0105\u017c nowe po\u0142\u0105czenie z serwerem. + +jmx.rest.client.url.not.found=CWWKX0207E: Serwer zg\u0142osi\u0142 brak mo\u017cliwo\u015bci znalezienia adresu URL za\u017c\u0105danego przez klient. +jmx.rest.client.url.not.found.explanation=Klient ma nieaktualne informacje lub funkcja konektora REST na serwerze zosta\u0142a wy\u0142\u0105czona. +jmx.rest.client.url.not.found.useraction=Sprawd\u017a, czy na serwerze w\u0142\u0105czono funkcj\u0119 konektora REST i nawi\u0105\u017c nowe po\u0142\u0105czenie z serwerem. + +jmx.rest.client.class.name.null=CWWKX0208E: Argument nazwy klasy ma warto\u015b\u0107 NULL. +jmx.rest.client.class.name.null.explanation=Argument nazwy klasy nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.class.name.null.useraction=Podczas wywo\u0142ywania metody podaj nazw\u0119 klasy inn\u0105 ni\u017c NULL. + +jmx.rest.client.attribute.name.null=CWWKX0209E: Argument nazwy atrybutu ma warto\u015b\u0107 NULL. +jmx.rest.client.attribute.name.null.explanation=Argument nazwy atrybutu nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.attribute.name.null.useraction=Podczas wywo\u0142ywania metody podaj nazw\u0119 atrybutu inn\u0105 ni\u017c NULL. + +jmx.rest.client.attribute.names.null=CWWKX0210E: Argument zawieraj\u0105cy tablic\u0119 nazw atrybut\u00f3w ma warto\u015b\u0107 NULL. +jmx.rest.client.attribute.names.null.explanation=Argument zawieraj\u0105cy tablic\u0119 nazw atrybut\u00f3w nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.attribute.names.null.useraction=Podczas wywo\u0142ywania metody podaj tablic\u0119 nazw atrybut\u00f3w o warto\u015bci innej ni\u017c NULL. + +jmx.rest.client.attribute.null=CWWKX0211E: Argument Attribute ma warto\u015b\u0107 NULL. +jmx.rest.client.attribute.null.explanation=Argument Attribute nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.attribute.null.useraction=Podczas wywo\u0142ywania metody podaj argument Attribute o warto\u015bci innej ni\u017c NULL. + +jmx.rest.client.attribute.list.null=CWWKX0212E: Argument AttributeList ma warto\u015b\u0107 NULL. +jmx.rest.client.attribute.list.null.explanation=Argument AttributeList nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.attribute.list.null.useraction=Podczas wywo\u0142ywania metody podaj argument AttributeList o warto\u015bci innej ni\u017c NULL. + +jmx.rest.client.object.name.null=CWWKX0213E: Argument ObjectName ma warto\u015b\u0107 NULL. +jmx.rest.client.object.name.null.explanation=Argument ObjectName nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.object.name.null.useraction=Podczas wywo\u0142ywania metody podaj argument ObjectName o warto\u015bci innej ni\u017c NULL. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Serwer zwr\u00f3ci\u0142 nieoczekiwany obiekt Throwable. +jmx.rest.client.unexpected.server.throwable.explanation=Wyj\u0105tek opakowuje obiekt Throwable zwr\u00f3cony przez serwer, kt\u00f3ry nie jest normalnie oczekiwany dla tej operacji. +jmx.rest.client.unexpected.server.throwable.useraction=Dodatkowe informacje s\u0105 zawarte w plikach dziennik\u00f3w serwera. + +jmx.rest.client.bad.credentials=CWWKX0215E: Wyst\u0105pi\u0142 problem dotycz\u0105cy podanej nazwy u\u017cytkownika lub has\u0142a. Odpowied\u017a serwera to kod {0} i komunikat {1}. +jmx.rest.client.bad.credentials.explanation=Referencje podane podczas nawi\u0105zywania po\u0142\u0105czenia by\u0142y niepoprawne. U\u017cytkownik nie istnieje lub nie ma uprawnie\u0144 niezb\u0119dnych do uzyskania dost\u0119pu do serwera albo has\u0142o jest niepoprawne. +jmx.rest.client.bad.credentials.useraction=Popraw nazw\u0119 u\u017cytkownika lub has\u0142o, a nast\u0119pnie nawi\u0105\u017c nowe po\u0142\u0105czenie. + +jmx.rest.client.object.name.pattern=CWWKX0216E: Argument ObjectName {0} to wzorzec. +jmx.rest.client.object.name.pattern.explanation=Argument ObjectName to wzorzec, a metoda wymaga argumentu ObjectName zgodnego z dok\u0142adnie jednym komponentem MBean. +jmx.rest.client.object.name.pattern.useraction=Podaj argument ObjectName bez znak\u00f3w wieloznacznych, kt\u00f3ry b\u0119dzie zgodny z dok\u0142adnie jednym komponentem MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: \u017baden komponent MBean nie zosta\u0142 zarejestrowany przy u\u017cyciu nazwy obiektu {0} +jmx.rest.client.instance.not.found.explanation=Operacja wymaga zarejestrowanego komponentu MBean, ale nie zarejestrowano \u017cadnego komponentu MBean o podanej nazwie obiektu. +jmx.rest.client.instance.not.found.useraction=Upewnij si\u0119, \u017ce komponent MBean jest zarejestrowany przed podj\u0119ciem pr\u00f3by wykonania wzgl\u0119dem niego operacji zarz\u0105dzania. + +jmx.rest.client.attribute.not.found=CWWKX0218E: Komponent MBean {0} nie zawiera atrybutu o nazwie {1} +jmx.rest.client.attribute.not.found.explanation=Komponent MBean nie udost\u0119pnia atrybutu o podanej nazwie. +jmx.rest.client.attribute.not.found.useraction=Uzyskaj informacje o komponencie MBean, aby okre\u015bli\u0107 atrybuty, kt\u00f3re udost\u0119pnia. + +jmx.rest.client.operation.not.found=CWWKX0219E: Komponent MBean {0} nie zawiera operacji o nazwie {1} +jmx.rest.client.operation.not.found.explanation=Komponent MBean nie udost\u0119pnia operacji o podanej nazwie. +jmx.rest.client.operation.not.found.useraction=Uzyskaj informacje o komponencie MBean, aby okre\u015bli\u0107 operacje, kt\u00f3re udost\u0119pnia. + +jmx.rest.client.listener.not.found=CWWKX0220E: Obiekt NotificationListener nie jest obecnie zarejestrowany do otrzymywania powiadomie\u0144 od komponentu MBean {0} +jmx.rest.client.listener.not.found.explanation=Obiekt NotificationListener nie zosta\u0142 dodany lub zosta\u0142 ju\u017c usuni\u0119ty i nie jest obecnie zarejestrowany do otrzymywania powiadomie\u0144 od danego komponentu MBean. +jmx.rest.client.listener.not.found.useraction=Upewnij si\u0119, \u017ce kod wywo\u0142uj\u0105cy \u015bledzi, kt\u00f3re obiekty NotificationListener s\u0105 dodawane i usuwane, lub przechwy\u0107 i obs\u0142u\u017c wyj\u0105tek. + +jmx.rest.client.notification.lost=CWWKX0221I: Nie mo\u017cna dostarczy\u0107 powiadomienia. +jmx.rest.client.notification.lost.explanation=Powiadomienie nie mo\u017ce zosta\u0107 dostarczone do co najmniej jednego obiektu NotificationListener, poniewa\u017c nie znaleziono zarejestrowanego obiektu NotificationListener lub wyst\u0105pi\u0142 wyj\u0105tek podczas dostarczania powiadomienia. +jmx.rest.client.notification.lost.useraction=Je\u015bli powiadomienie powinno zosta\u0107 dostarczone do zarejestrowanego obiektu NotificationListener, sprawd\u017a, czy w dzienniku zosta\u0142y zarejestrowane wyj\u0105tki. + +jmx.rest.client.connection.failed=CWWKX0222I: Po\u0142\u0105czenie z serwerem zosta\u0142o utracone. +jmx.rest.client.connection.failed.explanation=Serwer sta\u0142 si\u0119 niedost\u0119pny i w skonfigurowanym maksymalnym dozwolonym czasie jego dost\u0119pno\u015b\u0107 nie zosta\u0142a przywr\u00f3cona. +jmx.rest.client.connection.failed.useraction=Sprawd\u017a po\u0142\u0105czenie sieciowe i upewnij si\u0119, \u017ce serwer dzia\u0142a oraz \u017ce w\u0142\u0105czono na nim funkcj\u0119 konektora REST. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: Po\u0142\u0105czenie z serwerem zosta\u0142o tymczasowo utracone. +jmx.rest.client.connection.temporarily.lost.explanation=Serwer sta\u0142 si\u0119 niedost\u0119pny, ale klient b\u0119dzie podejmowa\u0142 pr\u00f3by przywr\u00f3cenia po\u0142\u0105czenia przez skonfigurowany maksymalny dozwolony czas. +jmx.rest.client.connection.temporarily.lost.useraction=Je\u015bli serwer jest planowo restartowany, nie jest wymagana \u017cadna czynno\u015b\u0107. W przeciwnym razie sprawd\u017a po\u0142\u0105czenie sieciowe i upewnij si\u0119, \u017ce serwer dzia\u0142a oraz \u017ce w\u0142\u0105czono na nim funkcj\u0119 konektora REST. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: Po\u0142\u0105czenie zosta\u0142o przywr\u00f3cone, ale napotkano wyj\u0105tki podczas dodawania obiekt\u00f3w NotificationListener. +jmx.rest.client.connection.restored.with.exceptions.explanation=Po\u0142\u0105czenie z serwerem zosta\u0142o tymczasowo utracone, a nast\u0119pnie pomy\u015blnie przywr\u00f3cone. Podczas dodawania obiekt\u00f3w NotificationListener napotkano wyj\u0105tki, wi\u0119c niekt\u00f3re powiadomienia mog\u0105 nie zosta\u0107 odebrane. +jmx.rest.client.connection.restored.with.exceptions.useraction=Sprawd\u017a wyj\u0105tki do\u0142\u0105czone do powiadomienia i ponownie zarejestruj obiekty NotificationListener po usuni\u0119ciu problem\u00f3w. + +jmx.rest.client.connection.restored=CWWKX0225I: Po\u0142\u0105czenie zosta\u0142o pomy\u015blnie przywr\u00f3cone. +jmx.rest.client.connection.restored.explanation=Po\u0142\u0105czenie z serwerem zosta\u0142o tymczasowo utracone, a nast\u0119pnie pomy\u015blnie przywr\u00f3cone. Wszystkie zarejestrowane obiekty NotificationListener b\u0119d\u0105 nadal odbiera\u0107 powiadomienia. +jmx.rest.client.connection.restored.useraction=Brak. + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Parametr typu JMXServiceURL nie mo\u017ce mie\u0107 warto\u015bci NULL. +jmx.rest.client.connection.illegal.argument.explanation=Warto\u015bci\u0105 parametru serviceURL nie mo\u017ce by\u0107 warto\u015b\u0107 NULL. +jmx.rest.client.connection.illegal.argument.useraction=Nawi\u0105\u017c ponownie po\u0142\u0105czenie z konektorem us\u0142ug REST JMX przy u\u017cyciu warto\u015bci JMXServiceURL innej ni\u017c NULL. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: Nast\u0119puj\u0105ca warto\u015b\u0107 nie jest poprawn\u0105 warto\u015bci\u0105 punktu ko\u0144cowego: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=Okre\u015blona warto\u015b\u0107 punktu ko\u0144cowego jest niepoprawna. +jmx.rest.client.connection.invalid.endpoint.useraction=Nawi\u0105\u017c ponownie po\u0142\u0105czenie z konektorem us\u0142ug REST JMX przy u\u017cyciu poprawnej warto\u015bci punktu ko\u0144cowego, kt\u00f3ra ma typ String i format host:port. + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Nie mo\u017cna znale\u017a\u0107 \u017cadnych dost\u0119pnych punkt\u00f3w ko\u0144cowych na potrzeby inicjowania konektora. +jmx.rest.client.connection.no.endpoints.explanation=\u017baden z okre\u015blonych punkt\u00f3w ko\u0144cowych nie by\u0142 dost\u0119pny podczas inicjowania konektora us\u0142ug REST JMX. +jmx.rest.client.connection.no.endpoints.useraction=Nawi\u0105\u017c ponownie po\u0142\u0105czenie z konektorem us\u0142ug REST JMX przy u\u017cyciu co najmniej jednego dost\u0119pnego punktu ko\u0144cowego. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Wyst\u0105pi\u0142 problem dotycz\u0105cy podanych referencji u\u017cytkownika. Odpowied\u017a serwera to kod {0} i komunikat {1}. +jmx.rest.client.bad.user.credentials.explanation=Podane referencje s\u0105 niepoprawne, niekompletne, utraci\u0142y wa\u017cno\u015b\u0107 lub odm\u00f3wiono ich autoryzacji. +jmx.rest.client.bad.user.credentials.useraction=Sprawd\u017a, czy referencje u\u017cytkownika maj\u0105 odpowiednie uwierzytelnienie i autoryzacj\u0119, a nast\u0119pnie nawi\u0105\u017c nowe po\u0142\u0105czenie. + +jmx.rest.client.connection.connect=CWWKX0230I: W elemencie kolektywu zosta\u0142 otwarty klient JMX dla kontrolera kolektywu: {0} +jmx.rest.client.connection.connect.explanation=Element zosta\u0142 po\u0142\u0105czony z kontrolerem. +jmx.rest.client.connection.connect.useraction=Nie jest wymagana \u017cadna czynno\u015b\u0107. + +jmx.rest.client.connection.disconnect=CWWKX0231I: W elemencie zosta\u0142 zamkni\u0119ty klient JMX z kontrolera kolektywu: {0} +jmx.rest.client.connection.disconnect.explanation=Element zosta\u0142 roz\u0142\u0105czony z kontrolerem. +jmx.rest.client.connection.disconnect.useraction=Nie jest wymagana \u017cadna czynno\u015b\u0107. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pt_BR.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pt_BR.nlsprops new file mode 100755 index 00000000000..c9fe250acfb --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_pt_BR.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: O cliente REST do Java Management Extensions do WebSphere encontrou um erro ao preparar a solicita\u00e7\u00e3o para o servidor para a URL {0} na conex\u00e3o {1} +jmx.rest.client.request.error.explanation=O cliente REST do Java Management Extensions do WebSphere encontrou um erro ao preparar uma solicita\u00e7\u00e3o para o servidor +jmx.rest.client.request.error.useraction=Examine os logs do servidor para obter informa\u00e7\u00f5es adicionais. + +jmx.rest.client.response.error=CWWKX0202E: O cliente REST do Java Management Extensions do WebSphere n\u00e3o conseguiu processar a resposta do servidor para a URL {0} na conex\u00e3o {1} +jmx.rest.client.response.error.explanation=O cliente REST do Java Management Extensions do WebSphere n\u00e3o conseguiu processar uma resposta do servidor +jmx.rest.client.response.error.useraction=Examine os logs do servidor para obter informa\u00e7\u00f5es adicionais. + +jmx.rest.client.response.code.error=CWWKX0203E: O cliente REST do Java Management Extensions do WebSphere recebeu um c\u00f3digo de resposta {0} inesperado com a mensagem ''{1}'' a partir do servidor para a URL {2} na conex\u00e3o {3} +jmx.rest.client.response.code.error.explanation=O cliente REST do Java Management Extensions do WebSphere recebeu um c\u00f3digo de resposta inesperado do servidor +jmx.rest.client.response.code.error.useraction=Examine os logs do servidor para obter informa\u00e7\u00f5es adicionais. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: N\u00e3o \u00e9 poss\u00edvel analisar Lan\u00e7\u00e1vel a partir do fluxo de erros do servidor. +jmx.rest.client.server.throwable.exception.explanation=O servidor emitiu uma exce\u00e7\u00e3o ao manipular a solicita\u00e7\u00e3o do cliente, mas o cliente n\u00e3o p\u00f4de analisar um objeto Lan\u00e7\u00e1vel a partir do fluxo de erros do servidor. A classe do objeto Lan\u00e7\u00e1vel pode n\u00e3o estar dispon\u00edvel ao cliente. +jmx.rest.client.server.throwable.exception.useraction=Examine os logs do servidor para obter informa\u00e7\u00f5es adicionais. + +jmx.rest.client.not.connected=CWWKX0206E: O cliente n\u00e3o est\u00e1 conectado ao servidor. +jmx.rest.client.not.connected.explanation=A conex\u00e3o com o servidor foi fechada ou falhou. +jmx.rest.client.not.connected.useraction=Verifique se o recurso do conector REST est\u00e1 ativado no servidor e obtenha uma nova conex\u00e3o com o servidor. + +jmx.rest.client.url.not.found=CWWKX0207E: O servidor relatou que a URL solicitada pelo cliente n\u00e3o foi localizada. +jmx.rest.client.url.not.found.explanation=O cliente pode ter informa\u00e7\u00f5es desatualizadas ou o recurso do conector REST no servidor pode ter sido desativado. +jmx.rest.client.url.not.found.useraction=Verifique se o recurso do conector REST est\u00e1 ativado no servidor e obtenha uma nova conex\u00e3o com o servidor. + +jmx.rest.client.class.name.null=CWWKX0208E: O argumento de nome de classe era nulo. +jmx.rest.client.class.name.null.explanation=O argumento de nome de classe n\u00e3o deve ser nulo. +jmx.rest.client.class.name.null.useraction=Forne\u00e7a um nome de classe n\u00e3o nulo ao chamar o m\u00e9todo. + +jmx.rest.client.attribute.name.null=CWWKX0209E: O argumento de nome do atributo era nulo. +jmx.rest.client.attribute.name.null.explanation=O argumento de nome do atributo n\u00e3o deve ser nulo. +jmx.rest.client.attribute.name.null.useraction=Forne\u00e7a um nome de atributo n\u00e3o nulo ao chamar o m\u00e9todo. + +jmx.rest.client.attribute.names.null=CWWKX0210E: O argumento que cont\u00e9m uma matriz de nomes de atributo era nulo. +jmx.rest.client.attribute.names.null.explanation=O argumento que cont\u00e9m uma matriz de nomes de atributo n\u00e3o deve ser nulo. +jmx.rest.client.attribute.names.null.useraction=Forne\u00e7a uma matriz n\u00e3o nula de nomes de atributo ao chamar o m\u00e9todo. + +jmx.rest.client.attribute.null=CWWKX0211E: O argumento Atributo era nulo. +jmx.rest.client.attribute.null.explanation=O argumento Atributo n\u00e3o deve ser nulo. +jmx.rest.client.attribute.null.useraction=Forne\u00e7a um Atributo n\u00e3o nulo ao chamar o m\u00e9todo. + +jmx.rest.client.attribute.list.null=CWWKX0212E: O argumento AttributeList era nulo. +jmx.rest.client.attribute.list.null.explanation=O argumento AttributeList n\u00e3o deve ser nulo. +jmx.rest.client.attribute.list.null.useraction=Forne\u00e7a um AttributeList n\u00e3o nulo ao chamar o m\u00e9todo. + +jmx.rest.client.object.name.null=CWWKX0213E: O argumento ObjectName era nulo. +jmx.rest.client.object.name.null.explanation=O argumento ObjectName n\u00e3o deve ser nulo. +jmx.rest.client.object.name.null.useraction=Forne\u00e7a um ObjectName n\u00e3o nulo ao chamar o m\u00e9todo. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: Um objeto Lan\u00e7\u00e1vel inesperado foi retornado do servidor. +jmx.rest.client.unexpected.server.throwable.explanation=A exce\u00e7\u00e3o agrupa um objeto Lan\u00e7\u00e1vel retornado do servidor que n\u00e3o \u00e9 esperado normalmente para esta opera\u00e7\u00e3o. +jmx.rest.client.unexpected.server.throwable.useraction=Examine os logs do servidor para obter informa\u00e7\u00f5es adicionais. + +jmx.rest.client.bad.credentials=CWWKX0215E: Houve um problema com o nome de usu\u00e1rio ou senha fornecida. O servidor respondeu com o c\u00f3digo {0} e a mensagem ''{1}'' +jmx.rest.client.bad.credentials.explanation=As credenciais fornecidas ao obter a conex\u00e3o estavam incorretas. O usu\u00e1rio pode n\u00e3o existir ou pode n\u00e3o ter autoridade para acessar o servidor, ou a senha pode estar incorreta. +jmx.rest.client.bad.credentials.useraction=Corrija o nome de usu\u00e1rio ou a senha e, em seguida, obtenha uma nova conex\u00e3o. + +jmx.rest.client.object.name.pattern=CWWKX0216E: O argumento ObjectName ''{0}'' \u00e9 um padr\u00e3o". +jmx.rest.client.object.name.pattern.explanation=O argumento ObjectName \u00e9 um padr\u00e3o, mas o m\u00e9todo requer um ObjectName que corresponda exatamente a um MBean. +jmx.rest.client.object.name.pattern.useraction=Forne\u00e7a um argumento ObjectName sem curingas que corresponda exatamente a um MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Nenhum MBean est\u00e1 registrado atualmente com o ObjectName ''{0}'' determinado +jmx.rest.client.instance.not.found.explanation=A opera\u00e7\u00e3o requer um MBean registrado, mas nenhum MBean com o ObjectName determinado foi registrado. +jmx.rest.client.instance.not.found.useraction=Assegure-se de que o MBean esteja registrado antes de tentar executar opera\u00e7\u00f5es de gerenciamento nele. + +jmx.rest.client.attribute.not.found=CWWKX0218E: O MBean ''{0}'' n\u00e3o possui um atributo com o nome ''{1}'' +jmx.rest.client.attribute.not.found.explanation=O MBean n\u00e3o fornece um atributo com o nome determinado. +jmx.rest.client.attribute.not.found.useraction=Obtenha as informa\u00e7\u00f5es do MBean para confirmar quais atributos ele fornece. + +jmx.rest.client.operation.not.found=CWWKX0219E: O MBean ''{0}'' n\u00e3o possui uma opera\u00e7\u00e3o com o nome ''{1}'' +jmx.rest.client.operation.not.found.explanation=O MBean n\u00e3o fornece uma opera\u00e7\u00e3o com o nome determinado. +jmx.rest.client.operation.not.found.useraction=Obtenha as informa\u00e7\u00f5es do MBean para confirmar quais opera\u00e7\u00f5es ele fornece. + +jmx.rest.client.listener.not.found=CWWKX0220E: O NotificationListener determinado n\u00e3o est\u00e1 registrado atualmente para receber notifica\u00e7\u00f5es do MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=O NotificationListener n\u00e3o foi inclu\u00eddo ou j\u00e1 foi removido e n\u00e3o est\u00e1 registrado atualmente para receber notifica\u00e7\u00f5es do MBean determinado. +jmx.rest.client.listener.not.found.useraction=Certifique-se de que o c\u00f3digo de chamada controle quais NotificationListeners foram inclu\u00eddos e removidos ou capture e manipule a exce\u00e7\u00e3o. + +jmx.rest.client.notification.lost=CWWKX0221I: N\u00e3o foi poss\u00edvel entregar a notifica\u00e7\u00e3o. +jmx.rest.client.notification.lost.explanation=Uma notifica\u00e7\u00e3o n\u00e3o p\u00f4de ser entregue a um ou mais NotificationListeners porque um NotificationListener registrado n\u00e3o foi localizado ou houve uma exce\u00e7\u00e3o durante a entrega da notifica\u00e7\u00e3o. +jmx.rest.client.notification.lost.useraction=Se a notifica\u00e7\u00e3o deveria ter sido entregue para um NotificationListener registrado, verifique os logs para exce\u00e7\u00f5es. + +jmx.rest.client.connection.failed=CWWKX0222I: A conex\u00e3o com o servidor falhou. +jmx.rest.client.connection.failed.explanation=O servidor ficou indispon\u00edvel e n\u00e3o foi disponibilizado novamente no tempo m\u00e1ximo configurado permitido. +jmx.rest.client.connection.failed.useraction=Verifique a conex\u00e3o de rede e assegure-se de que o servidor esteja em execu\u00e7\u00e3o com o recurso de conector REST ativado. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: A conex\u00e3o com o servidor foi perdida temporariamente. +jmx.rest.client.connection.temporarily.lost.explanation=O servidor ficou indispon\u00edvel, mas o cliente tentar\u00e1 restaurar a conex\u00e3o durante o tempo m\u00e1ximo configurado permitido. +jmx.rest.client.connection.temporarily.lost.useraction=Se o servidor estiver sendo reiniciado intencionalmente, nenhuma a\u00e7\u00e3o ser\u00e1 necess\u00e1ria. Caso contr\u00e1rio, verifique a conex\u00e3o de rede e assegure-se de que o servidor esteja em execu\u00e7\u00e3o com o recurso de conector REST ativado. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: A conex\u00e3o foi restaurada, mas foram encontradas exce\u00e7\u00f5es ao incluir NotificationListeners. +jmx.rest.client.connection.restored.with.exceptions.explanation=A conex\u00e3o com o servidor foi perdida temporariamente, mas foi restaurada com sucesso. Foram encontradas exce\u00e7\u00f5es ao incluir NotificationListeners, portanto, algumas notifica\u00e7\u00f5es podem n\u00e3o ter sido recebidas. +jmx.rest.client.connection.restored.with.exceptions.useraction=Verifique as exce\u00e7\u00f5es inclu\u00eddas com a notifica\u00e7\u00e3o e registre NotificationListeners novamente depois de corrigir os problemas. + +jmx.rest.client.connection.restored=CWWKX0225I: A conex\u00e3o foi restaurada com sucesso. +jmx.rest.client.connection.restored.explanation=A conex\u00e3o com o servidor foi perdida temporariamente, mas foi restaurada com sucesso. Todos os NotificationListeners registrados continuar\u00e3o a receber notifica\u00e7\u00f5es. +jmx.rest.client.connection.restored.useraction=Nenhuma + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: O par\u00e2metro do tipo JMXServiceURL n\u00e3o pode ser nulo. +jmx.rest.client.connection.illegal.argument.explanation=O valor para o par\u00e2metro 'serviceURL' n\u00e3o pode ser nulo. +jmx.rest.client.connection.illegal.argument.useraction=Reconecte-se ao Conector JMX REST usando um valor JMXServiceURL n\u00e3o nulo. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: O seguinte n\u00e3o \u00e9 um valor de terminal v\u00e1lido: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=O valor de terminal especificado n\u00e3o \u00e9 v\u00e1lido. +jmx.rest.client.connection.invalid.endpoint.useraction=Reconecte-se ao Conector JMX REST usando um valor de terminal v\u00e1lido que seja do tipo Sequ\u00eancia e tenha o formato "host:porta". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: N\u00e3o foi poss\u00edvel localizar nenhum terminal dispon\u00edvel para inicializar o conector. +jmx.rest.client.connection.no.endpoints.explanation=Nenhum dos terminais especificados estava dispon\u00edvel durante a inicializa\u00e7\u00e3o do Conector JMX REST. +jmx.rest.client.connection.no.endpoints.useraction=Reconecte-se ao Conector JMX REST usando pelo menos 1 terminal dispon\u00edvel. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: Houve um problema com as credenciais dos usu\u00e1rios fornecidas. O servidor respondeu com o c\u00f3digo {0} e a mensagem ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=As credenciais fornecidas s\u00e3o autoriza\u00e7\u00f5es incorretas, expiradas, incompletas ou negadas. +jmx.rest.client.bad.user.credentials.useraction=Verifique se as credenciais do usu\u00e1rio possuem autentica\u00e7\u00e3o e autoriza\u00e7\u00e3o corretas, em seguida obtenha uma nova conex\u00e3o. + +jmx.rest.client.connection.connect=CWWKX0230I: O membro coletivo abriu o cliente JMX para o controlador coletivo: {0} +jmx.rest.client.connection.connect.explanation=O membro conectado ao controlador. +jmx.rest.client.connection.connect.useraction=Nenhuma a\u00e7\u00e3o \u00e9 necess\u00e1ria. + +jmx.rest.client.connection.disconnect=CWWKX0231I: O membro coletivo fechou o cliente JMX do controlador coletivo: {0} +jmx.rest.client.connection.disconnect.explanation=O membro desconectado do controlador. +jmx.rest.client.connection.disconnect.useraction=Nenhuma a\u00e7\u00e3o \u00e9 necess\u00e1ria. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ro.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ro.nlsprops new file mode 100755 index 00000000000..65f278d7703 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ro.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: Clientul WebSphere Java Management Extensions REST a \u00eent\u00e2lnit o eroare \u00een timpul preg\u0103tirii cererii la serverul pentru URL-ul {0} pe conexiunea {1} +jmx.rest.client.request.error.explanation=Clientul WebSphere Java Management Extensions REST a \u00eent\u00e2lnit o eroare \u00een timpul preg\u0103tirii cererii la serverul +jmx.rest.client.request.error.useraction=Pentru informa\u0163ii suplimentare examina\u0163i istoricele de server. + +jmx.rest.client.response.error=CWWKX0202E: Clientul WebSphere Java Management Extensions REST nu a putut procesa r\u0103spunsul de la serverul pentru URL-ul {0} pe conexiunea {1} +jmx.rest.client.response.error.explanation=Clientul WebSphere Java Management Extensions REST nu a putut procesa un r\u0103spuns de la server +jmx.rest.client.response.error.useraction=Pentru informa\u0163ii suplimentare examina\u0163i istoricele de server. + +jmx.rest.client.response.code.error=CWWKX0203E: Clientul WebSphere Java Management Extensions REST a primit un cod r\u0103spuns nea\u015fteptat {0} cu mesajul ''{1}'' de la server pentru URL-ul {2} pe conexiunea {3} +jmx.rest.client.response.code.error.explanation=Clientul WebSphere Java Management Extensions REST a primit un cod r\u0103spuns nea\u015fteptat de la server +jmx.rest.client.response.code.error.useraction=Pentru informa\u0163ii suplimentare examina\u0163i istoricele de server. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: Nu se poate analiza Throwable din fluxul de erori de server. +jmx.rest.client.server.throwable.exception.explanation=Serverul a ridicat o excep\u0163ie la instrumentarea cererii de client, dar clientul nu a putut analiza un obiect Throwable din fluxul de erori de server. Clasa obiectului Throwable poate s\u0103 nu fie disponibil\u0103 pentru client. +jmx.rest.client.server.throwable.exception.useraction=Pentru informa\u0163ii suplimentare examina\u0163i istoricele de server. + +jmx.rest.client.not.connected=CWWKX0206E: Clientul nu este conectat la server. +jmx.rest.client.not.connected.explanation=Conexiunea la server fie a fost \u00eenchis\u0103, fie a e\u015fuat. +jmx.rest.client.not.connected.useraction=Verifica\u0163i c\u0103 este activat\u0103 caracteristica de conector REST pe server \u015fi ob\u0163ine\u0163i o nou\u0103 conexiune la server. + +jmx.rest.client.url.not.found=CWWKX0207E: Serverul a raportat c\u0103 URL-ul cerut de client nu a fost g\u0103sit. +jmx.rest.client.url.not.found.explanation=Clientul poate avea informa\u0163ii dep\u0103\u015fite sau caracteristica REST de conector pe server poate fi dezactivat\u0103. +jmx.rest.client.url.not.found.useraction=Verifica\u0163i c\u0103 este activat\u0103 caracerostica de conector REST pe server \u015fi ob\u0163ine\u0163i o nou\u0103 conexiune la server. + +jmx.rest.client.class.name.null=CWWKX0208E: Argumentul de nume de clas\u0103 a fost nul. +jmx.rest.client.class.name.null.explanation=Argumentul de nume de clas\u0103 nu trebuie s\u0103 fie nul. +jmx.rest.client.class.name.null.useraction=Furniza\u0163i un nume de clas\u0103 nenul c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.attribute.name.null=CWWKX0209E: Argumentul de nume de atribut a fost nul. +jmx.rest.client.attribute.name.null.explanation=Argumentul de nume de atribut nu trebuie s\u0103 fie nul. +jmx.rest.client.attribute.name.null.useraction=Furniza\u0163i un nume de atribut nenul c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.attribute.names.null=CWWKX0210E: Argumentul care con\u0163ine o matrice de nume de atribute a fost nul. +jmx.rest.client.attribute.names.null.explanation=Argumentul care con\u0163ine o matrice de nume de atribute nu trebuie s\u0103 fie nul. +jmx.rest.client.attribute.names.null.useraction=Furniza\u0163i o matrice nenul\u0103 de nume de atribute c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.attribute.null=CWWKX0211E: Argumentul Atribut a fost nul. +jmx.rest.client.attribute.null.explanation=Argumentul Atribut nu trebuie s\u0103 fie nul. +jmx.rest.client.attribute.null.useraction=Furniza\u0163i un Atribut nenul c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.attribute.list.null=CWWKX0212E: Argumentul AttributeList a fost nul. +jmx.rest.client.attribute.list.null.explanation=Argumentul AttributeList nu trebuie s\u0103 fie nul. +jmx.rest.client.attribute.list.null.useraction=Furniza\u0163i un AttributeList nenul c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.object.name.null=CWWKX0213E: Argumentul ObjectName a fost nul. +jmx.rest.client.object.name.null.explanation=Argumentul ObjectName nu trebuie s\u0103 fie nul. +jmx.rest.client.object.name.null.useraction=Furniza\u0163i un ObjectName nenul c\u00e2nd apela\u0163i metoda. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: A fost returnat un obiect Throwable nea\u015fteptat de la server. +jmx.rest.client.unexpected.server.throwable.explanation=Excep\u0163ia \u00eenf\u0103\u015foar\u0103 un obiect Throwable returnat de la server care nu este \u00een mod normal a\u015fteptat\u0103 pentru aceast\u0103 opera\u0163ie. +jmx.rest.client.unexpected.server.throwable.useraction=Pentru informa\u0163ii suplimentare examina\u0163i istoricele de server. + +jmx.rest.client.bad.credentials=CWWKX0215E: A existat o problem\u0103 cu numele utilizator sau parola furnizate. Serverul a r\u0103spuns cu cod {0} \u015fi mesaj ''{1}'' +jmx.rest.client.bad.credentials.explanation=Acredit\u0103rile furnizate la ob\u0163inerea conexiunii au fost incorecte. Utilizatorul poate s\u0103 nu existe sau s\u0103 nu aib\u0103 autoritatea de a accesa serverul, sau parola poate fi incorect\u0103. +jmx.rest.client.bad.credentials.useraction=Corecta\u0163i numele utilizator sau parola, apoi ob\u0163ine\u0163i o nou\u0103 conexiune. + +jmx.rest.client.object.name.pattern=CWWKX0216E: Argumentul ObjectName ''{0}'' este un model." +jmx.rest.client.object.name.pattern.explanation=Argumentul ObjectName este un model dar metoda cere un ObjectName care s\u0103 se potriveasc\u0103 exact cu un MBean. +jmx.rest.client.object.name.pattern.useraction=Furniza\u0163i un argument ObjectName f\u0103r\u0103 metacaractere care se va potrivi exact cu un MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: Nu este \u00eenregistrat niciun MBean cu ObjectName ''{0}'' dat. +jmx.rest.client.instance.not.found.explanation=Opera\u0163ia cere un MBean \u00eenregistrat, dar nu a fost \u00eenregistrat niciun MBean cu ObjectName dat. +jmx.rest.client.instance.not.found.useraction=Asigura\u0163i-v\u0103 c\u0103 MBean-ul este \u00eenregistrat \u00eenainte de a \u00eencerca s\u0103 face\u0163i opera\u0163ii de gestiune pa el. + +jmx.rest.client.attribute.not.found=CWWKX0218E: MBean-ul ''{0}'' nu are un atribut cu numele ''{1}'' +jmx.rest.client.attribute.not.found.explanation=MBean-ul nu furnizeaz\u0103 un atribut cu numele dat. +jmx.rest.client.attribute.not.found.useraction=Ob\u0163ine\u0163i informa\u0163ii de MBean pentru a confirma ce atribute furnizeaz\u0103 MBean-ul. + +jmx.rest.client.operation.not.found=CWWKX0219E: MBean-ul ''{0}'' nu are o opera\u0163ie cu numele ''{1}'' +jmx.rest.client.operation.not.found.explanation=MBean-ul nu furnizeaz\u0103 o opera\u0163ie cu numele dat. +jmx.rest.client.operation.not.found.useraction=Ob\u0163ine\u0163i informa\u0163ii de MBean pentru a confirma ce opera\u0163ii furnizeaz\u0103 MBean-ul. + +jmx.rest.client.listener.not.found=CWWKX0220E: NotificationListener-ul dat nu este \u00eenregistrat curent pentru a primi notific\u0103ri de la MBean-ul ''{0}'' +jmx.rest.client.listener.not.found.explanation=NotificationListener-ul nu a fost ad\u0103ugat sau a fost deja \u00eenl\u0103turat \u015fi nu este \u00eenregistrat curent pentru a primi notific\u0103ri de la MBean-ul dat. +jmx.rest.client.listener.not.found.useraction=Asigura\u0163i-v\u0103 c\u0103 codul de apelare urm\u0103re\u015fte ce NotificationListener-e au fost ad\u0103ugate \u015fi \u00eenl\u0103turate sau capta\u0163i \u015fi instrumenta\u0163i excep\u0163ia. + +jmx.rest.client.notification.lost=CWWKX0221I: Notificarea nu a putut fi livrat\u0103. +jmx.rest.client.notification.lost.explanation=O notificare nu a putut fi livrat\u0103 unuia sau mai multor ascult\u0103toare de notific\u0103ri, deoarece NotificationListener \u00eenregistrat nu a fost g\u0103sit sau exista o excep\u0163ie \u00een timpul livr\u0103rii notific\u0103rii. +jmx.rest.client.notification.lost.useraction=Dac\u0103 notificarea trebuia livrat\u0103 la un NotificationListener (ascult\u0103tor de notific\u0103ri) existent, verifica\u0163i istoricele pentru excep\u0163ii. + +jmx.rest.client.connection.failed=CWWKX0222I: A e\u015fuat conexiunea la server. +jmx.rest.client.connection.failed.explanation=Serverul a devenit indisponibil \u015fi nu a devenit disponibil din nou \u00een intervalul maxim permisibil configurat. +jmx.rest.client.connection.failed.useraction=Verifica\u0163i conexiunea de re\u0163ea \u015fi asigura\u0163i-v\u0103 c\u0103 serverul ruleaz\u0103 cu caracteristica de conector REST activat\u0103. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: S-a pierdut temporar conexiunea la server. +jmx.rest.client.connection.temporarily.lost.explanation=Serverul a devenit indisponibil, dar clientul va \u00eencerca s\u0103 restaureze conexiunea pe durata intervalului de timp maxim permisibil configurat. +jmx.rest.client.connection.temporarily.lost.useraction=Dac\u0103 serverul este repornit inten\u0163ionat, nu este necesar\u0103 nici o ac\u0163iune. Altfel, verifica\u0163i conexiunea de re\u0163ea \u015fi asigura\u0163i-v\u0103 c\u0103 serverul ruleaz\u0103 cu caracteristica de conector REST activat\u0103. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: Conexiunea a fost restaurat\u0103 dar excep\u0163iile au ap\u0103rut la ad\u0103ugarea NotificationListener-ilor. +jmx.rest.client.connection.restored.with.exceptions.explanation=Conexiunea la server s-a pierdut temporar dar a fost restaurat\u0103 cu succes. Excep\u0163iile au ap\u0103rut la ad\u0103ugarea NotificationListener-ilor, deci unele notific\u0103ri pot lipsi. +jmx.rest.client.connection.restored.with.exceptions.useraction=Verifica\u0163i c\u0103 excep\u0163iile au inclus notificarea \u015fi re-\u00eenregistra\u0163i NotificationListener-ii dup\u0103 corectarea problemelor. + +jmx.rest.client.connection.restored=CWWKX0225I: Conexiunea a fost restaurat\u0103 cu succes. +jmx.rest.client.connection.restored.explanation=Conexiunea la server s-a pierdut temporar dar a fost restaurat\u0103 cu succes. To\u0163i NotificationListener-ii \u00eenregistra\u0163i vor continua s\u0103 primeasc\u0103 notific\u0103ri. +jmx.rest.client.connection.restored.useraction=F\u0103r\u0103 + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: Parametrul de tipul JMXServiceURL nu poate fi null. +jmx.rest.client.connection.illegal.argument.explanation=Valoarea parametrului 'serviceURL' nu poate fi null. +jmx.rest.client.connection.illegal.argument.useraction=Reconecta\u0163i-v\u0103 la JMX REST Connector folosind o valoare JMXServiceURL non-null. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: Urm\u0103toarea nu este o valoare de punct final valid\u0103: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=Valoarea de punct final specificat\u0103 nu este valid\u0103. +jmx.rest.client.connection.invalid.endpoint.useraction=Reconecta\u0163i-v\u0103 la JMX REST Connector folosind o valoare de punct final valid\u0103 care este de tipul String \u015fi are formatul "host:port". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: Nu s-au g\u0103sit puncte finale disponibile pentru ini\u0163ializarea conectorului. +jmx.rest.client.connection.no.endpoints.explanation=Niciunul din punctele finale specificate nu este disponibil \u00een timpul ini\u0163ializ\u0103rii pentru JMX REST Connector. +jmx.rest.client.connection.no.endpoints.useraction=Reconecta\u0163i-v\u0103 la JMX REST Connector folosind cel pu\u0163in un punct final disponibil. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: A existat o problem\u0103 cu acredit\u0103rile de utilizator furnizate. Serverul a r\u0103spuns cu codul {0} \u015fi mesajul ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=Acredit\u0103rile furnizate sunt incorecte, expirate, incomplete sau cu autorizare refuzat\u0103. +jmx.rest.client.bad.user.credentials.useraction=Verifica\u0163i c\u0103 acredit\u0103rile de utilizator au autentificare \u015fi autoriza\u0163ie corecte, apoi ob\u0163ine\u0163i o nou\u0103 conexiune. + +jmx.rest.client.connection.connect=CWWKX0230I: Membrul colectiv a deschis clientul JMX pentru controlerul colectiv: {0} +jmx.rest.client.connection.connect.explanation=Membrul conectat la controler. +jmx.rest.client.connection.connect.useraction=Nu este necesar\u0103 nicio ac\u0163iune. + +jmx.rest.client.connection.disconnect=CWWKX0231I: Membrul colectiv a \u00eenchis clientul JMX pentru controlerul colectiv: {0} +jmx.rest.client.connection.disconnect.explanation=Membrul s-a deconectat de la controler. +jmx.rest.client.connection.disconnect.useraction=Nu este necesar\u0103 nicio ac\u0163iune. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ru.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ru.nlsprops new file mode 100755 index 00000000000..a169f12238f --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_ru.nlsprops @@ -0,0 +1,146 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: \u0412 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 REST WebSphere Java Management Extensions \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0441 URL {0} \u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 {1} +jmx.rest.client.request.error.explanation=\u0412 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 REST WebSphere Java Management Extensions \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 +jmx.rest.client.request.error.useraction=\u0421\u043c. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. + +jmx.rest.client.response.error=CWWKX0202E: \u041a\u043b\u0438\u0435\u043d\u0442\u0443 REST WebSphere Java Management Extensions \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 URL {0} \u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 {1} +jmx.rest.client.response.error.explanation=\u041a\u043b\u0438\u0435\u043d\u0442\u0443 REST WebSphere Java Management Extensions \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 +jmx.rest.client.response.error.useraction=\u0421\u043c. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. + +jmx.rest.client.response.code.error=CWWKX0203E: \u041a\u043b\u0438\u0435\u043d\u0442 REST WebSphere Java Management Extensions \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0442\u0432\u0435\u0442 \u0441 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c {0} \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c ''{1}'' \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 URL {2} \u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 {3} +jmx.rest.client.response.code.error.explanation=\u041a\u043b\u0438\u0435\u043d\u0442 REST WebSphere Java Management Extensions \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0442\u0432\u0435\u0442 \u0441 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 +jmx.rest.client.response.code.error.useraction=\u0421\u043c. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. + +jmx.rest.client.server.throwable.exception=CWWKX0204E: \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c Throwable \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430. +jmx.rest.client.server.throwable.exception.explanation=\u0421\u0435\u0440\u0432\u0435\u0440 \u0441\u043e\u043e\u0431\u0449\u0438\u043b \u043e\u0431 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043d\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 Throwable \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u043b\u0430\u0441\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Throwable \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430. +jmx.rest.client.server.throwable.exception.useraction=\u0421\u043c. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. + +jmx.rest.client.not.connected=CWWKX0206E: \u041a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443. +jmx.rest.client.not.connected.explanation=\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u043e \u0438\u043b\u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e. +jmx.rest.client.not.connected.useraction=\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043d\u043e\u0432\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. + +jmx.rest.client.url.not.found=CWWKX0207E: \u0421\u0435\u0440\u0432\u0435\u0440 \u0441\u043e\u043e\u0431\u0449\u0438\u043b, \u0447\u0442\u043e \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 URL, \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c. +jmx.rest.client.url.not.found.explanation=\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u0438\u043b\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST. +jmx.rest.client.url.not.found.useraction=\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043d\u043e\u0432\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. + +jmx.rest.client.class.name.null=CWWKX0208E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u043d\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u0443\u0441\u0442. +jmx.rest.client.class.name.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u043d\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.class.name.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0435 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430. + +jmx.rest.client.attribute.name.null=CWWKX0209E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u043d\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u043f\u0443\u0441\u0442. +jmx.rest.client.attribute.name.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u043d\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.attribute.name.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0435 \u0438\u043c\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430. + +jmx.rest.client.attribute.names.null=CWWKX0210E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043c\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043f\u0443\u0441\u0442. +jmx.rest.client.attribute.names.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043c\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.attribute.names.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043c\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. + +jmx.rest.client.attribute.null=CWWKX0211E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 Attribute \u043f\u0443\u0441\u0442. +jmx.rest.client.attribute.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 Attribute \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.attribute.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0439 Attribute. + +jmx.rest.client.attribute.list.null=CWWKX0212E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 AttributeList \u043f\u0443\u0441\u0442. +jmx.rest.client.attribute.list.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 AttributeList \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.attribute.list.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0439 AttributeList. + +jmx.rest.client.object.name.null=CWWKX0213E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 ObjectName \u043f\u0443\u0441\u0442. +jmx.rest.client.object.name.null.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 ObjectName \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. +jmx.rest.client.object.name.null.useraction=\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0439 ObjectName. + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: \u0421\u0435\u0440\u0432\u0435\u0440 \u0432\u0435\u0440\u043d\u0443\u043b \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 Throwable. +jmx.rest.client.unexpected.server.throwable.explanation=\u041f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043b \u043e\u0431\u044a\u0435\u043a\u0442 Throwable, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c: \u043f\u0440\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e. +jmx.rest.client.unexpected.server.throwable.useraction=\u0421\u043c. \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430. + +jmx.rest.client.bad.credentials=CWWKX0215E: \u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0430 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u0435\u043c. \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0431\u044b\u043b \u0443\u043a\u0430\u0437\u0430\u043d \u043a\u043e\u0434 {0} \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 ''{1}'' +jmx.rest.client.bad.credentials.explanation=\u041f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u044b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0438\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043b \u043f\u0430\u0440\u043e\u043b\u044c. +jmx.rest.client.bad.credentials.useraction=\u0418\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. + +jmx.rest.client.object.name.pattern=CWWKX0216E: \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 ObjectName ''{0}'' \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c." +jmx.rest.client.object.name.pattern.explanation=\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 ObjectName \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c, \u043d\u043e \u043c\u0435\u0442\u043e\u0434 \u0442\u0440\u0435\u0431\u0443\u0435\u0442, \u0447\u0442\u043e\u0431\u044b ObjectName \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u043e\u043c\u0443 MBean. +jmx.rest.client.object.name.pattern.useraction=\u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 ObjectName \u0431\u0435\u0437 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0431\u044b \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u043e\u043c\u0443 MBean. + +jmx.rest.client.instance.not.found=CWWKX0217E: \u0414\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e ObjectName ''{0}'' \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0438 \u043e\u0434\u0438\u043d MBean +jmx.rest.client.instance.not.found.explanation=\u0414\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 MBean, \u043d\u043e \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c ObjectName \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0438 \u043e\u0434\u0438\u043d MBean. +jmx.rest.client.instance.not.found.useraction=\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u044b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 MBean. + +jmx.rest.client.attribute.not.found=CWWKX0218E: \u0412 MBean ''{0}'' \u043d\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ''{1}'' +jmx.rest.client.attribute.not.found.explanation=\u0412 MBean \u043d\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c. +jmx.rest.client.attribute.not.found.useraction=\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e MBean \u0438 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u0435, \u043a\u0430\u043a\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0432 \u043d\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b. + +jmx.rest.client.operation.not.found=CWWKX0219E: \u0412 MBean ''{0}'' \u043d\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ''{1}'' +jmx.rest.client.operation.not.found.explanation=\u0412 MBean \u043d\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c. +jmx.rest.client.operation.not.found.useraction=\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e MBean \u0438 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u0435, \u043a\u0430\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u043d\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b. + +jmx.rest.client.listener.not.found=CWWKX0220E: \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 NotificationListener \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043e\u0442 MBean ''{0}'' +jmx.rest.client.listener.not.found.explanation=\u041e\u0431\u044a\u0435\u043a\u0442 NotificationListener \u043d\u0435 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0438\u043b\u0438 \u0443\u0436\u0435 \u0431\u044b\u043b \u0443\u0434\u0430\u043b\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043d \u043d\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043e\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e MBean. +jmx.rest.client.listener.not.found.useraction=\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432 \u043a\u043e\u0434\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 NotificationListener, \u0438\u043b\u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0439\u0442\u0435\u0441\u044c \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0443 \u043f\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. + +jmx.rest.client.notification.lost=CWWKX0221I: \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435. +jmx.rest.client.notification.lost.explanation=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c NotificationListener, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 NotificationListener \u0438\u043b\u0438 \u0432 \u0445\u043e\u0434\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f. +jmx.rest.client.notification.lost.useraction=\u0415\u0441\u043b\u0438 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 NotificationListener, \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u0445. + +jmx.rest.client.connection.failed=CWWKX0222I: \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. +jmx.rest.client.connection.failed.explanation=\u0421\u0435\u0440\u0432\u0435\u0440 \u0441\u0442\u0430\u043b \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0438\u0441\u0442\u0435\u0447\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. +jmx.rest.client.connection.failed.useraction=\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0442\u044c\u044e \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST. + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043e. +jmx.rest.client.connection.temporarily.lost.explanation=\u0421\u0435\u0440\u0432\u0435\u0440 \u0441\u0442\u0430\u043b \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c, \u043d\u043e \u043a\u043b\u0438\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0438\u0441\u0442\u0435\u0447\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. +jmx.rest.client.connection.temporarily.lost.useraction=\u0415\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043b\u0430\u043d\u043e\u0432\u043e\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0442\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 REST. + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e, \u043d\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 NotificationListener \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. +jmx.rest.client.connection.restored.with.exceptions.explanation=\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0431\u044b\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043e, \u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e. \u0422\u0430\u043a \u043a\u0430\u043a \u0432 \u0445\u043e\u0434\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 NotificationListener \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043c\u043e\u0433\u043b\u0438 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u043d\u0435 \u0432\u0441\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f. +jmx.rest.client.connection.restored.with.exceptions.useraction=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f, \u0438 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043e\u043a \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b NotificationListener. + +jmx.rest.client.connection.restored=CWWKX0225I: \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e. +jmx.rest.client.connection.restored.explanation=\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0431\u044b\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043e, \u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e. \u0412\u0441\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b NotificationListener \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f. +jmx.rest.client.connection.restored.useraction=\u041d\u0435\u0442 + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0441 \u0442\u0438\u043f\u043e\u043c JMXServiceURL \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u043c. +jmx.rest.client.connection.illegal.argument.explanation=\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 'serviceURL' \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u043c. +jmx.rest.client.connection.illegal.argument.useraction=\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u0441\u044c \u043a \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0443 JMX REST \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e, \u0443\u043a\u0430\u0437\u0430\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 JMXServiceURL, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u0435\u0432\u044b\u043c. + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: \u0414\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438: {0} +jmx.rest.client.connection.invalid.endpoint.explanation=\u0423\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c. +jmx.rest.client.connection.invalid.endpoint.useraction=\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u0441\u044c \u043a \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0443 JMX REST \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e, \u0443\u043a\u0430\u0437\u0430\u0432 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441 \u0442\u0438\u043f\u043e\u043c String \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 "\u0445\u043e\u0441\u0442:\u043f\u043e\u0440\u0442". + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430. +jmx.rest.client.connection.no.endpoints.explanation=\u041d\u0438 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u043d\u0435 \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 JMX REST. +jmx.rest.client.connection.no.endpoints.useraction=\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u0441\u044c \u043a \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0443 JMX REST \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e, \u0443\u043a\u0430\u0437\u0430\u0432 \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 1 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443. + +jmx.rest.client.bad.user.credentials=CWWKX0229E: \u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043a\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0431\u044b\u043b \u0443\u043a\u0430\u0437\u0430\u043d \u043a\u043e\u0434 {0} \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0443\u0441\u0442\u0430\u0440\u0435\u043b\u0438, \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u044b \u0438\u043b\u0438 \u043a \u043d\u0438\u043c \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f. +jmx.rest.client.bad.user.credentials.useraction=\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u044c\u0442\u0435 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. + +jmx.rest.client.connection.connect=CWWKX0230I: \u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0433\u0440\u0443\u043f\u043f\u044b \u043e\u0442\u043a\u0440\u044b\u043b \u043a\u043b\u0438\u0435\u043d\u0442 JMX \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430: {0} +jmx.rest.client.connection.connect.explanation=\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443. +jmx.rest.client.connection.connect.useraction=\u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + +jmx.rest.client.connection.disconnect=CWWKX0231I: \u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0433\u0440\u0443\u043f\u043f\u044b \u0437\u0430\u043a\u0440\u044b\u043b \u043a\u043b\u0438\u0435\u043d\u0442 JMX \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430: {0} +jmx.rest.client.connection.disconnect.explanation=\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. +jmx.rest.client.connection.disconnect.useraction=\u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh.nlsprops new file mode 100755 index 00000000000..94beef54688 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh.nlsprops @@ -0,0 +1,144 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: \u51c6\u5907\u5728\u8fde\u63a5 {1} \u4e0a\u4e3a URL {0} \u8bf7\u6c42\u670d\u52a1\u5668\u65f6\uff0cWebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u9047\u5230\u9519\u8bef\u3002 +jmx.rest.client.request.error.explanation=\u51c6\u5907\u8bf7\u6c42\u670d\u52a1\u5668\u65f6\uff0cWebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u9047\u5230\u9519\u8bef\u3002 +jmx.rest.client.request.error.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 + +jmx.rest.client.response.error=CWWKX0202E: WebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u65e0\u6cd5\u5728\u8fde\u63a5 {1} \u4e0a\u4e3a URL {0} \u5904\u7406\u6765\u81ea\u670d\u52a1\u5668\u7684\u54cd\u5e94\u3002 +jmx.rest.client.response.error.explanation=WebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u65e0\u6cd5\u5904\u7406\u6765\u81ea\u670d\u52a1\u5668\u7684\u54cd\u5e94\u3002 +jmx.rest.client.response.error.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 + +jmx.rest.client.response.code.error=CWWKX0203E: WebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u5728\u8fde\u63a5 {3} \u4e0a\u4e3a URL {2} \u4ece\u670d\u52a1\u5668\u63a5\u6536\u5230\u5e26\u6709\u6d88\u606f\u201c{1}\u201d\u7684\u610f\u5916\u54cd\u5e94\u4ee3\u7801 {0}\u3002 +jmx.rest.client.response.code.error.explanation=WebSphere Java Management Extensions REST \u5ba2\u6237\u673a\u4ece\u670d\u52a1\u5668\u63a5\u6536\u5230\u610f\u5916\u54cd\u5e94\u4ee3\u7801\u3002 +jmx.rest.client.response.code.error.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 + +jmx.rest.client.server.throwable.exception=CWWKX0204E: \u65e0\u6cd5\u89e3\u6790\u670d\u52a1\u5668\u9519\u8bef\u6d41\u4e2d\u7684 Throwable\u3002 +jmx.rest.client.server.throwable.exception.explanation=\u670d\u52a1\u5668\u5728\u5904\u7406\u5ba2\u6237\u673a\u8bf7\u6c42\u65f6\u629b\u51fa\u4e86\u5f02\u5e38\uff0c\u4f46\u662f\u5ba2\u6237\u673a\u65e0\u6cd5\u89e3\u6790\u670d\u52a1\u5668\u9519\u8bef\u6d41\u4e2d\u7684 Throwable \u5bf9\u8c61\u3002Throwable \u5bf9\u8c61\u7684\u7c7b\u53ef\u80fd\u5bf9\u5ba2\u6237\u673a\u4e0d\u53ef\u7528\u3002 +jmx.rest.client.server.throwable.exception.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 + +jmx.rest.client.not.connected=CWWKX0206E: \u5ba2\u6237\u673a\u672a\u8fde\u63a5\u5230\u670d\u52a1\u5668\u3002 +jmx.rest.client.not.connected.explanation=\u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u5df2\u5173\u95ed\u6216\u5df2\u5931\u8d25\u3002 +jmx.rest.client.not.connected.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u4e0a\u662f\u5426\u5df2\u542f\u7528 REST \u8fde\u63a5\u5668\u529f\u80fd\u90e8\u4ef6\u5e76\u83b7\u53d6\u4e0e\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002 + +jmx.rest.client.url.not.found=CWWKX0207E: \u670d\u52a1\u5668\u62a5\u544a\u672a\u627e\u5230\u5ba2\u6237\u673a\u6240\u8bf7\u6c42\u7684 URL\u3002 +jmx.rest.client.url.not.found.explanation=\u5ba2\u6237\u673a\u5177\u6709\u7684\u4fe1\u606f\u53ef\u80fd\u5df2\u8fc7\u65f6\uff0c\u6216\u8005\u53ef\u80fd\u5728\u670d\u52a1\u5668\u4e0a\u5df2\u7981\u7528 REST \u8fde\u63a5\u5668\u529f\u80fd\u90e8\u4ef6\u3002 +jmx.rest.client.url.not.found.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u4e0a\u662f\u5426\u5df2\u542f\u7528 REST \u8fde\u63a5\u5668\u529f\u80fd\u90e8\u4ef6\u5e76\u83b7\u53d6\u4e0e\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002 +jmx.rest.client.class.name.null=CWWKX0208E: \u7c7b\u540d\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.class.name.null.explanation=\u7c7b\u540d\u81ea\u53d8\u91cf\u4e0d\u5f97\u4e3a null\u3002 +jmx.rest.client.class.name.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u975e null \u7c7b\u540d\u3002 + +jmx.rest.client.attribute.name.null=CWWKX0209E: \u5c5e\u6027\u540d\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.attribute.name.null.explanation=\u5c5e\u6027\u540d\u81ea\u53d8\u91cf\u4e0d\u5f97\u4e3a null\u3002 +jmx.rest.client.attribute.name.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u975e null \u5c5e\u6027\u540d\u3002 + +jmx.rest.client.attribute.names.null=CWWKX0210E: \u5305\u542b\u4e00\u7cfb\u5217\u5c5e\u6027\u540d\u7684\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.attribute.names.null.explanation=\u5305\u542b\u4e00\u7cfb\u5217\u5c5e\u6027\u540d\u7684\u81ea\u53d8\u91cf\u4e0d\u5f97\u4e3a null\u3002 +jmx.rest.client.attribute.names.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u4e00\u7ec4\u975e null \u5c5e\u6027\u540d\u3002 + +jmx.rest.client.attribute.null=CWWKX0211E: \u5c5e\u6027\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.attribute.null.explanation=\u5c5e\u6027\u81ea\u53d8\u91cf\u4e0d\u5f97\u4e3a null\u3002 +jmx.rest.client.attribute.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u975e null \u5c5e\u6027\u3002 + +jmx.rest.client.attribute.list.null=CWWKX0212E: \u5c5e\u6027\u5217\u8868\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.attribute.list.null.explanation=\u5c5e\u6027\u5217\u8868\u81ea\u53d8\u91cf\u4e0d\u80fd\u4e3a null\u3002 +jmx.rest.client.attribute.list.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u975e null \u5c5e\u6027\u5217\u8868\u3002 + +jmx.rest.client.object.name.null=CWWKX0213E: \u5bf9\u8c61\u540d\u81ea\u53d8\u91cf\u4e3a null\u3002 +jmx.rest.client.object.name.null.explanation=\u5bf9\u8c61\u540d\u81ea\u53d8\u91cf\u4e0d\u80fd\u4e3a null\u3002 +jmx.rest.client.object.name.null.useraction=\u5728\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u8bf7\u63d0\u4f9b\u975e null \u5bf9\u8c61\u540d\u3002 + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: \u4ece\u670d\u52a1\u5668\u8fd4\u56de\u4e86\u610f\u5916\u7684 Throwable \u5bf9\u8c61\u3002 +jmx.rest.client.unexpected.server.throwable.explanation=\u6b64\u5f02\u5e38\u5305\u542b\u4ece\u670d\u52a1\u5668\u8fd4\u56de\u7684 Throwable \u5bf9\u8c61\uff0c\u6b64\u5bf9\u8c61\u901a\u67e5\u4e0d\u662f\u6b64\u64cd\u4f5c\u6240\u671f\u671b\u7684\u3002 +jmx.rest.client.unexpected.server.throwable.useraction=\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u65e5\u5fd7\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 + +jmx.rest.client.bad.credentials=CWWKX0215E: \u63d0\u4f9b\u7684\u7528\u6237\u540d\u6216\u5bc6\u7801\u5b58\u5728\u95ee\u9898\u3002\u670d\u52a1\u5668\u4ee5\u4ee3\u7801 {0} \u548c\u6d88\u606f\u201c{1}\u201d\u4f5c\u4e3a\u54cd\u5e94 +jmx.rest.client.bad.credentials.explanation=\u83b7\u53d6\u8fde\u63a5\u65f6\u63d0\u4f9b\u7684\u51ed\u8bc1\u4e0d\u6b63\u786e\u3002\u7528\u6237\u53ef\u80fd\u4e0d\u5b58\u5728\u6216\u4e0d\u5177\u6709\u8bbf\u95ee\u670d\u52a1\u5668\u7684\u6743\u9650\uff0c\u6216\u8005\u5bc6\u7801\u53ef\u80fd\u4e0d\u6b63\u786e\u3002 +jmx.rest.client.bad.credentials.useraction=\u66f4\u6b63\u7528\u6237\u540d\u6216\u5bc6\u7801\uff0c\u7136\u540e\u83b7\u53d6\u4e00\u4e2a\u65b0\u8fde\u63a5\u3002 + +jmx.rest.client.object.name.pattern=CWWKX0216E: \u5bf9\u8c61\u540d\u81ea\u53d8\u91cf\u201c{0}\u201d\u662f\u4e00\u4e2a\u6a21\u5f0f\u3002" +jmx.rest.client.object.name.pattern.explanation=\u5bf9\u8c61\u540d\u81ea\u53d8\u91cf\u662f\u4e00\u4e2a\u6a21\u5f0f\uff0c\u4f46\u65b9\u6cd5\u9700\u8981\u7684\u662f\u4e0e\u4e00\u4e2a MBean \u5b8c\u5168\u5339\u914d\u7684\u5bf9\u8c61\u540d\u3002 +jmx.rest.client.object.name.pattern.useraction=\u8bf7\u63d0\u4f9b\u4e00\u4e2a\u4e0d\u5305\u542b\u901a\u914d\u7b26\u4e14\u4e0e\u4e00\u4e2a MBean \u5b8c\u5168\u5339\u914d\u7684\u5bf9\u8c61\u540d\u81ea\u53d8\u91cf\u3002 + +jmx.rest.client.instance.not.found=CWWKX0217E: \u5f53\u524d\u672a\u6ce8\u518c\u5177\u6709\u7ed9\u5b9a\u7684\u5bf9\u8c61\u540d\u201c {0}\u201d\u7684 MBean\u3002 +jmx.rest.client.instance.not.found.explanation=\u64cd\u4f5c\u9700\u8981\u6ce8\u518c\u7684 MBean\uff0c\u4f46\u662f\u672a\u6ce8\u518c\u5177\u6709\u7ed9\u5b9a\u7684\u5bf9\u8c61\u540d\u7684 MBean\u3002 +jmx.rest.client.instance.not.found.useraction=\u8bf7\u786e\u4fdd\u5728\u5c1d\u8bd5\u5bf9 MBean \u6267\u884c\u7ba1\u7406\u64cd\u4f5c\u524d\uff0c\u5df2\u5bf9\u5176\u8fdb\u884c\u6ce8\u518c\u3002 + +jmx.rest.client.attribute.not.found=CWWKX0218E: MBean\u201c{0}\u201d\u4e0d\u5177\u6709\u540d\u79f0\u4e3a\u201c{1}\u201d\u7684\u5c5e\u6027 +jmx.rest.client.attribute.not.found.explanation=MBean \u672a\u63d0\u4f9b\u5177\u6709\u7ed9\u5b9a\u540d\u79f0\u7684\u5c5e\u6027\u3002 +jmx.rest.client.attribute.not.found.useraction=\u83b7\u53d6 MBean \u4fe1\u606f\u4ee5\u786e\u8ba4 MBean \u6240\u63d0\u4f9b\u7684\u5c5e\u6027\u3002 + +jmx.rest.client.operation.not.found=CWWKX0219E: MBean\u201c{0}\u201d\u4e0d\u5177\u6709\u540d\u79f0\u4e3a\u201c{1}\u201d\u7684\u64cd\u4f5c +jmx.rest.client.operation.not.found.explanation=MBean \u672a\u63d0\u4f9b\u5177\u6709\u7ed9\u5b9a\u540d\u79f0\u7684\u64cd\u4f5c\u3002 +jmx.rest.client.operation.not.found.useraction=\u83b7\u53d6 MBean \u4fe1\u606f\u4ee5\u786e\u8ba4 MBean \u6240\u63d0\u4f9b\u7684\u64cd\u4f5c\u3002 + +jmx.rest.client.listener.not.found=CWWKX0220E: \u7ed9\u5b9a\u7684\u901a\u77e5\u4fa6\u542c\u5668\u5f53\u524d\u672a\u6ce8\u518c\u4e3a\u63a5\u6536\u6765\u81ea MBean\u201c{0}\u201d\u7684\u901a\u77e5 +jmx.rest.client.listener.not.found.explanation=\u672a\u6dfb\u52a0\u901a\u77e5\u4fa6\u542c\u5668\u6216\u8005\u5df2\u5c06\u5176\u9664\u53bb\uff0c\u5e76\u4e14\u901a\u77e5\u4fa6\u542c\u5668\u5f53\u524d\u672a\u6ce8\u518c\u4e3a\u63a5\u6536\u6765\u81ea\u7ed9\u5b9a\u7684 MBean \u7684\u901a\u77e5\u3002 +jmx.rest.client.listener.not.found.useraction=\u8bf7\u786e\u4fdd\u8c03\u7528\u4ee3\u7801\u8ddf\u8e2a\u6dfb\u52a0\u548c\u9664\u53bb\u7684\u901a\u77e5\u4fa6\u542c\u5668\u6216\u83b7\u53d6\u548c\u5904\u7406\u5f02\u5e38\u3002 + +jmx.rest.client.notification.lost=CWWKX0221I: \u65e0\u6cd5\u4f20\u9012\u901a\u77e5. +jmx.rest.client.notification.lost.explanation=\u65e0\u6cd5\u5c06\u901a\u77e5\u4f20\u9012\u7ed9\u4e00\u4e2a\u6216\u591a\u4e2a\u901a\u77e5\u4fa6\u542c\u5668\uff0c\u56e0\u4e3a\u672a\u627e\u5230\u5df2\u6ce8\u518c\u901a\u77e5\u4fa6\u542c\u5668\u6216\u5728\u4f20\u9012\u901a\u77e5\u65f6\u53d1\u751f\u4e86\u5f02\u5e38\u3002 +jmx.rest.client.notification.lost.useraction=\u5982\u679c\u901a\u77e5\u5e94\u4f20\u9012\u7ed9\u5df2\u6ce8\u518c\u901a\u77e5\u4fa6\u542c\u5668\uff0c\u8bf7\u68c0\u67e5\u65e5\u5fd7\u4ee5\u67e5\u627e\u5f02\u5e38\u3002 + +jmx.rest.client.connection.failed=CWWKX0222I: \u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u5df2\u5931\u8d25\u3002 +jmx.rest.client.connection.failed.explanation=\u670d\u52a1\u5668\u53d8\u5f97\u4e0d\u53ef\u7528\uff0c\u5e76\u4e14\u5728\u914d\u7f6e\u7684\u6700\u5927\u5141\u8bb8\u65f6\u95f4\u5185\u4e0d\u4f1a\u518d\u6b21\u53d8\u5f97\u53ef\u7528\u3002 +jmx.rest.client.connection.failed.useraction=\u8bf7\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\u5e76\u786e\u4fdd\u670d\u52a1\u5668\u6b63\u5728\u8fd0\u884c\uff08\u5df2\u542f\u7528 REST \u8fde\u63a5\u5668\u529f\u80fd\u90e8\u4ef6\uff09\u3002 + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: \u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u6682\u65f6\u5df2\u65ad\u5f00\u3002 +jmx.rest.client.connection.temporarily.lost.explanation=\u670d\u52a1\u5668\u5df2\u53d8\u5f97\u4e0d\u53ef\u7528\uff0c\u4f46\u662f\u5ba2\u6237\u673a\u5c06\u5728\u914d\u7f6e\u7684\u6700\u5927\u5141\u8bb8\u65f6\u95f4\u5185\u5c1d\u8bd5\u590d\u539f\u94fe\u63a5\u3002 +jmx.rest.client.connection.temporarily.lost.useraction=\u5982\u679c\u6b63\u5728\u6709\u610f\u5730\u91cd\u65b0\u542f\u52a8\u670d\u52a1\u5668\uff0c\u90a3\u4e48\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002\u5426\u5219\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\u5e76\u786e\u4fdd\u670d\u52a1\u5668\u6b63\u5728\u8fd0\u884c\uff08\u5df2\u542f\u7528 REST \u8fde\u63a5\u5668\u529f\u80fd\u90e8\u4ef6\uff09\u3002 + +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: \u8fde\u63a5\u5df2\u590d\u539f\uff0c\u4f46\u5728\u6dfb\u52a0\u901a\u77e5\u4fa6\u542c\u5668\u65f6\u53d1\u751f\u4e86\u5f02\u5e38\u3002 +jmx.rest.client.connection.restored.with.exceptions.explanation=\u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u4e34\u65f6\u65ad\u5f00\uff0c\u4f46\u5df2\u6210\u529f\u590d\u539f\u3002\u6dfb\u52a0\u901a\u77e5\u4fa6\u542c\u5668\u65f6\u53d1\u751f\u4e86\u5f02\u5e38\uff0c\u56e0\u6b64\u53ef\u80fd\u4e0d\u4f1a\u63a5\u6536\u5230\u67d0\u4e9b\u901a\u77e5\u3002 +jmx.rest.client.connection.restored.with.exceptions.useraction=\u8bf7\u68c0\u67e5\u901a\u77e5\u4e2d\u5305\u542b\u7684\u5f02\u5e38\u5e76\u5728\u66f4\u6b63\u95ee\u9898\u540e\u91cd\u65b0\u6ce8\u518c\u901a\u77e5\u4fa6\u542c\u5668\u3002 + +jmx.rest.client.connection.restored=CWWKX0225I: \u8fde\u63a5\u5df2\u6210\u529f\u590d\u539f\u3002 +jmx.rest.client.connection.restored.explanation=\u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u4e34\u65f6\u65ad\u5f00\uff0c\u4f46\u5df2\u6210\u529f\u590d\u539f\u3002\u4efb\u4f55\u5df2\u6ce8\u518c\u901a\u77e5\u76d1\u89c6\u5668\u5c06\u7ee7\u7eed\u6536\u5230\u901a\u77e5\u3002 +jmx.rest.client.connection.restored.useraction=\u65e0 + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: \u7c7b\u578b\u4e3a JMXServiceURL \u7684\u53c2\u6570\u4e0d\u80fd\u4e3a null\u3002 +jmx.rest.client.connection.illegal.argument.explanation=\u53c2\u6570\u201cserviceURL\u201d\u7684\u503c\u4e0d\u80fd\u4e3a null\u3002 +jmx.rest.client.connection.illegal.argument.useraction=\u8bf7\u4f7f\u7528\u975e\u7a7a JMXServiceURL \u503c\u91cd\u65b0\u8fde\u63a5\u81f3 JMX REST \u8fde\u63a5\u5668\u3002 + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: \u4ee5\u4e0b\u7aef\u70b9\u503c\u65e0\u6548\uff1a{0} +jmx.rest.client.connection.invalid.endpoint.explanation=\u6307\u5b9a\u7684\u7aef\u70b9\u503c\u65e0\u6548\u3002 +jmx.rest.client.connection.invalid.endpoint.useraction=\u8bf7\u4f7f\u7528\u7c7b\u578b\u4e3a\u201c\u5b57\u7b26\u4e32\u201d\u4e14\u683c\u5f0f\u4e3a\u201chost:port\u201d\u7684\u6709\u6548\u7aef\u70b9\u503c\u91cd\u65b0\u8fde\u63a5\u81f3 JMX REST \u8fde\u63a5\u5668\u3002 + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: \u627e\u4e0d\u5230\u4efb\u4f55\u53ef\u7528\u4e8e\u521d\u59cb\u5316\u8fde\u63a5\u5668\u7684\u7aef\u70b9\u3002 +jmx.rest.client.connection.no.endpoints.explanation=JMX REST \u8fde\u63a5\u5668\u521d\u59cb\u5316\u521d\u59cb\u5316\u671f\u95f4\u6ca1\u6709\u4efb\u4f55\u4e00\u4e2a\u6307\u5b9a\u7aef\u70b9\u53ef\u7528\u3002 +jmx.rest.client.connection.no.endpoints.useraction=\u8bf7\u81f3\u5c11\u4f7f\u7528 1 \u4e2a\u53ef\u7528\u7aef\u70b9\u91cd\u65b0\u8fde\u63a5\u81f3 JMX REST \u8fde\u63a5\u5668\u3002 + +jmx.rest.client.bad.user.credentials=CWWKX0229E: \u63d0\u4f9b\u7684\u7528\u6237\u51ed\u8bc1\u5b58\u5728\u95ee\u9898\u3002\u670d\u52a1\u5668\u4ee5\u4ee3\u7801 {0} \u548c\u6d88\u606f\u201c{1}\u201d\u4f5c\u4e3a\u54cd\u5e94 +jmx.rest.client.bad.user.credentials.explanation=\u63d0\u4f9b\u7684\u51ed\u8bc1\u4e0d\u6b63\u786e\u3001\u5df2\u5230\u671f\u3001\u4e0d\u5b8c\u6574\u6216\u4e3a\u62d2\u7edd\u7684\u6388\u6743\u3002 +jmx.rest.client.bad.user.credentials.useraction=\u9a8c\u8bc1\u7528\u6237\u51ed\u8bc1\u662f\u5426\u5177\u6709\u6b63\u786e\u8ba4\u8bc1\u548c\u6388\u6743\uff0c\u7136\u540e\u83b7\u53d6\u65b0\u8fde\u63a5\u3002 + +jmx.rest.client.connection.connect=CWWKX0230I: \u96c6\u5408\u4f53\u6210\u5458\u6253\u5f00\u4e86 JMX \u5ba2\u6237\u673a\u5230\u96c6\u5408\u4f53\u63a7\u5236\u5668\uff1a{0} +jmx.rest.client.connection.connect.explanation=\u6210\u5458\u5df2\u8fde\u63a5\u81f3\u63a7\u5236\u5668\u3002 +jmx.rest.client.connection.connect.useraction=\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 +jmx.rest.client.connection.disconnect=CWWKX0231I: \u96c6\u5408\u4f53\u6210\u5458\u4ece\u96c6\u5408\u4f53\u63a7\u5236\u5668\u5173\u95ed\u4e86 JMX \u5ba2\u6237\u673a\uff1a{0} +jmx.rest.client.connection.disconnect.explanation=\u6210\u5458\u5df2\u4e0e\u63a7\u5236\u5668\u65ad\u5f00\u8fde\u63a5\u3002 +jmx.rest.client.connection.disconnect.useraction=\u4e0d\u9700\u8981\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002 + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh_TW.nlsprops b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh_TW.nlsprops new file mode 100755 index 00000000000..d2f4d3951ea --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages_zh_TW.nlsprops @@ -0,0 +1,143 @@ +# IBM Confidential +# +# OCO Source Materials +# +# Copyright IBM Corp. 2012 +# +# The source code for this program is not published or otherwise divested +# of its trade secrets, irrespective of what has been deposited with the +# U.S. Copyright Office. +# +#CMVCPATHNAME com.ibm.ws.jmx.connector.client/resources/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessages.nlsprops +#ISMESSAGEFILE TRUE +#NLS_ENCODING=UNICODE +# +#COMPONENTPREFIX CWWKX +#COMPONENTNAMEFOR CWWKX JMX REST Client +# +# NLS_MESSAGEFORMAT_VAR +# +# Strings in this file which contain replacement variables are processed by the MessageFormat +# class (single quote must be coded as 2 consecutive single quotes ''). Strings in this file +# which do NOT contain replacement variables are NOT processed by the MessageFormat class +# (single quote must be coded as one single quote '). + +# Message prefix block: CWWKX0200-CWWKX0259 + +jmx.rest.client.request.error=CWWKX0201E: WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u5728\u6e96\u5099\u5c0d\u9023\u7dda {1} \u4e0a URL {0} \u7684\u4f3a\u670d\u5668\u63d0\u51fa\u8981\u6c42\u6642\uff0c\u767c\u73fe\u932f\u8aa4 +jmx.rest.client.request.error.explanation=WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u5728\u6e96\u5099\u4f3a\u670d\u5668\u7684\u8981\u6c42\u6642\uff0c\u767c\u73fe\u932f\u8aa4 +jmx.rest.client.request.error.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u65e5\u8a8c\uff0c\u4ee5\u53d6\u5f97\u9032\u4e00\u6b65\u8cc7\u8a0a\u3002 + +jmx.rest.client.response.error=CWWKX0202E: WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u7121\u6cd5\u8655\u7406\u4f86\u81ea\u4f3a\u670d\u5668\u91dd\u5c0d\u9023\u7dda {1} \u4e0a\u7684 URL {0} \u7684\u56de\u61c9 +jmx.rest.client.response.error.explanation=WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u7121\u6cd5\u8655\u7406\u4f86\u81ea\u4f3a\u670d\u5668\u7684\u56de\u61c9 +jmx.rest.client.response.error.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u65e5\u8a8c\uff0c\u4ee5\u53d6\u5f97\u9032\u4e00\u6b65\u8cc7\u8a0a\u3002 + +jmx.rest.client.response.code.error=CWWKX0203E: WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u63a5\u6536\u5230\u4f86\u81ea\u4f3a\u670d\u5668\u91dd\u5c0d\u9023\u7dda {3} \u4e0a\u7684 URL {2} \u7684\u975e\u9810\u671f\u56de\u61c9\u78bc {0}\uff0c\u5e36\u6709\u8a0a\u606f ''{1}'' +jmx.rest.client.response.code.error.explanation=WebSphere Java Management Extensions REST \u7528\u6236\u7aef\u63a5\u6536\u5230\u4f86\u81ea\u4f3a\u670d\u5668\u7684\u975e\u9810\u671f\u56de\u61c9\u78bc +jmx.rest.client.response.code.error.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u65e5\u8a8c\uff0c\u4ee5\u53d6\u5f97\u9032\u4e00\u6b65\u8cc7\u8a0a\u3002 + +jmx.rest.client.server.throwable.exception=CWWKX0204E: \u7121\u6cd5\u5f9e\u4f3a\u670d\u5668\u932f\u8aa4\u4e32\u6d41\u4f86\u5256\u6790 Throwable\u3002 +jmx.rest.client.server.throwable.exception.explanation=\u4f3a\u670d\u5668\u5728\u8655\u7406\u7528\u6236\u7aef\u8981\u6c42\u6642\uff0c\u5f15\u767c\u7570\u5e38\u72c0\u6cc1\uff0c\u4f46\u662f\u7528\u6236\u7aef\u7121\u6cd5\u5f9e\u4f3a\u670d\u5668\u932f\u8aa4\u4e32\u6d41\u4f86\u5256\u6790 Throwable \u7269\u4ef6\u3002\u7528\u6236\u7aef\u53ef\u80fd\u7121\u6cd5\u4f7f\u7528 Throwable \u7269\u4ef6\u7684\u985e\u5225\u3002 +jmx.rest.client.server.throwable.exception.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u65e5\u8a8c\uff0c\u4ee5\u53d6\u5f97\u9032\u4e00\u6b65\u8cc7\u8a0a\u3002 + +jmx.rest.client.not.connected=CWWKX0206E: \u7528\u6236\u7aef\u6c92\u6709\u9023\u63a5\u4f3a\u670d\u5668\u3002 +jmx.rest.client.not.connected.explanation=\u4f3a\u670d\u5668\u9023\u7dda\u5df2\u95dc\u9589\u6216\u5931\u6557\u3002 +jmx.rest.client.not.connected.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u4e0a\u662f\u5426\u5df2\u555f\u7528 REST \u9023\u63a5\u5668\u7279\u6027\uff0c\u4e26\u53d6\u5f97\u65b0\u7684\u4f3a\u670d\u5668\u9023\u7dda\u3002 + +jmx.rest.client.url.not.found=CWWKX0207E: \u4f3a\u670d\u5668\u5831\u544a\u627e\u4e0d\u5230\u7528\u6236\u7aef\u6240\u8981\u6c42\u7684 URL\u3002 +jmx.rest.client.url.not.found.explanation=\u7528\u6236\u7aef\u7684\u8cc7\u8a0a\u5df2\u904e\u671f\uff0c\u6216\u8005\u4f3a\u670d\u5668\u4e0a\u7684 REST \u9023\u63a5\u5668\u7279\u6027\u53ef\u80fd\u5df2\u505c\u7528\u3002 +jmx.rest.client.url.not.found.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u4e0a\u662f\u5426\u5df2\u555f\u7528 REST \u9023\u63a5\u5668\u7279\u6027\uff0c\u4e26\u53d6\u5f97\u65b0\u7684\u4f3a\u670d\u5668\u9023\u7dda\u3002 +jmx.rest.client.class.name.null=CWWKX0208E: \u985e\u5225\u540d\u7a31\u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.class.name.null.explanation=\u985e\u5225\u540d\u7a31\u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.class.name.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684\u985e\u5225\u540d\u7a31\u3002 + +jmx.rest.client.attribute.name.null=CWWKX0209E: \u5c6c\u6027\u540d\u7a31\u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.name.null.explanation=\u5c6c\u6027\u540d\u7a31\u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.name.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684\u5c6c\u6027\u540d\u7a31\u3002 + +jmx.rest.client.attribute.names.null=CWWKX0210E: \u5305\u542b\u5c6c\u6027\u540d\u7a31\u9663\u5217\u7684\u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.names.null.explanation=\u5305\u542b\u5c6c\u6027\u540d\u7a31\u9663\u5217\u7684\u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.names.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684\u5c6c\u6027\u540d\u7a31\u9663\u5217\u3002 + +jmx.rest.client.attribute.null=CWWKX0211E: Attribute \u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.null.explanation=Attribute \u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684 Attribute\u3002 + +jmx.rest.client.attribute.list.null=CWWKX0212E: AttributeList \u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.list.null.explanation=AttributeList \u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.attribute.list.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684 AttributeList\u3002 + +jmx.rest.client.object.name.null=CWWKX0213E: ObjectName \u5f15\u6578\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.object.name.null.explanation=ObjectName \u5f15\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.object.name.null.useraction=\u8acb\u5728\u547c\u53eb\u65b9\u6cd5\u6642\uff0c\u63d0\u4f9b\u975e\u7a7a\u503c\u7684 ObjectName\u3002 + +jmx.rest.client.unexpected.server.throwable=CWWKX0214E: \u4f3a\u670d\u5668\u50b3\u56de\u975e\u9810\u671f\u7684 Throwable \u7269\u4ef6\u3002 +jmx.rest.client.unexpected.server.throwable.explanation=\u7570\u5e38\u72c0\u6cc1\u542b\u62ec\u4e00\u500b\u4f3a\u670d\u5668\u6240\u50b3\u56de\u7684 Throwable \u7269\u4ef6\uff0c\u5c0d\u9019\u9805\u4f5c\u696d\u4f86\u8aaa\uff0c\u9019\u901a\u5e38\u4e0d\u662f\u6240\u9810\u671f\u7684\u3002 +jmx.rest.client.unexpected.server.throwable.useraction=\u8acb\u6aa2\u67e5\u4f3a\u670d\u5668\u65e5\u8a8c\uff0c\u4ee5\u53d6\u5f97\u9032\u4e00\u6b65\u8cc7\u8a0a\u3002 + +jmx.rest.client.bad.credentials=CWWKX0215E: \u6240\u63d0\u4f9b\u7684\u4f7f\u7528\u8005\u540d\u7a31\u6216\u5bc6\u78bc\u6709\u554f\u984c\u3002\u4f3a\u670d\u5668\u7684\u56de\u61c9\u78bc\u662f {0}\uff0c\u8a0a\u606f\u662f ''{1}'' +jmx.rest.client.bad.credentials.explanation=\u5728\u53d6\u5f97\u9023\u7dda\u6642\u6240\u63d0\u4f9b\u7684\u8a8d\u8b49\u4e0d\u6b63\u78ba\u3002\u53ef\u80fd\u662f\u4f7f\u7528\u8005\u4e0d\u5b58\u5728\u3001\u4e0d\u5177\u5099\u4f3a\u670d\u5668\u7684\u5b58\u53d6\u6b0a\uff0c\u6216\u8005\u5bc6\u78bc\u4e0d\u6b63\u78ba\u3002 +jmx.rest.client.bad.credentials.useraction=\u8acb\u66f4\u6b63\u4f7f\u7528\u8005\u540d\u7a31\u6216\u5bc6\u78bc\uff0c\u7136\u5f8c\u53d6\u5f97\u65b0\u9023\u7dda\u3002 + +jmx.rest.client.object.name.pattern=CWWKX0216E: ObjectName \u5f15\u6578 ''{0}'' \u662f\u4e00\u500b\u578b\u6a23\u3002 +jmx.rest.client.object.name.pattern.explanation=ObjectName \u5f15\u6578\u662f\u578b\u6a23\uff0c\u4f46\u662f\u65b9\u6cd5\u6240\u9700\u8981\u7684 ObjectName \u5fc5\u9808\u53ea\u7b26\u5408\u4e00\u500b MBean\u3002 +jmx.rest.client.object.name.pattern.useraction=\u8acb\u63d0\u4f9b\u6c92\u6709\u842c\u7528\u5b57\u5143\u4e14\u53ea\u7b26\u5408\u4e00\u500b MBean \u7684 ObjectName \u5f15\u6578\u3002 + +jmx.rest.client.instance.not.found=CWWKX0217E: \u76ee\u524d\u672a\u767b\u9304\u4efb\u4f55\u4e00\u500b\u4f7f\u7528\u7d66\u5b9a ObjectName ''{0}'' \u7684 MBean +jmx.rest.client.instance.not.found.explanation=\u4f5c\u696d\u9700\u8981\u5df2\u767b\u9304\u7684 MBean\uff0c\u4f46\u537b\u672a\u767b\u9304\u4efb\u4f55\u4f7f\u7528\u7d66\u5b9a ObjectName \u7684 MBean\u3002 +jmx.rest.client.instance.not.found.useraction=\u8acb\u5148\u78ba\u5b9a\u5df2\u767b\u9304 MBean\uff0c\u518d\u5617\u8a66\u5c0d\u5b83\u57f7\u884c\u7ba1\u7406\u4f5c\u696d\u3002 + +jmx.rest.client.attribute.not.found=CWWKX0218E: MBean ''{0}'' \u6c92\u6709\u4e00\u500b\u540d\u7a31\u70ba ''{1}'' \u7684\u5c6c\u6027 +jmx.rest.client.attribute.not.found.explanation=MBean \u6c92\u6709\u63d0\u4f9b\u7d66\u5b9a\u540d\u7a31\u7684\u5c6c\u6027\u3002 +jmx.rest.client.attribute.not.found.useraction=\u8acb\u53d6\u5f97 MBean \u8cc7\u8a0a\uff0c\u4ee5\u78ba\u8a8d MBean \u6240\u63d0\u4f9b\u7684\u5c6c\u6027\u3002 + +jmx.rest.client.operation.not.found=CWWKX0219E: MBean ''{0}'' \u6c92\u6709\u4e00\u500b\u540d\u7a31\u70ba ''{1}'' \u7684\u4f5c\u696d +jmx.rest.client.operation.not.found.explanation=MBean \u6c92\u6709\u63d0\u4f9b\u7d66\u5b9a\u540d\u7a31\u7684\u4f5c\u696d\u3002 +jmx.rest.client.operation.not.found.useraction=\u8acb\u53d6\u5f97 MBean \u8cc7\u8a0a\uff0c\u4ee5\u78ba\u8a8d MBean \u6240\u63d0\u4f9b\u7684\u4f5c\u696d\u3002 + +jmx.rest.client.listener.not.found=CWWKX0220E: \u76ee\u524d\u672a\u767b\u9304\u7d66\u5b9a NotificationListener\uff0c\u4ee5\u4fbf\u63a5\u6536\u4f86\u81ea MBean ''{0}'' \u7684\u901a\u77e5 +jmx.rest.client.listener.not.found.explanation=NotificationListener \u672a\u65b0\u589e\u6216\u8005\u5df2\u79fb\u9664\uff0c\u4e14\u76ee\u524d\u672a\u767b\u9304\u4f86\u63a5\u53d7\u4f86\u81ea\u7d66\u5b9a MBean \u7684\u901a\u77e5\u3002 +jmx.rest.client.listener.not.found.useraction=\u8acb\u78ba\u5b9a\u547c\u53eb\u7a0b\u5f0f\u78bc\u6703\u8ffd\u8e64\u5df2\u65b0\u589e\u8207\u79fb\u9664\u4e86\u54ea\u4e9b NotificationListener\uff0c\u6216\u662f\u6355\u6349\u6216\u8655\u7406\u7570\u5e38\u72c0\u6cc1\u3002 + +jmx.rest.client.notification.lost=CWWKX0221I: \u7121\u6cd5\u905e\u9001\u901a\u77e5\u3002 +jmx.rest.client.notification.lost.explanation=\u7121\u6cd5\u5c07\u901a\u77e5\u905e\u9001\u7d66\u4e00\u6216\u591a\u500b NotificationListener\uff0c\u56e0\u70ba\u627e\u4e0d\u5230\u5df2\u767b\u9304\u7684 NotificationListener\uff0c\u6216\u8005\u5728\u905e\u9001\u901a\u77e5\u671f\u9593\uff0c\u767c\u751f\u7570\u5e38\u72c0\u6cc1\u3002 +jmx.rest.client.notification.lost.useraction=\u5982\u679c\u901a\u77e5\u61c9\u5df2\u905e\u9001\u7d66\u5df2\u767b\u9304\u7684 NotificationListener\uff0c\u8acb\u6aa2\u67e5\u65e5\u8a8c\u4e2d\u662f\u5426\u6709\u7570\u5e38\u72c0\u6cc1\u3002 + +jmx.rest.client.connection.failed=CWWKX0222I: \u9023\u63a5\u4f3a\u670d\u5668\u5931\u6557\u3002 +jmx.rest.client.connection.failed.explanation=\u4f3a\u670d\u5668\u8b8a\u6210\u7121\u6cd5\u4f7f\u7528\uff0c\u4e14\u5728\u6240\u914d\u7f6e\u7684\u5bb9\u8a31\u6642\u9593\u4e0a\u9650\u4e4b\u5167\uff0c\u7121\u6cd5\u91cd\u65b0\u8b8a\u6210\u53ef\u7528\u7684\u3002 +jmx.rest.client.connection.failed.useraction=\u8acb\u6aa2\u67e5\u7db2\u8def\u9023\u7dda\uff0c\u4e26\u78ba\u5b9a\u4f3a\u670d\u5668\u6b63\u5728\u57f7\u884c\uff0c\u4e14\u5df2\u555f\u7528\u4e86 REST \u9023\u63a5\u5668\u7279\u6027\u3002 + +jmx.rest.client.connection.temporarily.lost=CWWKX0223I: \u4f3a\u670d\u5668\u9023\u7dda\u66ab\u6642\u907a\u5931\u3002 +jmx.rest.client.connection.temporarily.lost.explanation=\u4f3a\u670d\u5668\u8b8a\u6210\u7121\u6cd5\u4f7f\u7528\uff0c\u4f46\u662f\u7528\u6236\u7aef\u5617\u8a66\u5728\u6240\u914d\u7f6e\u7684\u5bb9\u8a31\u6642\u9593\u4e0a\u9650\u671f\u9593\u9084\u539f\u9023\u7dda\u3002 +jmx.rest.client.connection.temporarily.lost.useraction=\u5982\u679c\u4f3a\u670d\u5668\u6b63\u5728\u81ea\u767c\u5730\u91cd\u65b0\u555f\u52d5\uff0c\u5247\u4e0d\u9700\u57f7\u884c\u4efb\u4f55\u52d5\u4f5c\u3002\u5426\u5247\uff0c\u8acb\u6aa2\u67e5\u7db2\u8def\u9023\u7dda\uff0c\u4e26\u78ba\u5b9a\u4f3a\u670d\u5668\u6b63\u5728\u57f7\u884c\uff0c\u4e14\u5df2\u555f\u7528\u4e86 REST \u9023\u63a5\u5668\u7279\u6027\u3002 +jmx.rest.client.connection.restored.with.exceptions=CWWKX0224I: \u9023\u7dda\u5df2\u9084\u539f\uff0c\u4f46\u662f\u5728\u65b0\u589e NotificationListener \u6642\uff0c\u767c\u73fe\u7570\u5e38\u72c0\u6cc1\u3002 +jmx.rest.client.connection.restored.with.exceptions.explanation=\u4f3a\u670d\u5668\u9023\u7dda\u66ab\u6642\u907a\u5931\uff0c\u4f46\u662f\u5df2\u9806\u5229\u9084\u539f\u3002\u5728\u65b0\u589e NotificationListener \u671f\u9593\uff0c\u767c\u73fe\u7570\u5e38\u72c0\u6cc1\uff0c\u56e0\u6b64\u53ef\u80fd\u6c92\u6709\u6536\u5230\u67d0\u4e9b\u901a\u77e5\u3002 +jmx.rest.client.connection.restored.with.exceptions.useraction=\u8acb\u6aa2\u67e5\u901a\u77e5\u96a8\u9644\u7684\u7570\u5e38\u72c0\u6cc1\uff0c\u4e26\u5728\u66f4\u6b63\u554f\u984c\u4e4b\u5f8c\uff0c\u91cd\u65b0\u767b\u9304 NotificationListener\u3002 + +jmx.rest.client.connection.restored=CWWKX0225I: \u5df2\u9806\u5229\u9084\u539f\u9023\u7dda\u3002 +jmx.rest.client.connection.restored.explanation=\u4f3a\u670d\u5668\u9023\u7dda\u66ab\u6642\u907a\u5931\uff0c\u4f46\u662f\u5df2\u9806\u5229\u9084\u539f\u3002\u4efb\u4f55\u5df2\u767b\u9304\u7684 NotificationListener \u90fd\u5c07\u7e7c\u7e8c\u63a5\u6536\u901a\u77e5\u3002 +jmx.rest.client.connection.restored.useraction=\u7121 + +jmx.rest.client.connection.illegal.argument=CWWKX0226E: \u985e\u578b JMXServiceURL \u7684\u53c3\u6578\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.connection.illegal.argument.explanation=\u53c3\u6578 'serviceURL' \u7684\u503c\u4e0d\u5f97\u70ba\u7a7a\u503c\u3002 +jmx.rest.client.connection.illegal.argument.useraction=\u4f7f\u7528\u975e\u7a7a\u503c\u7684 JMXServiceURL \u503c\u4f86\u91cd\u65b0\u9023\u63a5\u5230\u300cJMX REST \u9023\u63a5\u5668\u300d\u3002 + +jmx.rest.client.connection.invalid.endpoint=CWWKX0227E: \u4ee5\u4e0b\u4e0d\u662f\u6709\u6548\u7684\u7aef\u9ede\u503c\uff1a{0} +jmx.rest.client.connection.invalid.endpoint.explanation=\u6307\u5b9a\u7684\u7aef\u9ede\u503c\u7121\u6548\u3002 +jmx.rest.client.connection.invalid.endpoint.useraction=\u4f7f\u7528\u5c6c\u65bc\u985e\u578b\u300c\u5b57\u4e32\u300d\u4e14\u683c\u5f0f\u70ba "host:port" \u7684\u6709\u6548\u7aef\u9ede\u503c\u4f86\u91cd\u65b0\u9023\u63a5\u5230\u300cJMX REST \u9023\u63a5\u5668\u300d\u3002 + +jmx.rest.client.connection.no.endpoints=CWWKX0228E: \u627e\u4e0d\u5230\u4efb\u4f55\u53ef\u7528\u7684\u7aef\u9ede\u4f86\u8d77\u59cb\u8a2d\u5b9a\u9023\u63a5\u5668\u3002 +jmx.rest.client.connection.no.endpoints.explanation=\u5728\u8d77\u59cb\u8a2d\u5b9a\u300cJMX REST \u9023\u63a5\u5668\u300d\u671f\u9593\uff0c\u6c92\u6709\u4efb\u4f55\u6307\u5b9a\u7684\u7aef\u9ede\u53ef\u7528\u3002 +jmx.rest.client.connection.no.endpoints.useraction=\u4f7f\u7528\u81f3\u5c11\u4e00\u500b\u53ef\u7528\u7684\u7aef\u9ede\u4f86\u91cd\u65b0\u9023\u63a5\u5230\u300cJMX REST \u9023\u63a5\u5668\u300d\u3002 + +jmx.rest.client.bad.user.credentials=CWWKX0229E: \u6240\u63d0\u4f9b\u7684\u4f7f\u7528\u8005\u8a8d\u8b49\u6709\u554f\u984c\u3002\u4f3a\u670d\u5668\u7684\u56de\u61c9\u78bc\u662f {0}\uff0c\u8a0a\u606f\u662f ''{1}'' +jmx.rest.client.bad.user.credentials.explanation=\u63d0\u4f9b\u7684\u8a8d\u8b49\u4e0d\u6b63\u78ba\u3001\u5df2\u904e\u671f\u3001\u4e0d\u5b8c\u6574\u6216\u6388\u6b0a\u88ab\u62d2\u3002 +jmx.rest.client.bad.user.credentials.useraction=\u8acb\u78ba\u8a8d\u4f7f\u7528\u8005\u8a8d\u8b49\u6709\u6b63\u78ba\u7684\u9451\u5225\u8207\u6388\u6b0a\uff0c\u7136\u5f8c\u53d6\u5f97\u65b0\u9023\u7dda\u3002 + +jmx.rest.client.connection.connect=CWWKX0230I: \u7fa4\u9ad4\u6210\u54e1\u5df2\u958b\u555f JMX \u7528\u6236\u7aef\uff0c\u4e26\u6307\u5411\u7fa4\u9ad4\u63a7\u5236\u5668\uff1a{0} +jmx.rest.client.connection.connect.explanation=\u6210\u54e1\u5df2\u9023\u63a5\u81f3\u63a7\u5236\u5668\u3002 +jmx.rest.client.connection.connect.useraction=\u4e0d\u9700\u63a1\u53d6\u4efb\u4f55\u52d5\u4f5c\u3002 +jmx.rest.client.connection.disconnect=CWWKX0231I: \u7fa4\u9ad4\u6210\u54e1\u5df2\u5f9e\u7fa4\u9ad4\u63a7\u5236\u5668 {0} \u95dc\u9589 JMX \u7528\u6236\u7aef +jmx.rest.client.connection.disconnect.explanation=\u6210\u54e1\u5df2\u5207\u65b7\u63a7\u5236\u5668\u9023\u7dda\u3002 +jmx.rest.client.connection.disconnect.useraction=\u4e0d\u9700\u63a1\u53d6\u4efb\u4f55\u52d5\u4f5c\u3002 + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/restConnector-headers.bnd b/dev/com.ibm.ws.jmx.connector.client.rest/restConnector-headers.bnd new file mode 100755 index 00000000000..e5f924c8d01 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/restConnector-headers.bnd @@ -0,0 +1,9 @@ +Private-Package: \ + com.ibm.json.*, \ + com.ibm.websphere.jmx.connector.rest, \ + com.ibm.ws.jmx.connector.client.rest.*, \ + com.ibm.ws.jmx.connector.converter, \ + com.ibm.ws.jmx.connector.datatypes + +Include-Resource: \ + META-INF=resources/META-INF diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/restConnector.bnd b/dev/com.ibm.ws.jmx.connector.client.rest/restConnector.bnd new file mode 100755 index 00000000000..fc4f5c2087c --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/restConnector.bnd @@ -0,0 +1,8 @@ +-include = \ + ~../cnf/resources/bnd/jar.props, \ + restConnector-headers.bnd + +bVersion=1.0 + +Client-Name: REST Connector Client JAR +Client-Description: REST Connector Client JAR; version=${bVersion} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/ConnectorSettings.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/ConnectorSettings.java new file mode 100755 index 00000000000..ffd1f24d293 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/ConnectorSettings.java @@ -0,0 +1,283 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012,2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.websphere.jmx.connector.rest; + +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; + +/** + * Provides constants for connection settings of the Liberty profile JMX REST connector client. + * The settings can be adjusted in 2 ways: + *

+ *

    + *
  1. Globally, by setting a system property with the desired value. For example, to set READ_TIMEOUT to 2 minutes (120000 milliseconds), use the Java option: + *

    + * + *

    + * -Dcom.ibm.ws.jmx.connector.client.rest.readTimeout=120000
    + * 
    + * + *
  2. + *
  3. On a per connection basis, by adding an entry to the environment Map parameter of the + * {@link JMXConnectorFactory#newJMXConnector(javax.management.remote.JMXServiceURL, java.util.Map)} or {@link JMXConnector#connect(java.util.Map)} method. + *

    + * + *

    + * 
    + * HashMap environment = new HashMap();
    + * environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client");
    + * environment.put(JMXConnector.CREDENTIALS, new String[] { "bob", "bobpassword" });
    + * environment.put(ConnectorSettings.MAX_SERVER_WAIT_TIME, 120000);
    + *
    + * JMXServiceURL url = new JMXServiceURL("service:jmx:rest://<host>:<port>/IBMJMXConnectorREST");
    + * JMXConnector connector = JMXConnectorFactory.newJMXConnector(url, environment);
    + * connector.connect(environment);
    + * 
    + * 
    + * + *
  4. + *
+ * + * @ibm-api + */ +public interface ConnectorSettings { + + /** + * Boolean setting that when enabled disables hostname verification on the client connections. This can be useful for environments where the hostname used does not match the + * one specified in the server certificate. + */ + public static final String DISABLE_HOSTNAME_VERIFICATION = ClientProvider.CLIENT_DOMAIN + ".disableURLHostnameVerification"; + + /** + * Integer setting for the maximum amount of time in milliseconds that the server waits for new notifications before responding to a request for notifications from the client. + * A larger value results in better notification delivery times because less time is spent establishing new connections. Normally it is not necessary to adjust this value. + */ + public static final String NOTIFICATION_DELIVERY_INTERVAL = ClientProvider.REST_CLIENT_DOMAIN + ".notificationDeliveryInterval"; + + /** + * Integer setting for the amount of time in milliseconds that the server waits before discarding notification registrations if the client has not checked for new + * notifications. Normally it is not necessary to adjust this value. + */ + public static final String NOTIFICATION_INBOX_EXPIRY = ClientProvider.REST_CLIENT_DOMAIN + ".notificationInboxExpiry"; + + /** + * Integer setting for the amount of time in milliseconds that the client waits before making a new request to fetch notifications. + */ + public static final String NOTIFICATION_FETCH_INTERVAL = ClientProvider.REST_CLIENT_DOMAIN + ".notificationFetchInterval"; + + /** + * Integer setting for the read timeout in milliseconds for all client communications with the server, except notification fetching. Adjust this value if the client throws read + * timeout exceptions because of a slow connection or client or server process. + */ + public static final String READ_TIMEOUT = ClientProvider.REST_CLIENT_DOMAIN + ".readTimeout"; + + /** + * Integer setting for the read timeout in milliseconds for notification fetching. Because the server might wait up to NOTIFICATION_DELIVERY_INTERVAL before responding, this + * value must be somewhat larger, though normally it is not necessary to adjust this value. + */ + public static final String NOTIFICATION_READ_TIMEOUT = ClientProvider.REST_CLIENT_DOMAIN + ".notificationReadTimeout"; + + /** + * Integer setting for the amount of time in milliseconds that the client waits between checks that the server is still available. To disable this behaviour, set the value to + * a negative integer. + * + * This value is overridden by {@link ConnectorSettings.NOTIFICATION_FETCH_INTERVAL} whenever there are notification listeners registered with this client. + */ + public static final String SERVER_FAILOVER_INTERVAL = ClientProvider.REST_CLIENT_DOMAIN + ".failoverInterval"; + + /** + * Integer setting for the amount of time in milliseconds that the client waits for the server to become available before the JMX connection fails and a new connection must be + * created. If the connection is restored, any previous notification listeners are registered again. To disable this behavior, set the value to zero. + */ + public static final String MAX_SERVER_WAIT_TIME = ClientProvider.REST_CLIENT_DOMAIN + ".maxServerWaitTime"; + + /** + * Integer setting for the amount of time in milliseconds that the client waits between checks that the server is available again when MAX_SERVER_WAIT_TIME is non-zero. + * Normally it is not necessary to adjust this value. + */ + public static final String SERVER_STATUS_POLLING_INTERVAL = ClientProvider.REST_CLIENT_DOMAIN + ".serverStatusPollingInterval"; + + /** + * Indicates that the {@link JMXConnector.CREDENTIALS} will be handled by SSL certificate based authentication. + */ + public static final String CERTIFICATE_AUTHENTICATION = ClientProvider.CLIENT_DOMAIN + ".CLIENT_CERT_AUTH"; + + /** + * Indicates that all JMX connections will use the specified SSLSocketFactory + */ + public static final String CUSTOM_SSLSOCKETFACTORY = ClientProvider.CLIENT_DOMAIN + ".CUSTOM_SSLSOCKETFACTORY"; + + /** + *

Work Load Management Endpoints

+ * List of Strings setting to indicate which endpoints, in addition + * to the host and port in the {@link JMXServiceURL}, are valid for + * establishing a connection. An endpoint is defined as "host:port". + *

+ * When the work load management endpoint list is set, the initial + * connection is made using one of the endpoints in the complete set of + * available endpoints. The complete set of endpoints is the host and port + * specified to the {@link JMXServiceURL} as well as the contents of the + * work load management endpoint list. + *

+ * This property is only supported in the programmatic JMX environment. + * + *

+     * 
+     * List<String> endpoints = new ArrayList<String>
+     * endpoints.add("<host2>:<port>");
+     *
+     * HashMap environment = new HashMap();
+     * environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client");
+     * environment.put(JMXConnector.CREDENTIALS, new String[] { "bob", "bobpassword" });
+     * environment.put(ConnectorSettings.WLM_ENDPOINTS, endpoints);
+     *
+     * JMXServiceURL url = new JMXServiceURL("service:jmx:rest://<host>:<port>/IBMJMXConnectorREST");
+     * JMXConnector connector = JMXConnectorFactory.newJMXConnector(url, environment);
+     * connector.connect(environment);
+     * 
+     * 
+ * + * The preceding code would establish the available endpoint set as host:port + * and host2:port. + *

+ * No ordering guarantees are made regarding which endpoint is ultimately + * used for the connection, but all endpoints will be tried in order to + * establish a connection. Only when all endpoints in the complete set are + * inaccessible is a connection considered to be unobtainable. + *

+ * Fail-over retry will occur if the invoked operation could not be + * started. If the connection is lost during an operation, no retry will + * be done so as to not issue the same command twice. In other words, if + * we loose the connection before the operation can report success, an + * IOException will be thrown and the operation will not be re-tried. + */ + public static final String WLM_ENDPOINTS = ClientProvider.CLIENT_DOMAIN + ".wlm.endpoints"; + + /** + * This parameter represents the host name to be used in a routing context. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint and the Routing MBean, exposed by the server-side of the JMX REST connector. + */ + public static final String ROUTING_KEY_HOST_NAME = "com.ibm.websphere.jmx.connector.rest.routing.hostName"; + + /** + * This parameter represents the server name to be used in a routing context. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint and the Routing MBean, exposed by the server-side of the JMX REST connector. + */ + public static final String ROUTING_KEY_SERVER_NAME = "com.ibm.websphere.jmx.connector.rest.routing.serverName"; + + /** + * This parameter represents the server user directory to be used in a routing context. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint and the Routing MBean, exposed by the server-side of the JMX REST connector. + */ + public static final String ROUTING_KEY_SERVER_USER_DIR = "com.ibm.websphere.jmx.connector.rest.routing.serverUserDir"; + + /** + * This parameter represents a comma-separated list of host names within the collective. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String COLLECTIVE_HOST_NAMES = "com.ibm.websphere.collective.hostNames"; + + /** + * This parameter represents a request for an asynchronous execution within the collective. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String ASYNC_EXECUTION = "com.ibm.websphere.jmx.connector.rest.asyncExecution"; + + /** + * This parameter represents the set of credentials to be used for the transfer action. + * The payload of the header is a JSON object with attributes from the CollectiveRegistrationMBean. + * Only credentials (user name, password, keys) are defined. The host and port attributes are not supported. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String TRANSFER_CREDENTIALS = "com.ibm.websphere.jmx.connector.rest.transferCredentials"; + + /** + * This parameter represents the request for a pre transfer action within the collective. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String PRE_TRANSFER_ACTION = "com.ibm.websphere.jmx.connector.rest.preTransferAction"; + + /** + * This parameter represents the request for a post transfer action within the collective. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String POST_TRANSFER_ACTION = "com.ibm.websphere.jmx.connector.rest.postTransferAction"; + + /** + * This parameter represents the default value for the collective pre-transfer-action. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String PRE_TRANSFER_ACTION_DEFAULT = "com.ibm.websphere.jmx.connector.rest.preTransferAction.remove"; + + /** + * This parameter represents the default value for the collective post-transfer-action. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String POST_TRANSFER_ACTION_DEFAULT = "com.ibm.websphere.jmx.connector.rest.postTransferAction.join"; + + /** + * This parameter represents the action of extarcting a severName from a Liberty zip package for the collective post-transfer-action. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String POST_TRANSFER_ACTION_FIND_SERVER_NAME = "com.ibm.websphere.jmx.connector.rest.postTransferAction.findServerName"; + + /** + * This parameter represents the options pertaining to the collective pre-transfer-action. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String PRE_TRANSFER_ACTION_OPTIONS = "com.ibm.websphere.jmx.connector.rest.preTransferAction.options"; + + /** + * This parameter represents the options pertaining to the collective post-transfer-action. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String POST_TRANSFER_ACTION_OPTIONS = "com.ibm.websphere.jmx.connector.rest.postTransferAction.options"; + + /** + * This parameter represents a set of environment variables and their corresponding values. + * The payload of the header is a JSON object that has envKey : envValue pairs. + * + * This parameter is not applicable to the settings passed into the client-side of the JMX REST connector. + * It is used only by the file transfer RESTful endpoint, exposed by the server-side of the JMX REST connector. + */ + public static final String TRANSFER_ENV_VARS = "com.ibm.websphere.jmx.connector.rest.transferEnvVars"; + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/package-info.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/package-info.java new file mode 100755 index 00000000000..8f227398e47 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/websphere/jmx/connector/rest/package-info.java @@ -0,0 +1,16 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +/** + * @version 1.4 + */ +@org.osgi.annotation.versioning.Version("1.4") +package com.ibm.websphere.jmx.connector.rest; diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/ClientProvider.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/ClientProvider.java new file mode 100755 index 00000000000..b2eec76c36e --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/ClientProvider.java @@ -0,0 +1,58 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.Map; + +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorProvider; +import javax.management.remote.JMXServiceURL; + +import com.ibm.websphere.jmx.connector.rest.ConnectorSettings; +import com.ibm.ws.jmx.connector.client.rest.internal.Connector; + +public class ClientProvider implements JMXConnectorProvider, ConnectorSettings { + + public static final String REST_PROTOCOL = "rest"; + + public static final String CLIENT_DOMAIN = "com.ibm.ws.jmx.connector.client"; + public static final String REST_CLIENT_DOMAIN = "com.ibm.ws.jmx.connector.client.rest"; + + public static final String CONNECTION_TEMPORARILY_LOST = REST_CLIENT_DOMAIN + ".connectionTemporarilyLost"; + public static final String CONNECTION_RESTORED = REST_CLIENT_DOMAIN + ".connectionRestored"; + public static final String CONNECTION_RESTORED_WITH_EXCEPTIONS = REST_CLIENT_DOMAIN + ".connectionRestoredWithExceptions"; + + public static final String CONNECTION_ROUTING_DOMAIN = "WebSphere"; + public static final String CONNECTION_ROUTING_NAME = "RoutingContext"; + public static final String CONNECTION_ROUTING_OPERATION_ASSIGN_SERVER = "assignServerContext"; + public static final String CONNECTION_ROUTING_OPERATION_ASSIGN_HOST = "assignHostContext"; + + public static final String FILE_TRANSFER_DOMAIN = "WebSphere"; + public static final String FILE_TRANSFER_NAME = "FileTransfer"; + + /* + * (non-Javadoc) + * + * @see javax.management.remote.JMXConnectorProvider#newJMXConnector(javax.management.remote.JMXServiceURL, java.util.Map) + */ + @Override + public JMXConnector newJMXConnector(JMXServiceURL serviceURL, Map environment) throws IOException { + if (serviceURL == null || environment == null) + throw new NullPointerException(); + if (!ClientProvider.REST_PROTOCOL.equals(serviceURL.getProtocol())) + throw new MalformedURLException(); + return new Connector(serviceURL, environment); + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Activator.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Activator.java new file mode 100755 index 00000000000..06fab68c4d9 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Activator.java @@ -0,0 +1,59 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* WLP Copyright IBM Corp. 2016 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ConfigurationPolicy; +import org.osgi.service.component.annotations.Deactivate; + +@Component(configurationPolicy = ConfigurationPolicy.IGNORE) +public class Activator { + + private final static String PKGS_KEY = "jmx.remote.protocol.provider.pkgs"; + private final static String PKGS = "com.ibm.ws.jmx.connector.client"; + private final static Pattern P = Pattern.compile("(?:\\A|,)" + PKGS + "(?:\\z|,)"); + + @Activate + protected void activate() { + + String jmx = System.getProperty(PKGS_KEY); + System.setProperty(PKGS_KEY, add(jmx)); + } + + @Deactivate + protected void deactivate() { + String jmx = System.getProperty(PKGS_KEY); + if (PKGS.equals(jmx)) { + System.clearProperty(PKGS_KEY); + } else { + System.setProperty(PKGS_KEY, remove(jmx)); + } + } + + static String add(String jmx) { + if (jmx == null) { + return PKGS; + } else { + return jmx + "," + PKGS; + } + } + + static String remove(String jmx) { + Matcher m = P.matcher(jmx); + return m.replaceAll(""); + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ClientConstants.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ClientConstants.java new file mode 100755 index 00000000000..b3c038bc61e --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ClientConstants.java @@ -0,0 +1,43 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package com.ibm.ws.jmx.connector.client.rest.internal; + +class ClientConstants { + + enum HttpMethod { + GET, POST, PUT, DELETE, + HEAD, OPTIONS, TRACE + }; + + static final String JSON_MIME_TYPE = "application/json"; + + static final boolean DISABLE_HOSTNAME_VERIFICATION_DEFAULT = false; + + static final int NOTIFICATION_DELIVERY_INTERVAL_DEFAULT = 0; + + static final int NOTIFICATION_FETCH_INTERVAL_DEFAULT = 1000; + + static final int NOTIFICATION_INBOX_EXPIRY_DEFAULT = 5 * 60 * 1000; + + static final int SERVER_FAILOVER_INTERVAL_DEFAULT = 30 * 1000; + + static final int READ_TIMEOUT_DEFAULT = 60 * 1000; + + static final int MAX_SERVER_WAIT_TIME_DEFAULT = 120 * 1000; + + static final int SERVER_STATUS_POLLING_INTERVAL_DEFAULT = 4 * 1000; + + static final String CONNECTOR_URI = "IBMJMXConnectorREST"; + + static final String ROUTER_URI = CONNECTOR_URI + "/router"; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Connector.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Connector.java new file mode 100755 index 00000000000..ef422240d5d --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/Connector.java @@ -0,0 +1,619 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.io.IOException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.ListenerNotFoundException; +import javax.management.MBeanServerConnection; +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; +import javax.management.remote.JMXConnectionNotification; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.SSLSocketFactory; +import javax.security.auth.Subject; + +import com.ibm.websphere.jmx.connector.rest.ConnectorSettings; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.ws.jmx.connector.client.rest.internal.resources.RESTClientMessagesUtil; +import com.ibm.ws.jmx.connector.converter.JSONConverter; +import com.ibm.ws.jmx.connector.datatypes.ConversionException; + +public class Connector implements JMXConnector { + + private static final Logger logger = Logger.getLogger(Connector.class.getName()); + + private final JMXServiceURL serviceURL; + private Map environment; + private long connectionId; + + private List wlmList; + + private String currentEndpoint; + + private boolean hostnameVerificationDisabled; + private int notificationDeliveryInterval, notificationFetchInterval, notificationInboxExpiry, readTimeout, notificationReadTimeout, serverFailoverInterval, maxServerWaitTime, + serverStatusPollingInterval; + private String user; + private String basicAuthHeader = null; + + private RESTMBeanServerConnection connection = null; + private boolean closed = false; + + private List connectionListeners = null; + + private static long nextConnectionNumber = 1; + + private SSLSocketFactory customSSLSocketFactory = null; + + private boolean isCollectiveUtilConnection = false; + private boolean logFailovers = false; + + /** + * @return the customSSLSocketFactory + */ + public SSLSocketFactory getCustomSSLSocketFactory() { + return customSSLSocketFactory; + } + + /** + * @param customSSLSocketFactory the customSSLSocketFactory to set + */ + public void setCustomSSLSocketFactory(SSLSocketFactory customSSLSocketFactory) { + this.customSSLSocketFactory = customSSLSocketFactory; + } + + private synchronized static long getConnectionNumber() { + return nextConnectionNumber++; + } + + private static long nextNotificationNumber = 1; + + private static long getNotificationNumber() { + synchronized (Connector.class) { + return nextNotificationNumber++; + } + } + + public Connector(JMXServiceURL serviceURL, Map environment) { + this.serviceURL = serviceURL; + this.environment = environment; + this.isCollectiveUtilConnection = getBooleanSetting("isCollectiveUtil", false); + this.logFailovers = getBooleanSetting("logFailovers", false); + + if (serviceURL == null) { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.NULL_SERVICE_URL)); + } + + //We initialize our WLM list to have the connecting URL. In non-WLM cases, this is our only URL. + this.wlmList = new ArrayList(); + this.wlmList.add(serviceURL.getHost() + ":" + serviceURL.getPort()); + } + + /** {@inheritDoc} */ + @Override + public void connect() throws IOException { + connect(null); + } + + private Object getCredentials() { + Object credentials = environment.get(JMXConnector.CREDENTIALS); + if (credentials != null) { + //We found a non-null key in our map, so that's the credentials we'll use + return credentials; + } + + //Our map was empty, but before we fail, check if we can fetch a String from the system properties + credentials = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty(JMXConnector.CREDENTIALS); + } + }); + + return credentials; + } + + private boolean getBooleanSetting(final String key, boolean defaultValue) { + // Check environment first for per-connection setting + if (environment != null) { + Object setting = environment.get(key); + if (setting != null && setting instanceof Boolean) + return (Boolean) setting; + } + + // Next, check system property for global setting + String setting = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty(key); + } + }); + if (setting != null) { + return Boolean.parseBoolean(setting); + } + + // Otherwise, return default value + return defaultValue; + } + + private int getIntegerSetting(final String key, int defaultValue) { + // Check environment first for per-connection setting + if (environment != null) { + Object setting = environment.get(key); + if (setting != null && setting instanceof Integer) + return (Integer) setting; + } + + // Next, check system property for global setting + String setting = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public String run() { + return System.getProperty(key); + } + }); + if (setting != null) { + try { + return Integer.parseInt(setting); + } catch (NumberFormatException nfe) { + // ignore value + } + } + + // Otherwise, return default value + return defaultValue; + } + + /** + * Validate the possible endpoint String. + * + * @param possibleEndpoint + * @throws IllegalArgumentException if the String is not a valid endpoint + */ + private void validatePossibleEndpoint(String possibleEndpoint) throws IllegalArgumentException { + if (!possibleEndpoint.contains(":")) { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint)); + } + String[] components = possibleEndpoint.split(":"); + if (components.length != 2) { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint)); + } + try { + Integer.valueOf(components[1]); + } catch (NumberFormatException e) { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, possibleEndpoint)); + } + } + + /** + * Validates the list contains nothing but Strings, and that those Strings + * are in the endpoint format. If the List contains non-String elements, + * or a String that does not follow the endpoint host:port format, + * an IllegalArgumentException will be thrown. + * + * @param list A generic List of Objects to be validated + * @throws IllegalArgumentException if the List contains a non-String + * element or if the String is not in endpoint format + */ + private void validateEndpointList(List list) throws IllegalArgumentException { + if (list.isEmpty()) { + return; + } + + for (Object element : list) { + if (element == null) { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, "null")); + } else if (element instanceof String) { + String elemStr = (String) element; + validatePossibleEndpoint((String) element); + //Add endpoint to our list. Filter duplicates. + if (!wlmList.contains(elemStr)) { + wlmList.add(elemStr); + } + } else { + throw new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INVALID_ENDPOINT, element.toString())); + } + } + + //Randomize the list if we have more than 1 element. This is our basic load balancer. + if (wlmList.size() > 1) { + Collections.shuffle(wlmList, new Random(System.currentTimeMillis())); + } + + //We don't want anybody changing our list of endpoints from this point forward + this.wlmList = Collections.unmodifiableList(this.wlmList); + + } + + /** + * Return the configured List of endpoints + */ + List getEndpointList() { + return this.wlmList; + } + + /** {@inheritDoc} */ + @Override + public synchronized void connect(Map env) throws IOException { + // Connector can only be used once + if (closed) + throw new IOException(); + + // connect has no effect if already connected + if (connection != null) + return; + + if (env != null) + environment = env; + + // User credentials will either be available as a String[] for basic auth, OR + //as a String (equals to ConnectorSettings.CERTIFICATE_AUTHENTICATION), which could also come from a system property + Object credentials = getCredentials(); + if (!areRequiedCredentialsSet(credentials)) { + throw new IOException(JMXConnector.CREDENTIALS + " not provided. Set to a String[2] {user,password}."); + } + // If the credentials are not certificate, extract and set the basicAuthHeader + if (!ConnectorSettings.CERTIFICATE_AUTHENTICATION.equals(credentials)) { + String[] userPass = (String[]) credentials; + user = userPass[0]; + JSONConverter converter = JSONConverter.getConverter(); + try { + basicAuthHeader = "Basic " + converter.encodeStringAsBase64(user + ":" + userPass[1]); + } catch (ConversionException ce) { + throw new IOException("Failure encoding credentials", ce); + } finally { + JSONConverter.returnConverter(converter); + } + } + + hostnameVerificationDisabled = getBooleanSetting(ConnectorSettings.DISABLE_HOSTNAME_VERIFICATION, ClientConstants.DISABLE_HOSTNAME_VERIFICATION_DEFAULT); + notificationDeliveryInterval = getIntegerSetting(ConnectorSettings.NOTIFICATION_DELIVERY_INTERVAL, ClientConstants.NOTIFICATION_DELIVERY_INTERVAL_DEFAULT); + notificationFetchInterval = getIntegerSetting(ConnectorSettings.NOTIFICATION_FETCH_INTERVAL, ClientConstants.NOTIFICATION_FETCH_INTERVAL_DEFAULT); + notificationInboxExpiry = getIntegerSetting(ConnectorSettings.NOTIFICATION_INBOX_EXPIRY, ClientConstants.NOTIFICATION_INBOX_EXPIRY_DEFAULT); + readTimeout = getIntegerSetting(ConnectorSettings.READ_TIMEOUT, ClientConstants.READ_TIMEOUT_DEFAULT); + notificationReadTimeout = getIntegerSetting(ConnectorSettings.NOTIFICATION_READ_TIMEOUT, + notificationDeliveryInterval > 0 ? 2 * notificationDeliveryInterval : ClientConstants.READ_TIMEOUT_DEFAULT); + serverFailoverInterval = getIntegerSetting(ConnectorSettings.SERVER_FAILOVER_INTERVAL, ClientConstants.SERVER_FAILOVER_INTERVAL_DEFAULT); + maxServerWaitTime = getIntegerSetting(ConnectorSettings.MAX_SERVER_WAIT_TIME, ClientConstants.MAX_SERVER_WAIT_TIME_DEFAULT); + serverStatusPollingInterval = getIntegerSetting(ConnectorSettings.SERVER_STATUS_POLLING_INTERVAL, ClientConstants.SERVER_STATUS_POLLING_INTERVAL_DEFAULT); + + //Validate endpoints if applicable + Object list = environment.get(ConnectorSettings.WLM_ENDPOINTS); + if (list != null && list instanceof List) { + validateEndpointList((List) list); + } + + // -- Logging + if (logger.isLoggable(Level.FINER)) { + StringBuilder sb = new StringBuilder(); + sb.append("Endpoints:"); + for (String endpoint : wlmList) { + sb.append(endpoint); + sb.append(" "); + } + logger.logp(Level.FINER, logger.getName(), "connect", sb.toString()); + + if (logger.isLoggable(Level.FINEST)) { + sb = new StringBuilder(); + sb.append("notificationDeliveryInterval"); + sb.append("="); + sb.append(notificationDeliveryInterval); + sb.append("\n"); + + sb.append("notificationFetchInterval"); + sb.append("="); + sb.append(notificationFetchInterval); + sb.append("\n"); + + sb.append("notificationInboxExpiry"); + sb.append("="); + sb.append(notificationInboxExpiry); + sb.append("\n"); + + sb.append("readTimeout"); + sb.append("="); + sb.append(readTimeout); + sb.append("\n"); + + sb.append("notificationReadTimeout"); + sb.append("="); + sb.append(notificationReadTimeout); + sb.append("\n"); + + sb.append("serverFailoverInterval"); + sb.append("="); + sb.append(serverFailoverInterval); + sb.append("\n"); + + sb.append("maxServerWaitTime"); + sb.append("="); + sb.append(maxServerWaitTime); + sb.append("\n"); + + sb.append("serverStatusPollingInterval"); + sb.append("="); + sb.append(serverStatusPollingInterval); + sb.append("\n"); + + logger.logp(Level.FINEST, logger.getName(), "connect", sb.toString()); + } + } + + connectionId = getConnectionNumber(); + + Object o = environment.get(ConnectorSettings.CUSTOM_SSLSOCKETFACTORY); + if (o != null && o instanceof SSLSocketFactory) { + SSLSocketFactory sslf = (SSLSocketFactory) o; + this.setCustomSSLSocketFactory(sslf); + } + + // No longer need environment + environment = null; + + connection = new RESTMBeanServerConnection(this); + + connectionOpened(); + } + + /** + * @param credentials + * @return + */ + private boolean areRequiedCredentialsSet(Object credentials) { + if (credentials == null) { + return false; + } + if (ConnectorSettings.CERTIFICATE_AUTHENTICATION.equals(credentials)) { + return true; + } + if ((credentials instanceof String[]) && (((String[]) credentials).length == 2)) { + return true; + } + return false; + } + + /** {@inheritDoc} */ + @Override + public synchronized MBeanServerConnection getMBeanServerConnection() throws IOException { + // if not yet connected, throw IOException + if (connection == null) + throw new IOException(); + + return connection; + } + + /** {@inheritDoc} */ + @Override + public MBeanServerConnection getMBeanServerConnection(Subject delegationSubject) throws IOException { + // this use-case not supported + throw new IOException(); + } + + /** {@inheritDoc} */ + @Override + public synchronized void close() throws IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "close", "Closing connector"); + } + + if (!closed) { + // It is possible for close to be called prior to connecting. + // If so, we behave as a no-op. + if (connection != null) { + connection.close(); + } + connection = null; + closed = true; + if (connectionListeners != null) { + JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.CLOSED, this, getConnectionId(), getNotificationNumber(), null, null); + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + } + + synchronized void connectionOpened() { + if (connectionListeners != null) { + JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.OPENED, this, getConnectionId(), getNotificationNumber(), null, null); + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + + synchronized void connectionFailed(Throwable t) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "connectionFailed", "Failed connection: " + t); + } + closed = true; + if (connectionListeners != null) { + JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.FAILED, this, getConnectionId(), getNotificationNumber(), RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.CONNECTION_FAILED), t); + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + + synchronized void notificationLost(Notification n) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "notificationLost", "Lost notification: " + n); + } + + if (connectionListeners != null) { + JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.NOTIFS_LOST, this, getConnectionId(), getNotificationNumber(), RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.NOTIFICATION_LOST), n); + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + + synchronized void connectionTemporarilyLost(Throwable t) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "connectionTemporarilyLost", "Lost connection:" + t.getMessage()); + } + + if (connectionListeners != null) { + JMXConnectionNotification notification = new JMXConnectionNotification(ClientProvider.CONNECTION_TEMPORARILY_LOST, this, getConnectionId(), getNotificationNumber(), RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.CONNECTION_TEMPORARILY_LOST), t); + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + + synchronized void connectionRestored(Exception[] exceptions) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "connectionRestored", "Connection restored"); + } + + if (connectionListeners != null) { + JMXConnectionNotification notification; + if (exceptions != null) { + notification = new JMXConnectionNotification(ClientProvider.CONNECTION_RESTORED_WITH_EXCEPTIONS, this, getConnectionId(), getNotificationNumber(), RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.CONNECTION_RESTORED_WITH_EXCEPTIONS), exceptions); + } else { + notification = new JMXConnectionNotification(ClientProvider.CONNECTION_RESTORED, this, getConnectionId(), getNotificationNumber(), RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.CONNECTION_RESTORED), null); + } + for (NotificationListenerEntry entry : connectionListeners) + entry.handleNotification(notification); + } + } + + /** {@inheritDoc} */ + @Override + public synchronized void addConnectionNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "addConnectionNotificationListener", "listener: " + listener + " | filter: " + filter + " | handback: " + handback); + } + + if (connectionListeners == null) + connectionListeners = new ArrayList(); + + connectionListeners.add(new NotificationListenerEntry(listener, filter, handback)); + } + + /** {@inheritDoc} */ + @Override + public synchronized void removeConnectionNotificationListener(NotificationListener listener) throws ListenerNotFoundException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeConnectionNotificationListener", "listener: " + listener); + } + + boolean listenerFound = false; + if (connectionListeners != null) { + Iterator entryIterator = connectionListeners.iterator(); + while (entryIterator.hasNext()) { + if (entryIterator.next().listener == listener) { + listenerFound = true; + entryIterator.remove(); + } + } + } + + if (!listenerFound) + throw new ListenerNotFoundException(); + } + + /** {@inheritDoc} */ + @Override + public synchronized void removeConnectionNotificationListener(NotificationListener l, NotificationFilter f, Object handback) throws ListenerNotFoundException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeConnectionNotificationListener", "listener: " + l + " | filter: " + f + " | handback: " + handback); + } + boolean listenerFound = false; + if (connectionListeners != null) { + listenerFound = connectionListeners.remove(new NotificationListenerEntry(l, f, handback)); + } + + if (!listenerFound) + throw new ListenerNotFoundException(); + } + + /** {@inheritDoc} */ + @Override + public synchronized String getConnectionId() { + return serviceURL.getProtocol() + ":" + getCurrentEndpoint() + " " + user + " " + connectionId; + } + + JMXServiceURL getServiceURL() { + return serviceURL; + } + + boolean isHostnameVerificationDisabled() { + return hostnameVerificationDisabled; + } + + int getNotificationDeliveryInterval() { + return notificationDeliveryInterval; + } + + int getNotificationFetchInterval() { + return notificationFetchInterval; + } + + int getNotificationInboxExpiry() { + return notificationInboxExpiry; + } + + int getReadTimeout() { + return readTimeout; + } + + int getNotificationReadTimeout() { + return notificationReadTimeout; + } + + int getMaxServerWaitTime() { + return maxServerWaitTime; + } + + int getServerFailoverInterval() { + return serverFailoverInterval; + } + + int getServerStatusPollingInterval() { + return serverStatusPollingInterval; + } + + String getBasicAuthHeader() { + return basicAuthHeader; + } + + String getCurrentEndpoint() { + return currentEndpoint; + } + + boolean isCollectiveUtilConnection() { + return isCollectiveUtilConnection; + } + + void setCurrentEndpoint(String currentEndpoint) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "setCurrentEndpoint", "Changing endpoint from " + this.currentEndpoint + " to " + currentEndpoint); + } + this.currentEndpoint = currentEndpoint; + } + + /** + * @return the logFailovers + */ + public boolean logFailovers() { + return logFailovers; + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/DynamicURL.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/DynamicURL.java new file mode 100755 index 00000000000..857b69e6fec --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/DynamicURL.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Level; +import java.util.logging.Logger; + +class DynamicURL { + + private static final Logger logger = Logger.getLogger(DynamicURL.class.getName()); + + private final String name; + private final Connector connector; + + DynamicURL(Connector connector, String name) { + this.name = name; + this.connector = connector; + } + + URL getURL() throws MalformedURLException { + String[] endpoint = RESTMBeanServerConnection.splitEndpoint(connector.getCurrentEndpoint()); + URL retURL = new URL("https", endpoint[0], Integer.valueOf(endpoint[1]), getName()); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "getURL", "URL: " + retURL.toString()); + } + + return retURL; + } + + String getName() { + return name; + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/FileTransferClient.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/FileTransferClient.java new file mode 100755 index 00000000000..7cff1cfd7c5 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/FileTransferClient.java @@ -0,0 +1,619 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.RandomAccessFile; +import java.net.ConnectException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +import javax.net.ssl.HttpsURLConnection; + +import com.ibm.json.java.JSONArray; +import com.ibm.json.java.JSONObject; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.ws.jmx.connector.client.rest.internal.ClientConstants.HttpMethod; +import com.ibm.ws.jmx.connector.client.rest.internal.resources.FileTransferClientMessagesUtil; +import com.ibm.ws.jmx.connector.converter.JSONConverter; + +/** + * This class provides the client-side file transfer support. It uses artifacts from the jmx rest connector client, such as the root URL and + * security credentials. New URLs are appended to the file transfer REST calls, so that it maps to a different jax-rs resource on the server-side. + */ +class FileTransferClient { + + private static final Logger logger = Logger.getLogger(FileTransferClient.class.getName()); + + private static final String OPERATION_DOWNLOAD = "downloadFile"; + private static final String OPERATION_UPLOAD = "uploadFile"; + private static final String OPERATION_DELETE = "deleteFile"; + private static final String OPERATION_DELETE_ALL = "deleteAll"; + private static final String QUERY_PARAM_UPLOAD_EXPAND = "expandOnCompletion"; + private static final String QUERY_PARAM_START_OFFSET = "startOffset"; + private static final String QUERY_PARAM_END_OFFSET = "endOffset"; + + private static final String FILE_TRANSFER_URL_V2 = "/fileTransfer"; + private static final String FILE_TRANSFER_ROUTER_URL_V2 = FILE_TRANSFER_URL_V2 + "/router"; + + private static final String COLLECTION_URL = "/collection"; + private static final String COLLECTION_OPERATION_DELETE = "delete"; + + private static final String FILE_TRANSFER_CONTENT_TYPE = "application/gzip"; + private static final String FILE_TRANSFER_ZIP_MIME = "application/zip"; + private static final String FILE_TRANSFER_PAX_MIME = "application/pax"; + private static final String FILE_TRANSFER_JSON_MIME = "application/json"; + private static final int FILE_TRANSFER_DEFAULT_BUFFER_SIZE = 8 * 1024; + private static final String RANDOM_FILE_ACCESS_READ_MODE = "r"; + private static final String RANDOM_FILE_ACCESS_READ_WRITE_MODE = "rw"; + + private final RESTMBeanServerConnection restConnection; + + public FileTransferClient(RESTMBeanServerConnection restConnection) throws IOException { + this.restConnection = restConnection; + + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), "constructor", + FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.CLIENT_INIT, restConnection.connector.getConnectionId())); + } + } + + /** + * Handle MBean invocation requests + */ + public Object handleOperation(String operation, Object[] params) throws IOException { + if (OPERATION_DOWNLOAD.equals(operation)) { + if (params.length == 2) { + downloadFile((String) params[0], (String) params[1]); + } else { + //partial download + return downloadFile((String) params[0], (String) params[1], (Long) params[2], (Long) params[3]); + } + } else if (OPERATION_UPLOAD.equals(operation)) { + uploadFile((String) params[0], (String) params[1], (Boolean) params[2]); + } else if (OPERATION_DELETE.equals(operation)) { + deleteFile((String) params[0]); + } else if (OPERATION_DELETE_ALL.equals(operation)) { + deleteAll((List) params[0]); + } else { + throw logUnsupportedOperationError("handleOperation", operation); + } + + //currently all operations are void, so return null. + return null; + } + + HttpsURLConnection getFileTransferConnection(URL url, HttpMethod method) throws IOException { + return getFileTransferConnection(url, method, true); + } + + HttpsURLConnection getFileTransferConnection(URL url, HttpMethod method, boolean setEncoding) throws IOException { + HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + connection.setDoInput(true); + if (method == HttpMethod.POST) { + if (restConnection.serverVersion == 2) { + //In V2 we were setting the Content-Type to application/gzip. In V3+ we corrected that + //by not specifying a Content-Type and instead specifying that the Content-Encoding is gzip. + connection.setRequestProperty("Content-Type", FILE_TRANSFER_CONTENT_TYPE); + } + connection.setDoOutput(true); + } else { + connection.setDoOutput(false); + } + connection.setUseCaches(false); + connection.setRequestMethod(method.toString()); + connection.setReadTimeout(restConnection.connector.getReadTimeout()); + + // fix 'Invalid CRLF found in header name' error + if (restConnection.connector.getBasicAuthHeader() != null) { + connection.setRequestProperty("Authorization", restConnection.connector.getBasicAuthHeader()); + } + if (restConnection.connector.isHostnameVerificationDisabled()) { + connection.setHostnameVerifier(restConnection.hostnameVerificationDisabler); + } + + connection.setRequestProperty("User-Agent", RESTMBeanServerConnection.CLIENT_VERSION); + + //Set routing headers if applicable + if (restConnection.isHostLevelRouting()) { + connection.addRequestProperty(ClientProvider.ROUTING_KEY_HOST_NAME, (String) restConnection.mapRouting.get(ClientProvider.ROUTING_KEY_HOST_NAME)); + } else if (restConnection.isServerLevelRouting()) { + connection.addRequestProperty(ClientProvider.ROUTING_KEY_HOST_NAME, (String) restConnection.mapRouting.get(ClientProvider.ROUTING_KEY_HOST_NAME)); + connection.addRequestProperty(ClientProvider.ROUTING_KEY_SERVER_USER_DIR, (String) restConnection.mapRouting.get(ClientProvider.ROUTING_KEY_SERVER_USER_DIR)); + connection.addRequestProperty(ClientProvider.ROUTING_KEY_SERVER_NAME, (String) restConnection.mapRouting.get(ClientProvider.ROUTING_KEY_SERVER_NAME)); + } + + if (restConnection.getConnector().getCustomSSLSocketFactory() != null) { + connection.setSSLSocketFactory(restConnection.getConnector().getCustomSSLSocketFactory()); + } + + if (restConnection.serverVersion > 2 && setEncoding) { + if (method == HttpMethod.POST) { + connection.addRequestProperty("Content-Encoding", "gzip"); + } else { + connection.addRequestProperty("Accept-Encoding", "gzip"); + } + } + + return connection; + } + + private String getEncodedFilePath(String path) throws IOException { + return "/" + URLEncoder.encode(path, "UTF-8"); + } + + private String getFileTransferURL() throws IOException { + if (restConnection.serverVersion == 2) { + return restConnection.getRootURL() + FILE_TRANSFER_URL_V2; + } else { + return restConnection.getFileTransferURL().toString(); + } + } + + private String getFileTransferRoutingURL() throws IOException { + if (restConnection.serverVersion == 2) { + return restConnection.getRootURL() + FILE_TRANSFER_ROUTER_URL_V2; + } else { + return restConnection.getFileTransferURL().toString(); + } + } + + private URL getURL(Map queryParameters, String additionalURL) throws IOException { + + String coreURLStr; + + if (restConnection.isServerLevelRouting() || restConnection.isHostLevelRouting()) { + coreURLStr = getFileTransferRoutingURL() + additionalURL; + } else { + coreURLStr = getFileTransferURL() + additionalURL; + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "getURL", "coreURLStr: " + coreURLStr); + } + + try { + if (queryParameters != null && !queryParameters.isEmpty()) { + //Iterate through the query parameters and build a query string + StringBuilder sb = new StringBuilder(); + Set> params = queryParameters.entrySet(); + + for (Entry param : params) { + //Add preceding characters + if (sb.length() == 0) { + //first entry + sb.append('?'); + } else { + //not the first entry + sb.append('&'); + } + + //Add parameter + sb.append(param.getKey()); + sb.append('='); + sb.append(URLEncoder.encode(param.getValue(), "UTF-8")); + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "getURL", "queryURL: " + sb.toString()); + } + + return new URL(coreURLStr + sb.toString()); + } + + return new URL(coreURLStr); + + } catch (Exception e) { + throw logClientException("getURL", e); + } + + } + + public void downloadFile(String remoteSourceFile, String localTargetFile) throws IOException { + downloadFile(remoteSourceFile, localTargetFile, 0, -1); //regular download (non-partial download) + } + + public long downloadFile(String remoteSourceFile, String localTargetFile, long startOffset, long endOffset) throws IOException { + final String methodName = "downloadFile(String remoteSourceFile, String localTargetFile, long startOffset, long endOffset)"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Entering downloadFile with remoteSourceFile: " + remoteSourceFile + " ; localTargetFile: " + localTargetFile + + " ; startOffset: " + startOffset + " and endOffset: " + endOffset); + } + + Map queryParams = new HashMap(); + + if (startOffset > 0) { + queryParams.put(QUERY_PARAM_START_OFFSET, String.valueOf(startOffset)); + } + + if (endOffset > -1) { + queryParams.put(QUERY_PARAM_END_OFFSET, String.valueOf(endOffset)); + } + + URL url = getURL(queryParams, getEncodedFilePath(remoteSourceFile)); + HttpsURLConnection connection = getFileTransferConnection(url, HttpMethod.GET); + + // Check response code from server + final int responseCode = connection.getResponseCode(); + InputStream is = null; + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + + //Get the resulting stream + is = connection.getInputStream(); + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), methodName, "Received stream: " + FileTransferClientMessagesUtil.getObjID(is)); + } + //Data is always compressed with this java client, so use GZIP stream reader + is = new GZIPInputStream(is, FILE_TRANSFER_DEFAULT_BUFFER_SIZE); + break; + + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + throw logServerException(methodName, connection); + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw logCredentialsException(methodName, responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = logResponseCodeException(methodName, responseCode, connection); + restConnection.recoverConnection(ioe); + throw ioe; + default: + throw logResponseCodeException(methodName, responseCode, connection); + } + + //Create our target output stream + RandomAccessFile destFile = new RandomAccessFile(localTargetFile, RANDOM_FILE_ACCESS_READ_WRITE_MODE); + long totalBytesRead = 0; + + try { + //Transfer bytes to output file + byte[] buf = new byte[FILE_TRANSFER_DEFAULT_BUFFER_SIZE]; + int bytesRead; + + while ((bytesRead = is.read(buf)) > 0) { + destFile.write(buf, 0, bytesRead); + totalBytesRead += bytesRead; + } + destFile.setLength(totalBytesRead); + } finally { + tryToClose(is); + tryToClose(destFile); + } + + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), methodName, + FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.DOWNLOAD_TO_FILE, remoteSourceFile, localTargetFile, + restConnection.connector.getConnectionId())); + } + + if (startOffset < 0) { + startOffset = 0; + } + + long nextStartOffset = startOffset + totalBytesRead; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Exiting downloadFile with nextStartOffset=" + nextStartOffset); + } + + return nextStartOffset; + } + + public void uploadFile(String localSourceFile, String remoteTargetFile, boolean expandOnCompletion) throws IOException { + final String methodName = "uploadFile(String localSourceFile, String remoteTargetFile, boolean expandOnCompletion)"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Entering uploadFile with localSourceFile: " + localSourceFile + " and remoteTargetFile: " + remoteTargetFile); + } + + Map queryParams = new HashMap(); + queryParams.put(QUERY_PARAM_UPLOAD_EXPAND, String.valueOf(expandOnCompletion)); + URL url = getURL(queryParams, getEncodedFilePath(remoteTargetFile)); + HttpsURLConnection connection = getFileTransferConnection(url, HttpMethod.POST); + + if (expandOnCompletion && restConnection.serverVersion >= 5) { + //Starting with server V5 users aren't required to put an extension on the target file, + //so for archives that will be expanded we place a proper Content-Type + if (localSourceFile.endsWith(".pax")) { + connection.setRequestProperty("Content-Type", FILE_TRANSFER_PAX_MIME); + } else { + //default is zip, since it's handled the same was WAR/EAR/JAR + connection.setRequestProperty("Content-Type", FILE_TRANSFER_ZIP_MIME); + } + } + + //Grab file to be uploaded + RandomAccessFile uploadFile = new RandomAccessFile(localSourceFile, RANDOM_FILE_ACCESS_READ_MODE); + + //Grab the outgoing stream + OutputStream outStream = null; + try { + outStream = connection.getOutputStream(); + } catch (ConnectException ce) { + restConnection.recoverConnection(ce); + tryToClose(outStream); + tryToClose(uploadFile); + throw ce; + } + + //We're always compressing the transfers from this java client, so use GZIP + outStream = new GZIPOutputStream(outStream, FILE_TRANSFER_DEFAULT_BUFFER_SIZE); + + try { + //Transfer bytes to output file + byte[] buf = new byte[FILE_TRANSFER_DEFAULT_BUFFER_SIZE]; + int bytesRead; + while ((bytesRead = uploadFile.read(buf)) > 0) { + outStream.write(buf, 0, bytesRead); + } + outStream.flush(); + + } finally { + tryToClose(outStream); + tryToClose(uploadFile); + } + + // Check response code from server + final int responseCode = connection.getResponseCode(); + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), methodName, + FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.UPLOAD_FROM_FILE, localSourceFile, remoteTargetFile, + restConnection.connector.getConnectionId())); + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Exiting uploadFile"); + } + + return; + + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + throw logServerException(methodName, connection); + + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw logCredentialsException(methodName, responseCode, connection); + + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = logResponseCodeException(methodName, responseCode, connection); + restConnection.recoverConnection(ioe); + throw ioe; + + default: + throw logResponseCodeException(methodName, responseCode, connection); + } + + } + + public void deleteFile(String remoteSourceFile) throws IOException { + final String methodName = "deleteFile(String remoteSourceFile)"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Entering deleteFile with remoteSourceFile: " + remoteSourceFile); + } + + URL url = getURL(null, getEncodedFilePath(remoteSourceFile)); + HttpsURLConnection connection = getFileTransferConnection(url, HttpMethod.DELETE); + + // Check response code from server + final int responseCode = connection.getResponseCode(); + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), methodName, + FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.DELETE_FILE, remoteSourceFile, + restConnection.connector.getConnectionId())); + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Exiting deleteFile"); + } + + return; + + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + throw logServerException(methodName, connection); + + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw logCredentialsException(methodName, responseCode, connection); + + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = logResponseCodeException(methodName, responseCode, connection); + restConnection.recoverConnection(ioe); + throw ioe; + + default: + throw logResponseCodeException(methodName, responseCode, connection); + } + } + + public void deleteAll(List remoteArtifacts) throws IOException { + final String methodName = "deleteAll(List remoteArtifacts)"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Entering deleteAll with remoteArtifacts: " + remoteArtifacts); + } + + URL url = getURL(null, COLLECTION_URL); + HttpsURLConnection connection = getFileTransferConnection(url, HttpMethod.POST, false); + connection.setRequestProperty("Content-Type", FILE_TRANSFER_JSON_MIME); + + //Grab the outgoing stream + OutputStream outStream = null; + try { + outStream = connection.getOutputStream(); + } catch (ConnectException ce) { + restConnection.recoverConnection(ce); + tryToClose(outStream); + throw ce; + } + + try { + // Generate JSON with following structure: { "delete": ["C:/temp/output.log", "C:/wlp", "C:/workarea"] } + JSONArray artifactsArray = new JSONArray(); + for (String artifact : remoteArtifacts) { + artifactsArray.add(artifact); + } + + JSONObject contentObject = new JSONObject(); + contentObject.put(COLLECTION_OPERATION_DELETE, artifactsArray); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Generated JSON: " + contentObject.toString()); + } + outStream.write(contentObject.toString().getBytes("UTF-8")); + outStream.flush(); + } finally { + tryToClose(outStream); + } + + // Check response code from server + final int responseCode = connection.getResponseCode(); + + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), methodName, + FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.DELETE_ALL, remoteArtifacts, + restConnection.connector.getConnectionId())); + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Exiting deleteAll"); + } + + return; + + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + throw logServerException(methodName, connection); + + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw logCredentialsException(methodName, responseCode, connection); + + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = logResponseCodeException(methodName, responseCode, connection); + restConnection.recoverConnection(ioe); + throw ioe; + + default: + throw logResponseCodeException(methodName, responseCode, connection); + } + } + + public static boolean tryToClose(Closeable closeable) { + if (closeable != null) { + try { + closeable.close(); + return true; + } catch (IOException e) { + // ignore + } + } + return false; + } + + private IOException logClientException(String methodName, Exception e) { + String errorMsg = FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.CLIENT_ERROR, e.getLocalizedMessage(), + restConnection.connector.getConnectionId()); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg, e); + return new IOException(errorMsg, e); + } + + private IOException logServerException(String methodName, HttpURLConnection connection) { + Throwable t = null; + JSONConverter converter = JSONConverter.getConverter(); + try { + t = converter.readThrowable(connection.getErrorStream()); + logger.logp(Level.SEVERE, logger.getName(), methodName, t.getMessage()); + + } catch (Exception e) { + //Fallback into standard server message + String responseMessage = "error"; + try { + responseMessage = connection.getResponseMessage(); + } catch (IOException io) { + // Use "error" for message..but shouldn't really happen + } + String errorMsg = FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.SERVER_ERROR, responseMessage, + restConnection.connector.getConnectionId()); + t = new IOException(errorMsg); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg); + } finally { + JSONConverter.returnConverter(converter); + } + + return (t instanceof IOException) ? (IOException) t : new IOException(t); + } + + private IOException logCredentialsException(String methodName, int responseCode, HttpURLConnection connection) { + String responseMessage = null; + try { + responseMessage = connection.getResponseMessage(); + } catch (IOException io) { + // Use null for message + } + String errorMsg = FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.BAD_CREDENTIALS, responseCode, responseMessage, + restConnection.connector.getConnectionId()); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg); + return new IOException(errorMsg); + } + + private IOException logResponseCodeException(String methodName, int responseCode, HttpURLConnection connection) { + String responseMessage = null; + try { + responseMessage = connection.getResponseMessage(); + } catch (IOException io) { + // Use null for message + } + String errorMsg = FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.RESPONSE_CODE_ERROR, responseCode, responseMessage, + restConnection.connector.getConnectionId()); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg); + return new IOException(errorMsg); + } + + private IOException logUnsupportedOperationError(String methodName, String operation) { + String errorMsg = FileTransferClientMessagesUtil.getMessage(FileTransferClientMessagesUtil.UNSUPPORTED_OPERATION, operation, restConnection.connector.getConnectionId()); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg); + return new IOException(errorMsg); + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationListenerEntry.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationListenerEntry.java new file mode 100755 index 00000000000..49738d7371c --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationListenerEntry.java @@ -0,0 +1,71 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; + +import com.ibm.ws.jmx.connector.client.rest.internal.resources.RESTClientMessagesUtil; + +class NotificationListenerEntry { + public final NotificationListener listener; + public final NotificationFilter filter; + public final Object handback; + + private static final Logger logger = Logger.getLogger(NotificationListenerEntry.class.getName()); + + /** + * @param listener + * @param filter + * @param handback + */ + NotificationListenerEntry(NotificationListener listener, NotificationFilter filter, Object handback) { + this.listener = listener; + this.filter = filter; + this.handback = handback; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "NotificationListenerEntry", "[" + RESTClientMessagesUtil.getObjID(this) + "] | listener: " + listener + " | filter: " + + filter + " | handback: " + handback); + } + } + + void handleNotification(Notification notification) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "handleNotification", "[" + RESTClientMessagesUtil.getObjID(this) + "] | Notification: " + notification); + } + + if (filter == null || filter.isNotificationEnabled(notification)) { + listener.handleNotification(notification, handback); + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NotificationListenerEntry)) + return false; + NotificationListenerEntry other = (NotificationListenerEntry) o; + return listener.equals(other.listener) && filter == other.filter && handback == other.handback; + } + + @Override + public int hashCode() { + return listener.hashCode() + + (filter != null ? filter.hashCode() : 0) + + (handback != null ? handback.hashCode() : 0); + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationRegistry.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationRegistry.java new file mode 100755 index 00000000000..15a730bcad1 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/NotificationRegistry.java @@ -0,0 +1,907 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.ConnectException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.InstanceNotFoundException; +import javax.management.ListenerNotFoundException; +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; +import javax.management.ObjectName; +import javax.management.OperationsException; +import javax.management.RuntimeOperationsException; +import javax.net.ssl.HttpsURLConnection; + +import com.ibm.ws.jmx.connector.client.rest.internal.ClientConstants.HttpMethod; +import com.ibm.ws.jmx.connector.client.rest.internal.RESTMBeanServerConnection.PollingMode; +import com.ibm.ws.jmx.connector.client.rest.internal.resources.RESTClientMessagesUtil; +import com.ibm.ws.jmx.connector.converter.JSONConverter; +import com.ibm.ws.jmx.connector.converter.NotificationTargetInformation; +import com.ibm.ws.jmx.connector.datatypes.NotificationArea; +import com.ibm.ws.jmx.connector.datatypes.NotificationRegistration; +import com.ibm.ws.jmx.connector.datatypes.NotificationSettings; +import com.ibm.ws.jmx.connector.datatypes.ServerNotificationRegistration; +import com.ibm.ws.jmx.connector.datatypes.ServerNotificationRegistration.Operation; + +class NotificationRegistry { + + private static final Logger logger = Logger.getLogger(NotificationRegistry.class.getName()); + + private final RESTMBeanServerConnection serverConnection; + private DynamicURL inboxURL, registrationsURL, serverRegistrationsURL, notificationClientURL; + private final Map registrationMap = Collections.synchronizedMap(new HashMap()); + private final List serverRegistrationList = Collections.synchronizedList(new ArrayList()); + private ObjectIdentityCache identityCache; + private final JSONConverter converter = JSONConverter.getConverter(); + + NotificationRegistry(RESTMBeanServerConnection serverConnection) throws IOException { + this.serverConnection = serverConnection; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "init", "Initializing registry " + RESTClientMessagesUtil.getObjID(this) + " within connection: " + + serverConnection.getConnector().getConnectionId()); + } + + try { + setupNotificationArea(); + } catch (IOException io) { + //ignore IOException at this point, because we will do a connection recovery later on inside the notification thread's run method. + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + } + + //NOTE: we don't call recoverConnection from this method, because this method is already called from recoverConnection so + //we want to avoid cycles. + protected void setupNotificationArea() throws Throwable { + final String sourceMethod = "setupNotificationArea"; + + URL notificationsURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for creating a notification area + notificationsURL = serverConnection.getNotificationsURL(); + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "[" + RESTClientMessagesUtil.getObjID(this) + "] About to call notificationURL: " + notificationsURL); + } + + // Get connection to server + connection = serverConnection.getConnection(notificationsURL, HttpMethod.POST, true); + + // Create NotificationSettings object + NotificationSettings ns = new NotificationSettings(); + ns.deliveryInterval = serverConnection.getConnector().getNotificationDeliveryInterval(); + ns.inboxExpiry = serverConnection.getConnector().getNotificationInboxExpiry(); + + // Write CreateMBean JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeNotificationSettings(output, ns); + output.flush(); + } catch (ConnectException ce) { + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw serverConnection.getRequestErrorException(sourceMethod, io, notificationsURL); + } + + // Check response code from server + final int responseCode = connection.getResponseCode(); + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Received responseCode: " + responseCode); + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a NotificationArea + NotificationArea area = converter.readNotificationArea(connection.getInputStream()); + + inboxURL = new DynamicURL(serverConnection.connector, area.inboxURL); + registrationsURL = new DynamicURL(serverConnection.connector, area.registrationsURL); + serverRegistrationsURL = new DynamicURL(serverConnection.connector, area.serverRegistrationsURL); + notificationClientURL = new DynamicURL(serverConnection.connector, area.clientURL); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "setupNotificationArea", "Successfully setup inboxURL: " + inboxURL.getURL()); + } + break; + } catch (Exception e) { + throw serverConnection.getResponseErrorException(sourceMethod, e, notificationsURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_NOT_FOUND: + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.URL_NOT_FOUND)); + case HttpURLConnection.HTTP_UNAVAILABLE: + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + throw serverConnection.getServerThrowable(sourceMethod, connection); + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw serverConnection.getBadCredentialsException(responseCode, connection); + default: + throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + synchronized void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "addNotificationListener", "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + name + " | listener: " + + listener + " | filter: " + filter + " | handback: " + + handback); + } + // Check if the MBean is registered and throw InstanceNotFoundException if not + // (it is possible the registration will not need updating, so we do this check first) + if (!serverConnection.isRegistered(name)) { + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + } + + // Build identifier for accessing the registration map. + // If a routing context has been set up, include the routing info (host name, server name, server user dir) as part of the key. + final NotificationTargetInformation nti; + if (serverConnection.isServerLevelRouting()) { + nti = new NotificationTargetInformation(name, serverConnection.mapRouting); + } else { + nti = new NotificationTargetInformation(name); + } + + NotificationListenerEntry set = new NotificationListenerEntry(listener, filter, handback); + ClientNotificationRegistration localRegistration = registrationMap.get(nti); + if (localRegistration == null) { + localRegistration = new ClientNotificationRegistration(nti); + registrationMap.put(nti, localRegistration); + } + + localRegistration.addNotificationListenerEntry(set); + + //ensure we're polling for notifications (will be no-op if we're already polling for notifications) + serverConnection.setPollingMode(PollingMode.NOTIFICATION); + } + + synchronized void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "addNotificationListener", "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + name + " | listener: " + + listener + " | filter: " + filter + " | handback: " + handback); + } + + // Build identifier for accessing the server registration list. + // If a routing context has been set up, include the routing info (host name, server name, server user dir) as part of the key. + final NotificationTargetInformation nti; + if (serverConnection.isServerLevelRouting()) { + nti = new NotificationTargetInformation(name, serverConnection.mapRouting); + } else { + nti = new NotificationTargetInformation(name); + } + + try { + updateServerNotificationRegistration(nti, listener, filter, handback, Operation.Add); + serverRegistrationList.add(new ServerNotificationListenerEntry(nti, listener, filter, handback)); + } catch (ListenerNotFoundException lnf) { + throw new IOException(lnf); // Should never happen + } + + //ensure we're polling for notifications (will be no-op if we're already polling for notifications) + serverConnection.setPollingMode(PollingMode.NOTIFICATION); + } + + synchronized void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeNotificationListener", "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + name + " | listener: " + + listener); + } + + // Build identifier for accessing the server registration list. + // If a routing context has been set up, include the routing info (host name, server name, server user dir) as part of the key. + final NotificationTargetInformation nti; + if (serverConnection.isServerLevelRouting()) { + nti = new NotificationTargetInformation(name, serverConnection.mapRouting); + } else { + nti = new NotificationTargetInformation(name); + } + + updateServerNotificationRegistration(nti, listener, null, null, Operation.RemoveAll); + Iterator iterator = serverRegistrationList.iterator(); + while (iterator.hasNext()) { + ServerNotificationListenerEntry entry = iterator.next(); + // Remove all registrations for the listener on the given MBean (ObjectName + routing info). + if (entry.nti.equals(nti) && entry.listener.equals(listener)) { + iterator.remove(); + } + } + + cleanupIfEmpty(); + } + + synchronized void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeNotificationListener", "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + name + " | listener: " + + listener + " | filter: " + filter + " | handback: " + + handback); + } + + // Build identifier for accessing the server registration list. + // If a routing context has been set up, include the routing info (host name, server name, server user dir) as part of the key. + final NotificationTargetInformation nti; + if (serverConnection.isServerLevelRouting()) { + nti = new NotificationTargetInformation(name, serverConnection.mapRouting); + } else { + nti = new NotificationTargetInformation(name); + } + + updateServerNotificationRegistration(nti, listener, filter, handback, Operation.RemoveSpecific); + serverRegistrationList.remove(new ServerNotificationListenerEntry(nti, listener, filter, handback)); + + cleanupIfEmpty(); + } + + synchronized void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + removeNotificationListener(name, listener, null, null, true); + } + + synchronized void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + removeNotificationListener(name, listener, filter, handback, false); + } + + void close() { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "close", "Closing registry " + RESTClientMessagesUtil.getObjID(this)); + } + + if (serverConnection.isConnected()) { + sendClosingSignal(); + } + + JSONConverter.returnConverter(converter); + } + + //This method sends a signal to the server-side indicating that the inbox can be deleted, because this client is being closed. + //We don't throw any errors because the connector is about to be closed. + private void sendClosingSignal() { + URL clientURL = null; + HttpsURLConnection connection = null; + try { + // Get the appropriate URL to delete notification client + if (serverConnection.serverVersion >= 4) { + //V4+ clients use /{clientID} to delete the notification client + clientURL = getNotificationClientURL(); + } else { + //Pre-V4 clients use /{clientID}/inbox to delete the notification client + clientURL = getInboxURL(); + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, + logger.getName(), + "sendClosingSignal", + "Making a call to delete inbox [" + clientURL + "] from [" + + RESTClientMessagesUtil.getObjID(this) + "]"); + } + // Get connection to server + connection = serverConnection.getConnection(clientURL, HttpMethod.DELETE, true); + connection.setReadTimeout(serverConnection.getConnector().getReadTimeout()); + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + logger.logp(Level.FINE, logger.getName(), "sendClosingSignal", ce.getMessage(), ce); + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "sendClosingSignal", "Response code: " + responseCode); + } + + } catch (IOException io) { + logger.logp(Level.FINE, logger.getName(), "sendClosingSignal", io.getMessage(), io); + } + } + + synchronized void connectionFailed(Throwable t) { + serverConnection.connectionFailed(t); + } + + private void updateServerNotificationRegistration(NotificationTargetInformation nti, ObjectName listener, NotificationFilter filter, Object handback, Operation operation) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + final String sourceMethod = "updateServerNotificationRegistration"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + nti.getName() + " | listener: " + + listener + " | filter: " + filter + " | handback: " + + handback + " | operation: " + operation); + } + + URL serverRegistrationsURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for creating/updating ServerNotificationRegistrations + serverRegistrationsURL = getServerRegistrationsURL(); + + // Get connection to server + connection = serverConnection.getConnection(serverRegistrationsURL, HttpMethod.POST, true, nti.getRoutingInformation()); + + // Create ServerNotificationRegistration object + ServerNotificationRegistration snr = new ServerNotificationRegistration(); + snr.objectName = nti.getName(); + snr.listener = listener; + if (operation == Operation.Add) { + snr.filter = filter; + snr.handback = handback; + } + if (operation != Operation.RemoveAll) { + if (identityCache == null) + identityCache = new ObjectIdentityCache(); + snr.filterID = identityCache.getObjectIdentity(filter); + snr.handbackID = identityCache.getObjectIdentity(handback); + } + snr.operation = operation; + + // Write NotificationRegsitration JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeServerNotificationRegistration(output, snr); + output.flush(); + output.close(); + } catch (ConnectException ce) { + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw serverConnection.getRequestErrorException(sourceMethod, io, serverRegistrationsURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + // Nothing to do; no response expected + break; + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + try { + // Server response should be a serialized Throwable, and if the notification area is gone, + // this connection is no longer valid + throw serverConnection.getServerThrowable(sourceMethod, connection); + } catch (IOException io) { + serverConnection.recoverConnection(io); + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw converter.readThrowable(connection.getErrorStream()); + } catch (RuntimeOperationsException roe) { + throw roe; + } catch (ListenerNotFoundException lnf) { + throw lnf; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (IOException io) { + throw io; + } catch (ClassNotFoundException cnf) { + throw new IOException(cnf); + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw serverConnection.getBadCredentialsException(responseCode, connection); + default: + throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + private void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback, boolean matchListenerOnly) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeNotificationListener", "[" + RESTClientMessagesUtil.getObjID(this) + "] objectName: " + name + " | listener: " + + listener + " | filter: " + filter + " | handback: " + + handback + " | matchListenerOnly: " + matchListenerOnly); + } + + // Check if the MBean is registered and throw InstanceNotFoundException if not + // (it is possible the registration will not need updating, so we do this check first) + if (!serverConnection.isRegistered(name)) { + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + } + + // Build identifier for accessing the registration map. + // If a routing context has been set up, include the routing info (host name, server name, server user dir) as part of the key. + final NotificationTargetInformation nti; + if (serverConnection.isServerLevelRouting()) { + nti = new NotificationTargetInformation(name, serverConnection.mapRouting); + } else { + nti = new NotificationTargetInformation(name); + } + + ClientNotificationRegistration localRegistration = registrationMap.get(nti); + if (localRegistration == null) + throw new ListenerNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.LISTENER_NOT_FOUND, name)); + + localRegistration.removeNotificationListenerEntries(name, listener, filter, handback, matchListenerOnly); + if (localRegistration.isEmpty()) { + registrationMap.remove(nti); + } + + cleanupIfEmpty(); + } + + /** + * If there are no more registered listeners then we cleanup this registry and stop notification polling + */ + private void cleanupIfEmpty() { + if (registrationMap.isEmpty() && serverRegistrationList.isEmpty()) { + serverConnection.discardNotificationRegistry(); + } + } + + protected synchronized boolean restoreNotificationRegistrations(boolean sendRestoreNotification) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "restoreNotificationRegistrations", "[" + RESTClientMessagesUtil.getObjID(this) + "]"); + } + + List clientRemovalList = new ArrayList(); + List serverRemovalList = new ArrayList(); + List exceptions = null; + Iterator> cnrIterator = registrationMap.entrySet().iterator(); + // Try to restore the registration for the notification listeners we've accumulated in the registration map. + while (cnrIterator.hasNext()) { + Map.Entry entry = cnrIterator.next(); + try { + entry.getValue().createNotificationRegistration(); + } catch (IOException io) { + // Unsuccessful + return false; + } catch (InstanceNotFoundException inf) { + // Can continue, but need to note that some could not be restored + if (exceptions == null) + exceptions = new ArrayList(); + + clientRemovalList.add(entry.getKey()); + exceptions.add(inf); + } + } + + for (ServerNotificationListenerEntry snl : serverRegistrationList) { + try { + updateServerNotificationRegistration(snl.nti, snl.listener, snl.filter, snl.handback, Operation.Add); + } catch (IOException io) { + // Unsuccessful + return false; + } catch (OperationsException oe) { + // Can continue, but need to note that some could not be restored + if (exceptions == null) + exceptions = new ArrayList(); + + serverRemovalList.add(snl); + exceptions.add(oe); + } + } + + if (exceptions != null) { + for (NotificationTargetInformation clientEntry : clientRemovalList) + registrationMap.remove(clientEntry); + for (ServerNotificationListenerEntry snl : serverRemovalList) + serverRegistrationList.remove(snl); + } + + if (sendRestoreNotification) { + serverConnection.getConnector().connectionRestored(exceptions != null ? exceptions.toArray(new Exception[exceptions.size()]) : null); + } + + return true; + } + + protected URL getInboxURL() throws IOException { + return inboxURL.getURL(); + } + + protected URL getNotificationClientURL() throws IOException { + return notificationClientURL.getURL(); + } + + protected DynamicURL getRegistrationsURL() throws IOException { + return registrationsURL; + } + + protected URL getServerRegistrationsURL() throws IOException { + return serverRegistrationsURL.getURL(); + } + + class ClientNotificationRegistration { + private final NotificationTargetInformation listenerKey; + private DynamicURL registrationURL; + private final List entries; + private List serverFilters; + + ClientNotificationRegistration(NotificationTargetInformation listenerKey) { + this.listenerKey = listenerKey; + entries = new ArrayList(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "ClientNotificationRegistrion init", "[" + RESTClientMessagesUtil.getObjID(NotificationRegistry.this) + + "] | [" + RESTClientMessagesUtil.getObjID(this) + + "] | objectName: " + listenerKey.getName()); + } + } + + synchronized void addNotificationListenerEntry(NotificationListenerEntry entry) throws InstanceNotFoundException, IOException { + final boolean serverFiltersUpdated; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "addNotificationListenerEntry", "[" + RESTClientMessagesUtil.getObjID(this) + "]"); + } + + // Receive all notifications if there is no filter, or if it cannot be transmitted + // to the server for server-side filtering + final boolean receiveAllNotifications = entry.filter == null || !converter.isSupportedNotificationFilter(entry.filter); + + if (receiveAllNotifications) { + if (serverFilters != null) { + serverFilters = null; + serverFiltersUpdated = true; + } else { + serverFiltersUpdated = false; + } + } else if (serverFilters != null || entries.size() == 0) { + // if there are already server-side filters, or there are no other notification sets, + // the current filter can be added to the list + if (serverFilters == null) + serverFilters = new ArrayList(); + serverFilters.add(entry.filter); + serverFiltersUpdated = true; + } else { + // there is already at least one notification set that cannot rely on + // server side filtering + serverFiltersUpdated = false; + } + + entries.add(entry); + + if (registrationURL == null) { + createNotificationRegistration(); + } else if (serverFiltersUpdated) { + updateNotificationRegistration(); + } + } + + synchronized void removeNotificationListenerEntries(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback, boolean matchListenerOnly) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + boolean listenerFound = false; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "removeNotificationListenerEntries", "[" + RESTClientMessagesUtil.getObjID(this) + "] | objectName: " + + name + " | listener: " + listener + " | filter: " + filter + " | handback: " + + handback + " | matchListenerOnly: " + matchListenerOnly); + } + + Iterator entryIterator = entries.iterator(); + while (entryIterator.hasNext()) { + NotificationListenerEntry entry = entryIterator.next(); + if (entry.listener == listener && (matchListenerOnly || (entry.filter == filter && entry.handback == handback))) { + listenerFound = true; + entryIterator.remove(); + if (!matchListenerOnly) + break; + } + } + + if (!listenerFound) + throw new ListenerNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.LISTENER_NOT_FOUND, name)); + + List newServerFilters = null; + for (NotificationListenerEntry entry : entries) { + if (entry.filter == null || !converter.isSupportedNotificationFilter(entry.filter)) { + newServerFilters = null; + break; + } else { + if (newServerFilters == null) + newServerFilters = new ArrayList(); + newServerFilters.add(entry.filter); + } + } + + final boolean serverFiltersUpdated; + if ((serverFilters != null && !serverFilters.equals(newServerFilters)) || + (serverFilters == null && newServerFilters != null)) { + serverFiltersUpdated = true; + serverFilters = newServerFilters; + } else { + serverFiltersUpdated = false; + } + + if (isEmpty()) { + deleteNotificationRegistration(); + } else if (serverFiltersUpdated) { + updateNotificationRegistration(); + } + } + + private NotificationFilter[] getServerFilters() { + if (serverFilters == null) + return null; + NotificationFilter[] serverFilterArray = new NotificationFilter[serverFilters.size()]; + return serverFilters.toArray(serverFilterArray); + } + + private URL getRegistrationURL() throws IOException { + return registrationURL.getURL(); + } + + boolean isEmpty() { + return entries.isEmpty(); + } + + synchronized void handleNotification(Notification notification) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "handleNotification", "[" + RESTClientMessagesUtil.getObjID(this) + + " | Notification: " + notification); + } + + for (NotificationListenerEntry entry : entries) + entry.handleNotification(notification); + } + + synchronized void createNotificationRegistration() throws InstanceNotFoundException, IOException { + final String sourceMethod = "createNotificationRegistration"; + + URL registrationsURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for creating/updating NotificationRegistrations + registrationsURL = getRegistrationsURL().getURL(); + + // Get connection to server + connection = serverConnection.getConnection(registrationsURL, HttpMethod.POST, true, listenerKey.getRoutingInformation()); + + // Create NotificationRegistration object + NotificationRegistration nr = new NotificationRegistration(); + nr.objectName = listenerKey.getName(); + nr.filters = getServerFilters(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, RESTClientMessagesUtil.getObjID(this)); + } + + // Write NotificationRegsitration JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeNotificationRegistration(output, nr); + output.flush(); + output.close(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw serverConnection.getRequestErrorException(sourceMethod, io, registrationsURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + try { + // Process and return server response, which should be a URL + String url = converter.readString(connection.getInputStream()); + registrationURL = new DynamicURL(serverConnection.connector, url); + break; + } catch (Exception e) { + throw serverConnection.getResponseErrorException(sourceMethod, e, registrationsURL); + } + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + serverConnection.recoverConnection(ioe); + throw ioe; + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw serverConnection.getServerThrowable(sourceMethod, connection); + } catch (RuntimeOperationsException roe) { + throw roe; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (IOException io) { + throw io; + } catch (ClassNotFoundException cnf) { + throw new IOException(cnf); + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw serverConnection.getBadCredentialsException(responseCode, connection); + default: + throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + + } + + private void updateNotificationRegistration() throws InstanceNotFoundException, IOException { + final String sourceMethod = "updateNotificationRegistration"; + + URL registrationURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for this NotificationRegistration + registrationURL = getRegistrationURL(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, RESTClientMessagesUtil.getObjID(this)); + } + + // Get connection to server + connection = serverConnection.getConnection(registrationURL, HttpMethod.PUT, true, listenerKey.getRoutingInformation()); + + // Write array of NotificationFilters to JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeNotificationFilters(output, getServerFilters()); + output.flush(); + output.close(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw serverConnection.getRequestErrorException(sourceMethod, io, registrationURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "response code: " + responseCode); + } + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + // Nothing to do; no response expected + break; + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + serverConnection.recoverConnection(ioe); + throw ioe; + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw converter.readThrowable(connection.getErrorStream()); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (IOException io) { + throw io; + } catch (ClassNotFoundException cnf) { + throw new IOException(cnf); + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw serverConnection.getBadCredentialsException(responseCode, connection); + default: + throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + private void deleteNotificationRegistration() throws InstanceNotFoundException, ListenerNotFoundException, IOException { + final String sourceMethod = "deleteNotificationRegistration"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, RESTClientMessagesUtil.getObjID(this)); + } + + URL registrationURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for NotificationRegistration + registrationURL = getRegistrationURL(); + + // Get connection to server + connection = serverConnection.getConnection(registrationURL, HttpMethod.DELETE, true, listenerKey.getRoutingInformation()); + } catch (IOException io) { + throw serverConnection.getRequestErrorException(sourceMethod, io, registrationURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + serverConnection.recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Response code: " + responseCode); + } + + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + // Nothing to do; no response expected + break; + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + serverConnection.recoverConnection(ioe); + throw ioe; + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw converter.readThrowable(connection.getInputStream()); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (ListenerNotFoundException lnf) { + throw lnf; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw serverConnection.getBadCredentialsException(responseCode, connection); + default: + throw serverConnection.getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + } + + /** + * @return the registrationMap + */ + public Map getRegistrationMap() { + return registrationMap; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ObjectIdentityCache.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ObjectIdentityCache.java new file mode 100755 index 00000000000..1c0404c6c9f --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ObjectIdentityCache.java @@ -0,0 +1,78 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; +import java.util.HashMap; +import java.util.Map; + +/** + * + */ +public class ObjectIdentityCache { + + private final Map identityMap = new HashMap(); + private final ReferenceQueue referenceQueue = new ReferenceQueue(); + private int nextIdentity = Integer.MIN_VALUE + 1; + + int getObjectIdentity(Object o) { + // Clean up cleared references + ObjectReference clearedRef = (ObjectReference) referenceQueue.poll(); + while (clearedRef != null) { + identityMap.remove(clearedRef); + clearedRef = (ObjectReference) referenceQueue.poll(); + } + + if (o == null) + return Integer.MIN_VALUE; + + ObjectReference ref = new ObjectReference(o, referenceQueue); + if (identityMap.containsKey(ref)) { + return identityMap.get(ref); + } else { + if (nextIdentity == Integer.MAX_VALUE) + throw new IllegalStateException(); + final int identity = nextIdentity++; + identityMap.put(ref, identity); + return identity; + } + } + + private static class ObjectReference extends WeakReference { + private final int hashCode; + + ObjectReference(Object referent, ReferenceQueue queue) { + super(referent, queue); + hashCode = referent.hashCode(); + } + + /** {@inheritDoc} */ + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (o instanceof ObjectReference) { + ObjectReference other = (ObjectReference) o; + return other.get() == get(); + } else { + return false; + } + } + + /** {@inheritDoc} */ + @Override + public int hashCode() { + return hashCode; + } + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/RESTMBeanServerConnection.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/RESTMBeanServerConnection.java new file mode 100755 index 00000000000..a27e79f483a --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/RESTMBeanServerConnection.java @@ -0,0 +1,2465 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.ConnectException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.channels.ClosedByInterruptException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.Attribute; +import javax.management.AttributeList; +import javax.management.AttributeNotFoundException; +import javax.management.InstanceAlreadyExistsException; +import javax.management.InstanceNotFoundException; +import javax.management.IntrospectionException; +import javax.management.InvalidAttributeValueException; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanException; +import javax.management.MBeanInfo; +import javax.management.MBeanRegistrationException; +import javax.management.MBeanServerConnection; +import javax.management.NotCompliantMBeanException; +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; +import javax.management.ObjectInstance; +import javax.management.ObjectName; +import javax.management.QueryExp; +import javax.management.ReflectionException; +import javax.management.RuntimeMBeanException; +import javax.management.RuntimeOperationsException; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSession; + +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.ws.jmx.connector.client.rest.internal.ClientConstants.HttpMethod; +import com.ibm.ws.jmx.connector.client.rest.internal.NotificationRegistry.ClientNotificationRegistration; +import com.ibm.ws.jmx.connector.client.rest.internal.resources.RESTClientMessagesUtil; +import com.ibm.ws.jmx.connector.converter.JSONConverter; +import com.ibm.ws.jmx.connector.converter.NotificationRecord; +import com.ibm.ws.jmx.connector.datatypes.CreateMBean; +import com.ibm.ws.jmx.connector.datatypes.Invocation; +import com.ibm.ws.jmx.connector.datatypes.JMXServerInfo; +import com.ibm.ws.jmx.connector.datatypes.MBeanInfoWrapper; +import com.ibm.ws.jmx.connector.datatypes.MBeanQuery; +import com.ibm.ws.jmx.connector.datatypes.ObjectInstanceWrapper; + +/** + * This class is implemented such that it should be thread-safe. + */ +class RESTMBeanServerConnection implements MBeanServerConnection { + + private static final Logger logger = Logger.getLogger(RESTMBeanServerConnection.class.getName()); + + protected static final String CLIENT_VERSION = "IBM_JMX_REST_client_v5"; + + public enum PollingMode { + FAILOVER, NOTIFICATION + }; + + private static final long NANOS_IN_A_MILLISECOND = 1000000L; + + private final AtomicBoolean isRecoveringConnection = new AtomicBoolean(); + + private ServerPollingThread serverPollingThread; + + protected final Connector connector; + private volatile boolean disconnected = false; + protected int serverVersion; + private final DynamicURL rootURL; + private DynamicURL mbeansURL, createMBeanURL, instanceOfURL, mbeanCountURL, defaultDomainURL, domainsURL, notificationsURL, fileTransferURL; + private final ConcurrentMap mbeanInfoURLMap; + private final ConcurrentMap mbeanAttributesURLMap; + private final ConcurrentMap> mbeanAttributeURLsMap; + private final ConcurrentMap> mbeanOperationURLsMap; + private final FileTransferClient fileTransferClient; + + private NotificationRegistry notificationRegistry; + + protected final HostnameVerifier hostnameVerificationDisabler; + + protected Map mapRouting = null; + + static { + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Void run() { + String oldValue = System.getProperty("sun.net.http.retryPost"); + + if (oldValue != null) { + if (logger.isLoggable(Level.INFO)) { + logger.logp(Level.INFO, logger.getName(), "StaticBlock[1]", "Value of retry post was already set: " + oldValue); + } + } else { + //Set the value on the client-side to prevent the JDK from retrying invocations. + System.setProperty("sun.net.http.retryPost", "false"); + } + + return null; + } + }); + } + + RESTMBeanServerConnection(Connector connector) throws IOException { + this.connector = connector; + + rootURL = new DynamicURL(connector, connector.getServiceURL().getURLPath()); + + // Set up HostnameVerifier to allow all host names if hostname verification is disabled + if (connector.isHostnameVerificationDisabled()) { + hostnameVerificationDisabler = new HostnameVerifier() { + + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + hostnameVerificationDisabler = null; + } + + //First we need set our initial endpoint + findInitialEndpoint(); + + // Load JMX server info to verify server is reachable + try { + loadJMXServerInfo(); + } catch (IOException e) { + //If we got an IOException for the server being down, we will have tried a recovery + //and then either we have a valid endpoint or the connector will have been automatically + //disconnected. So, if the connector is still connected, we can try 1 more time to connect + if (isConnected()) { + loadJMXServerInfo(); + } else { + throw e; + } + } + + mbeanInfoURLMap = new ConcurrentHashMap(); + mbeanAttributesURLMap = new ConcurrentHashMap(); + mbeanAttributeURLsMap = new ConcurrentHashMap>(); + mbeanOperationURLsMap = new ConcurrentHashMap>(); + fileTransferClient = new FileTransferClient(this); + + //Unless the user asked for fail interval polling to be off (by specifying a negative value), we start the thread. + if (connector.getServerFailoverInterval() >= 0) { + setPollingMode(PollingMode.FAILOVER); + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "constructor", "Initiated connector " + RESTClientMessagesUtil.getObjID(this) + " within connection: " + + connector.getConnectionId()); + } + if (connector.logFailovers()) { + String connectMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.MEMBER_CONNECT, connector.getCurrentEndpoint()); + logger.logp(Level.INFO, logger.getName(), "constructor", connectMsg); + } + } + + //Lazy initialization of NotificationRegistry + private NotificationRegistry getNotificationRegistry() throws IOException { + if (notificationRegistry == null) { + notificationRegistry = new NotificationRegistry(this); + } + return notificationRegistry; + } + + protected void setPollingMode(PollingMode mode) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "setPollingMode", "Entering setPollingMode with new mode " + mode.toString()); + } + + if (serverPollingThread != null) { + serverPollingThread.changeMode(mode); + } else { + serverPollingThread = new ServerPollingThread(mode); + serverPollingThread.start(); + } + } + + protected void discardNotificationRegistry() { + if (connector.getServerFailoverInterval() >= 0) { + setPollingMode(PollingMode.FAILOVER); + } else { + //if the user doesn't want to go into FAILOVER mode, then we're done + //with this thread for now + closePollingThread(); + } + notificationRegistry.close(); + notificationRegistry = null; + } + + private void loadJMXServerInfo() throws IOException { + final String sourceMethod = "loadJMXServerInfo"; + checkConnection(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, "Loading server info for endpoint: " + connector.getCurrentEndpoint()); + } + URL rootURL = null; + HttpsURLConnection connection = null; + try { + // Get JMX server info URL + rootURL = getRootURL(); + + // Get connection to server + connection = getConnection(rootURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, rootURL); + } + + JMXServerInfo jmx = null; + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce, true); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a JMXServerInfo + jmx = converter.readJMX(connection.getInputStream()); + break; + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, rootURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + Throwable t = getServerThrowable(sourceMethod, connection); + IOException ioe = t instanceof IOException ? (IOException) t : new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + throw ioe; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException io = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(io, true); + throw io; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + + serverVersion = jmx.version; + mbeansURL = new DynamicURL(connector, jmx.mbeansURL); + createMBeanURL = new DynamicURL(connector, jmx.createMBeanURL); + instanceOfURL = new DynamicURL(connector, jmx.instanceOfURL); + mbeanCountURL = new DynamicURL(connector, jmx.mbeanCountURL); + defaultDomainURL = new DynamicURL(connector, jmx.defaultDomainURL); + domainsURL = new DynamicURL(connector, jmx.domainsURL); + notificationsURL = new DynamicURL(connector, jmx.notificationsURL); + fileTransferURL = new DynamicURL(connector, jmx.fileTransferURL); + } + + /** {@inheritDoc} */ + @Override + public ObjectInstance createMBean(String className, + ObjectName name) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException { + try { + return createMBean(className, name, null, null, null, false, false); + } catch (InstanceNotFoundException inf) { + throw new IOException(inf); // Should never happen + } + } + + /** {@inheritDoc} */ + @Override + public ObjectInstance createMBean(String className, ObjectName name, + ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException { + return createMBean(className, name, loaderName, null, null, true, false); + } + + /** {@inheritDoc} */ + @Override + public ObjectInstance createMBean(String className, ObjectName name, Object[] params, + String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException { + try { + return createMBean(className, name, null, params, signature, false, true); + } catch (InstanceNotFoundException inf) { + throw new IOException(inf); // Should never happen + } + } + + /** {@inheritDoc} */ + @Override + public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, + String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException { + return createMBean(className, name, loaderName, params, signature, true, true); + } + + private ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature, boolean useLoader, + boolean useSignature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException { + final String sourceMethod = "createMBean"; + checkConnection(); + if (className == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.CLASS_NAME_NULL))); + else if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name))); + + URL createURL = null; + HttpsURLConnection connection = null; + JSONConverter converter = JSONConverter.getConverter(); + try { + // Get URL for creating MBeans + createURL = getCreateMBeanURL(); + + // Get connection to server + connection = getConnection(createURL, HttpMethod.POST); + + // Create CreateMBean object + CreateMBean createMBean = new CreateMBean(); + createMBean.className = className; + createMBean.objectName = name; + createMBean.loaderName = loaderName; + createMBean.params = params; + createMBean.signature = signature; + createMBean.useLoader = useLoader; + createMBean.useSignature = useSignature; + + // Write CreateMBean JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeCreateMBean(output, createMBean); + output.flush(); + output.close(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, createURL); + } finally { + JSONConverter.returnConverter(converter); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be an ObjectInstanceWrapper + ObjectInstanceWrapper wrapper = converter.readObjectInstance(connection.getInputStream()); + mbeanInfoURLMap.put(wrapper.objectInstance.getObjectName(), new DynamicURL(connector, wrapper.mbeanInfoURL)); + return wrapper.objectInstance; + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, createURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (RuntimeOperationsException roe) { + throw roe; + } catch (ReflectionException re) { + throw re; + } catch (InstanceAlreadyExistsException iae) { + throw iae; + } catch (MBeanRegistrationException mbr) { + throw mbr; + } catch (MBeanException me) { + throw me; + } catch (RuntimeMBeanException rme) { + throw rme; + } catch (NotCompliantMBeanException ncm) { + throw ncm; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException, IOException { + final String sourceMethod = "unregisterMBean"; + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + + URL mbeanURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for MBean + mbeanURL = getMBeanURL(name); + + // Get connection to server + connection = getConnection(mbeanURL, HttpMethod.DELETE); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, mbeanURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + // Clean up cached URLs + purgeMBeanURLs(name); + return; + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (MBeanRegistrationException mbr) { + throw mbr; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException, IOException { + checkConnection(); + if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + + @SuppressWarnings("unchecked") + Set results = queryMBeans(name, null, null, true); + + if (results.size() == 1) + return results.toArray(new ObjectInstance[1])[0]; + else + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + } + + @SuppressWarnings("unchecked") + private Set queryMBeans(ObjectName name, QueryExp query, String className, boolean objectInstance) throws IOException { + final String sourceMethod = "queryMBeans"; + final boolean usePOST = query != null; + + URL baseMBeansURL = null; + URL mbeansURL = null; + HttpsURLConnection connection = null; + JSONConverter converter = JSONConverter.getConverter(); + try { + // Get URL for MBeans + baseMBeansURL = getMBeansURL(); + mbeansURL = usePOST ? baseMBeansURL : getMBeansURL(name, className); + + // Get connection to server + connection = getConnection(mbeansURL, usePOST ? HttpMethod.POST : HttpMethod.GET); + + if (usePOST) { + // Create MBeanQuery object + MBeanQuery mbeanQuery = new MBeanQuery(); + mbeanQuery.objectName = name; + mbeanQuery.queryExp = query; + mbeanQuery.className = className; + + // Write MBeanQuery JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeMBeanQuery(output, mbeanQuery); + output.flush(); + output.close(); + } + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, mbeansURL); + } finally { + JSONConverter.returnConverter(converter); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a Set of ObjectInstanceWrapper + ObjectInstanceWrapper[] wrappers = converter.readObjectInstances(connection.getInputStream()); + Set mbeans = new HashSet(wrappers.length); + Map tempMBeanInfoURLMap = new HashMap(wrappers.length); + for (ObjectInstanceWrapper wrapper : wrappers) { + tempMBeanInfoURLMap.put(wrapper.objectInstance.getObjectName(), wrapper.mbeanInfoURL); + if (objectInstance) + mbeans.add(wrapper.objectInstance); + else + mbeans.add(wrapper.objectInstance.getObjectName()); + } + + processMBeanInfoURLs(tempMBeanInfoURLMap, getMBeansURL().getPath(), name == null && query == null && className == null); + + return mbeans; + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, mbeansURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + Throwable t = getServerThrowable(sourceMethod, connection); + IOException ioe = t instanceof IOException ? (IOException) t : new IOException(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE, t); + throw ioe; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException io = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(io); + throw io; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override + public Set queryMBeans(ObjectName name, QueryExp query) throws IOException { + checkConnection(); + return queryMBeans(name, query, null, true); + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override + public Set queryNames(ObjectName name, QueryExp query) throws IOException { + checkConnection(); + return queryMBeans(name, query, null, false); + } + + /** {@inheritDoc} */ + @Override + public boolean isRegistered(ObjectName name) throws IOException { + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + return false; + + @SuppressWarnings("unchecked") + Set results = queryMBeans(name, null, null, true); + return results.size() == 1; + } + + /** {@inheritDoc} */ + @Override + public Integer getMBeanCount() throws IOException { + final String sourceMethod = "getMBeanCount"; + checkConnection(); + + URL mbeanCountURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for MBean count + mbeanCountURL = getMBeanCountURL(); + + // Get connection to server + connection = getConnection(mbeanCountURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, mbeanCountURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response + return converter.readInt(connection.getInputStream()); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, mbeanCountURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + Throwable t = getServerThrowable(sourceMethod, connection); + IOException ioe = t instanceof IOException ? (IOException) t : new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + throw ioe; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException io = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(io); + throw io; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + + } + } + + /** {@inheritDoc} */ + @Override + public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, IOException { + final String sourceMethod = "getAttribute"; + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + else if (attribute == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_NAME_NULL))); + + URL attributeURL; + + try { + // Get URL for attribute + attributeURL = getAttributeURL(name, attribute); + + } catch (IntrospectionException intro) { + throw getRequestErrorException(sourceMethod, intro); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io); + } + + HttpsURLConnection connection; + try { + connection = getConnection(attributeURL, HttpMethod.GET); // Get connection to server + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributeURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a POJO + return converter.readPOJO(connection.getInputStream()); + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, attributeURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (MBeanException me) { + throw me; + } catch (AttributeNotFoundException anf) { + throw anf; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException, IOException { + final String sourceMethod = "getAttributes"; + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + else if (attributes == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_NAMES_NULL))); + + URL attributesURL; + try { + // Get URL for attributes + attributesURL = getAttributesURL(name, attributes); + } catch (IntrospectionException intro) { + throw getRequestErrorException(sourceMethod, intro); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io); + } + + HttpsURLConnection connection; + + try { + // Get connection to server + connection = getConnection(attributesURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributesURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be an AttributeList + return converter.readAttributeList(connection.getInputStream()); + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, attributesURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public void setAttribute(ObjectName name, + Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException, IOException { + final String sourceMethod = "setAttribute"; + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + else if (attribute == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_NULL))); + + URL attributeURL; + HttpsURLConnection connection; + JSONConverter converter = JSONConverter.getConverter(); + try { + // Get URL for attribute + attributeURL = getAttributeURL(name, attribute.getName()); + } catch (ConnectException ce) { + // Server is down; not a client bug + throw ce; + } catch (IntrospectionException intro) { + getRequestErrorException(sourceMethod, intro); + throw new IOException(intro); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io); + } finally { + JSONConverter.returnConverter(converter); + } + + try { + + // Get connection to server + connection = getConnection(attributeURL, HttpMethod.PUT); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributeURL); + } finally { + JSONConverter.returnConverter(converter); + } + + try { + // Write Invocation JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writePOJO(output, attribute.getValue()); + output.flush(); + output.close(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributeURL); + } finally { + JSONConverter.returnConverter(converter); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + switch (responseCode) { + case HttpURLConnection.HTTP_NO_CONTENT: + // No content expected + return; + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (MBeanException me) { + throw me; + } catch (RuntimeMBeanException rme) { + throw rme; + } catch (AttributeNotFoundException anf) { + throw anf; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (InvalidAttributeValueException iav) { + throw iav; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + + } + + /** {@inheritDoc} */ + @Override + public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException, IOException { + final String sourceMethod = "setAttributes"; + checkConnection(); + if (name == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); + else if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + else if (attributes == null) + throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_LIST_NULL))); + + URL attributesURL; + HttpsURLConnection connection; + JSONConverter converter = JSONConverter.getConverter(); + try { + // Get URL for attributes + attributesURL = getAttributesURL(name); + } catch (ConnectException ce) { + // Server is down; not a client bug + throw ce; + } catch (IntrospectionException intro) { + throw getRequestErrorException(sourceMethod, intro); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io); + } finally { + JSONConverter.returnConverter(converter); + } + + try { + + // Get connection to server + connection = getConnection(attributesURL, HttpMethod.POST); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributesURL); + } finally { + JSONConverter.returnConverter(converter); + } + try { + // Write Invocation JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeAttributeList(output, attributes); + output.flush(); + output.close(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, attributesURL); + } finally { + JSONConverter.returnConverter(converter); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be an AttributeList + return converter.readAttributeList(connection.getInputStream()); + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, attributesURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public Object invoke(ObjectName name, String operationName, Object[] params, + String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException, IOException { + final String sourceMethod = "invoke"; + + try { + //Look for routing MBean + if (ClientProvider.CONNECTION_ROUTING_NAME.equals(name.getKeyProperty("name")) && + ClientProvider.CONNECTION_ROUTING_DOMAIN.equals(name.getDomain())) { + + //Handle server-level routing + if (ClientProvider.CONNECTION_ROUTING_OPERATION_ASSIGN_SERVER.equals(operationName)) { + if (params.length == 3) { + //routing at server level + this.mapRouting = new HashMap(); + this.mapRouting.put(ClientProvider.ROUTING_KEY_HOST_NAME, params[0]); + this.mapRouting.put(ClientProvider.ROUTING_KEY_SERVER_USER_DIR, params[1]); + this.mapRouting.put(ClientProvider.ROUTING_KEY_SERVER_NAME, params[2]); + return Boolean.TRUE; + } + + //Handle host-level routing + } else if (ClientProvider.CONNECTION_ROUTING_OPERATION_ASSIGN_HOST.equals(operationName)) { + if (params.length == 1) { + //routing at host level + this.mapRouting = new HashMap(); + this.mapRouting.put(ClientProvider.ROUTING_KEY_HOST_NAME, params[0]); + return Boolean.TRUE; + } + } + } + + } catch (Exception e) { + throw new MBeanException(e); + } + + checkConnection(); + + //Special handling for file transfer MBean invocations + if (ClientProvider.FILE_TRANSFER_NAME.equals(name.getKeyProperty("name")) && + ClientProvider.FILE_TRANSFER_DOMAIN.equals(name.getDomain())) { + return fileTransferClient.handleOperation(operationName, params); + } + + URL invokeURL = null; + HttpsURLConnection connection = null; + JSONConverter converter = JSONConverter.getConverter(); + try { + // Get URL for invoke operation + invokeURL = getOperationURL(name, operationName); + + // Get connection to server + connection = getConnection(invokeURL, HttpMethod.POST); + + // Create Invocation object + Invocation invocation = new Invocation(); + invocation.params = params; + invocation.signature = signature; + + // Write Invocation JSON to connection output stream + OutputStream output = connection.getOutputStream(); + converter.writeInvocation(output, invocation); + output.flush(); + output.close(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } catch (IntrospectionException intro) { + throw getRequestErrorException(sourceMethod, intro, invokeURL); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, invokeURL); + } finally { + JSONConverter.returnConverter(converter); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a POJO + return converter.readPOJO(connection.getInputStream()); + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, invokeURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (RuntimeMBeanException rme) { + throw rme; + } catch (MBeanException me) { + throw me; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + IOException e = getResponseCodeErrorException(sourceMethod, responseCode, connection); + throw e; + } + } + + /** {@inheritDoc} */ + @Override + public String getDefaultDomain() throws IOException { + final String sourceMethod = "getDefaultDomain"; + checkConnection(); + + URL defaultDomainURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for default domain + defaultDomainURL = getDefaultDomainURL(); + + // Get connection to server + connection = getConnection(defaultDomainURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, defaultDomainURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response + return converter.readString(connection.getInputStream()); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, defaultDomainURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + Throwable t = getServerThrowable(sourceMethod, connection); + IOException ioe = t instanceof IOException ? (IOException) t : new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + throw ioe; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException io = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(io); + throw io; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public String[] getDomains() throws IOException { + final String sourceMethod = "getDomains"; + checkConnection(); + + URL domainsURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for domains + domainsURL = getDomainsURL(); + + // Get connection to server + connection = getConnection(domainsURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, domainsURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response + return converter.readStringArray(connection.getInputStream()); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, domainsURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + Throwable t = getServerThrowable(sourceMethod, connection); + IOException ioe = t instanceof IOException ? (IOException) t : new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + throw ioe; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException io = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(io); + throw io; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + + } + + /** {@inheritDoc} */ + @Override + public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().addNotificationListener(name, listener, filter, handback); + } + + /** {@inheritDoc} */ + @Override + public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().addNotificationListener(name, listener, filter, handback); + } + + /** {@inheritDoc} */ + @Override + public void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().removeNotificationListener(name, listener); + } + + /** {@inheritDoc} */ + @Override + public void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, + Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().removeNotificationListener(name, listener, filter, handback); + } + + /** {@inheritDoc} */ + @Override + public void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().removeNotificationListener(name, listener); + } + + /** {@inheritDoc} */ + @Override + public void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, + Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException { + checkConnection(); + getNotificationRegistry().removeNotificationListener(name, listener, filter, handback); + } + + /** {@inheritDoc} */ + @Override + public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException { + final String sourceMethod = "getMBeanInfo"; + checkConnection(); + + URL mbeanURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for MBean + mbeanURL = getMBeanURL(name); + + // Get connection to server + connection = getConnection(mbeanURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, mbeanURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be an MBeanInfoWrapper + MBeanInfoWrapper wrapper = converter.readMBeanInfo(connection.getInputStream()); + mbeanAttributesURLMap.put(name, new DynamicURL(connector, wrapper.attributesURL)); + + //Attributes + Map attributeURLsMap = mbeanAttributeURLsMap.get(name); + final boolean updateAttributes = attributeURLsMap != null; + if (!updateAttributes) { + // Create a new Map - this map is used for future requests and must be thread safe + attributeURLsMap = new ConcurrentHashMap(); + } + processAttributeOrOperationURLs(attributeURLsMap, wrapper.attributeURLs, updateAttributes); + + if (!updateAttributes) { + //Another thread might have created/set this Map already and is about to use it, which is why + //we wait until *after* we have a valid Map and are ready to push that in. + mbeanAttributeURLsMap.putIfAbsent(name, attributeURLsMap); + } + + //Operations + Map operationURLsMap = mbeanOperationURLsMap.get(name); + final boolean updateOperations = operationURLsMap != null; + if (!updateOperations) { + // Create a new Map - this map is used for future requests and must be thread safe + operationURLsMap = new ConcurrentHashMap(); + } + processAttributeOrOperationURLs(operationURLsMap, wrapper.operationURLs, updateOperations); + + if (!updateOperations) { + //Another thread might have created/set this Map already and is about to use it, which is why + //we wait until *after* we have a valid Map and are ready to push that in. + mbeanOperationURLsMap.putIfAbsent(name, operationURLsMap); + } + + return wrapper.mbeanInfo; + + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, mbeanURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (IntrospectionException ie) { + throw ie; + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (ReflectionException re) { + throw re; + } catch (IOException io) { + throw io; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } + + /** {@inheritDoc} */ + @Override + public boolean isInstanceOf(ObjectName name, String className) throws InstanceNotFoundException, IOException { + final String sourceMethod = "isInstanceOf"; + checkConnection(); + if (name.isPattern()) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); + + URL instanceOfURL = null; + HttpsURLConnection connection = null; + try { + // Get URL for instanceOf + instanceOfURL = getInstanceOfURL(name, className); + + // Get connection to server + connection = getConnection(instanceOfURL, HttpMethod.GET); + } catch (IOException io) { + throw getRequestErrorException(sourceMethod, io, instanceOfURL); + } + + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (ConnectException ce) { + recoverConnection(ce); + // Server is down; not a client bug + throw ce; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + JSONConverter converter = JSONConverter.getConverter(); + try { + // Process and return server response, which should be a boolean + return converter.readBoolean(connection.getInputStream()); + } catch (Exception e) { + throw getResponseErrorException(sourceMethod, e, instanceOfURL); + } finally { + JSONConverter.returnConverter(converter); + } + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + try { + // Server response should be a serialized Throwable + throw getServerThrowable(sourceMethod, connection); + } catch (ClassNotFoundException cnf) { + throw new IOException(cnf); + } catch (InstanceNotFoundException inf) { + throw inf; + } catch (Throwable t) { + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); + } + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + case HttpURLConnection.HTTP_GONE: + case HttpURLConnection.HTTP_NOT_FOUND: + IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); + recoverConnection(ioe); + throw ioe; + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + + } + + // + // URL Methods + // + + protected URL getRootURL() throws IOException { + return rootURL.getURL(); + } + + private URL getDefaultDomainURL() throws IOException { + return defaultDomainURL.getURL(); + } + + private URL getDomainsURL() throws IOException { + return domainsURL.getURL(); + } + + URL getNotificationsURL() throws IOException { + return notificationsURL.getURL(); + } + + URL getFileTransferURL() throws IOException { + return fileTransferURL.getURL(); + } + + private URL getMBeanCountURL() throws IOException { + return mbeanCountURL.getURL(); + } + + private URL getAttributeURL(ObjectName name, + String attributeName) throws IOException, AttributeNotFoundException, InstanceNotFoundException, IntrospectionException, ReflectionException { + if (!mbeanAttributeURLsMap.containsKey(name)) + getMBeanInfo(name); + if (!mbeanAttributeURLsMap.containsKey(name)) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + else if (!mbeanAttributeURLsMap.get(name).containsKey(attributeName)) + throw new AttributeNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_NOT_FOUND, name, attributeName)); + + return mbeanAttributeURLsMap.get(name).get(attributeName).getURL(); + } + + private URL getAttributesURL(ObjectName name) throws IOException, InstanceNotFoundException, IntrospectionException, ReflectionException { + if (!mbeanAttributesURLMap.containsKey(name)) + getMBeanInfo(name); + if (!mbeanAttributesURLMap.containsKey(name)) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + + return mbeanAttributesURLMap.get(name).getURL(); + } + + private URL getAttributesURL(ObjectName name, String[] attributes) throws IOException, InstanceNotFoundException, IntrospectionException, ReflectionException { + if (attributes != null && attributes.length > 0) { + StringBuilder sb = new StringBuilder(); + final int length = attributes.length; + for (int i = 0; i < length - 1; i++) { + sb.append("attribute="); + sb.append(URLEncoder.encode(attributes[i], "UTF-8")); + sb.append("&"); + } + sb.append("attribute="); + sb.append(URLEncoder.encode(attributes[length - 1], "UTF-8")); + String attributeList = sb.toString(); + return new URL(getAttributesURL(name).toString() + "?" + + attributeList); + } else { + return getAttributesURL(name); + } + } + + private URL getOperationURL(ObjectName name, String operationName) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException { + if (!mbeanOperationURLsMap.containsKey(name)) + getMBeanInfo(name); + if (!mbeanOperationURLsMap.containsKey(name) || !mbeanOperationURLsMap.get(name).containsKey(operationName)) + throw new ReflectionException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OPERATION_NOT_FOUND, name, operationName))); + + return mbeanOperationURLsMap.get(name).get(operationName).getURL(); + } + + private URL getCreateMBeanURL() throws IOException { + return createMBeanURL.getURL(); + } + + private URL getInstanceOfURL() throws IOException { + return instanceOfURL.getURL(); + } + + private URL getInstanceOfURL(ObjectName name, String className) throws IOException { + return new URL(getInstanceOfURL().toString() + "?" + + (name != null ? "objectName=" + URLEncoder.encode(name.getCanonicalName(), "UTF-8") + "&" : "") + + (className != null ? "className=" + URLEncoder.encode(className, "UTF-8") : "")); + } + + private URL getMBeansURL() throws IOException { + return mbeansURL.getURL(); + } + + private URL getMBeansURL(ObjectName name, String instanceOf) throws IOException { + return new URL(getMBeansURL().toString() + "?" + + (name != null ? "objectName=" + URLEncoder.encode(name.getCanonicalName(), "UTF-8") + "&" : "") + + (instanceOf != null ? "className=" + URLEncoder.encode(instanceOf, "UTF-8") : "")); + } + + private URL getMBeanURL(ObjectName name) throws IOException, InstanceNotFoundException { + if (!mbeanInfoURLMap.containsKey(name)) + queryMBeans(name, null, null, true); + if (!mbeanInfoURLMap.containsKey(name)) + throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.INSTANCE_NOT_FOUND, name)); + return mbeanInfoURLMap.get(name).getURL(); + } + + private void purgeMBeanURLs(ObjectName name) { + mbeanInfoURLMap.remove(name); + mbeanAttributesURLMap.remove(name); + mbeanAttributeURLsMap.remove(name); + mbeanOperationURLsMap.remove(name); + } + + private void processAttributeOrOperationURLs(Map destination, Map source, boolean update) { + if (update) { + // Remove any elements that are not present in the new map + Set missingKeys = new HashSet(destination.keySet()); + missingKeys.removeAll(source.keySet()); + for (String missingKey : missingKeys) { + destination.remove(missingKey); + } + } + + for (Map.Entry e : source.entrySet()) { + if (!update || !destination.containsKey(e.getKey()) || + !destination.get(e.getKey()).getName().equals(e.getValue())) { + destination.put(e.getKey(), new DynamicURL(connector, e.getValue())); + } + } + } + + private void processMBeanInfoURLs(Map source, String parentPath, boolean complete) { + if (complete) { + // This is the complete set of MBeanInfo URLs, so remove any elements that are not present in the new map + Set missingKeys = new HashSet(mbeanInfoURLMap.keySet()); + missingKeys.removeAll(source.keySet()); + for (ObjectName missingKey : missingKeys) { + purgeMBeanURLs(missingKey); + } + } + + for (Map.Entry e : source.entrySet()) { + if (!mbeanInfoURLMap.containsKey(e.getKey()) || + !mbeanInfoURLMap.get(e.getKey()).getName().equals(e.getValue())) { + // if updating the MBeanInfo URL (because new URL did not match), other maps are now invalid, + // so purge before re-adding + if (mbeanInfoURLMap.containsKey(e.getKey())) + purgeMBeanURLs(e.getKey()); + mbeanInfoURLMap.put(e.getKey(), new DynamicURL(connector, e.getValue())); + } + } + } + + // + // Exception Message and Logging Methods + // + + synchronized void logSevereException(String sourceMethod, String errorMsg, Exception e) { + logger.logp(Level.SEVERE, logger.getName(), sourceMethod, errorMsg, e); + } + + synchronized IOException getRequestErrorException(String sourceMethod, Exception e, URL url) { + String urlString = (url != null) ? url.toString() : "null"; + String connectionId = connector.getConnectionId(); + String errorMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.REQUEST_ERROR, + urlString, connectionId); + logger.logp(Level.SEVERE, logger.getName(), sourceMethod, errorMsg, e); + return new IOException(errorMsg, e); + } + + synchronized IOException getRequestErrorException(String sourceMethod, Exception e) { + String connectionId = connector.getConnectionId(); + String errorMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.REQUEST_ERROR, + null, connectionId); + logger.logp(Level.SEVERE, logger.getName(), sourceMethod, errorMsg, e); + return new IOException(errorMsg, e); + } + + synchronized IOException getResponseErrorException(String sourceMethod, Exception e, URL url) { + String urlString = (url != null) ? url.toString() : "null"; + String connectionId = connector.getConnectionId(); + String errorMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.RESPONSE_ERROR, + urlString, connectionId); + logger.logp(Level.SEVERE, logger.getName(), sourceMethod, errorMsg, e); + return new IOException(errorMsg, e); + } + + synchronized IOException getResponseCodeErrorException(String methodName, int responseCode, HttpsURLConnection connection) { + // Did not understand response code; create an IOException with response message and log error + String responseMessage = null; + try { + responseMessage = connection.getResponseMessage(); + } catch (IOException io) { + // Use null for message + } + String errorMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.RESPONSE_CODE_ERROR, + responseCode, responseMessage, + connection.getURL().toString(), + connector.getConnectionId()); + logger.logp(Level.SEVERE, logger.getName(), methodName, errorMsg); + return new IOException(errorMsg); + } + + synchronized Throwable getServerThrowable(String methodName, HttpsURLConnection connection) { + Throwable t; + JSONConverter converter = JSONConverter.getConverter(); + try { + t = converter.readThrowable(connection.getErrorStream()); + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; no need to log this case + t = new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_THROWABLE_EXCEPTION), cnf); + } catch (Exception e) { + t = getResponseErrorException(methodName, e, connection.getURL()); + } finally { + JSONConverter.returnConverter(converter); + } + + return t; + } + + IOException getBadCredentialsException(int responseCode, HttpsURLConnection connection) { + // Received response code 401 or 403; problem with credentials + String responseMessage = null; + try { + responseMessage = connection.getResponseMessage(); + } catch (IOException io) { + // Use null for message + } + return new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.BAD_USER_CREDENTIALS, responseCode, responseMessage)); + } + + // -- Connection methods + + // When the connection normally closes, we disconnect after we have finished closing everything, to give everyone a chance to + //do the proper cleaning procedures. + void close() { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "close", "Close called for " + RESTClientMessagesUtil.getObjID(this) + " within connection: " + + connector.getConnectionId()); + } + + closePollingThread(); + + if (notificationRegistry != null) { + notificationRegistry.close(); + } + + if (connector.logFailovers()) { + String disconnectMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.MEMBER_DISCONNECT, connector.getCurrentEndpoint()); + logger.logp(Level.INFO, logger.getName(), "close", disconnectMsg); + } + + disconnect(); + } + + private void closePollingThread() { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "closePollingThread", "Closing thread: " + serverPollingThread.getCustomId()); + } + if (serverPollingThread != null) { + serverPollingThread.interrupt(); + + try { + serverPollingThread.join(2000); + } catch (InterruptedException e) { + //ignore..but we really shouldn't be interrupted by anybody else + } finally { + serverPollingThread = null; + } + } + } + + //When the connection fails we disconnect right away to keep anything else from happening (ie: bad connection) + synchronized void connectionFailed(Throwable t) { + if (!isConnected()) { + //another thread already disconnected this connector, so return + return; + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "connectionFailed", "Connection failed: " + RESTClientMessagesUtil.getObjID(this)); + } + + disconnect(); + + if (notificationRegistry != null) { + notificationRegistry.close(); + } + + //Emit the notification + connector.connectionFailed(t); + } + + private void disconnect() { + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "disconnect", "Disconnect called for " + RESTClientMessagesUtil.getObjID(this)); + } + this.disconnected = true; + } + + boolean isConnected() { + return !disconnected; + } + + private void checkConnection() throws IOException { + if (!isConnected()) + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.NOT_CONNECTED)); + } + + HttpsURLConnection getBasicConnection(URL url, HttpMethod method) throws IOException { + HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + connection.setDoInput(true); + connection.setDoOutput(method == HttpMethod.POST || method == HttpMethod.PUT); + connection.setUseCaches(false); + connection.setRequestMethod(method.toString()); + connection.setRequestProperty("Content-Type", ClientConstants.JSON_MIME_TYPE); + connection.setReadTimeout(connector.getReadTimeout()); + // Only add the Authorization header if we have one to add. It may + // not be present in certain flows, such as the certificate-based + // authentication. + if (connector.getBasicAuthHeader() != null) { + connection.setRequestProperty("Authorization", connector.getBasicAuthHeader()); + } + if (connector.isHostnameVerificationDisabled()) + connection.setHostnameVerifier(hostnameVerificationDisabler); + if (this.connector.getCustomSSLSocketFactory() != null) { + connection.setSSLSocketFactory(this.connector.getCustomSSLSocketFactory()); + } + + connection.setRequestProperty("User-Agent", CLIENT_VERSION); + + return connection; + } + + Connector getConnector() { + return connector; + } + + protected boolean isServerLevelRouting() { + + if ((mapRouting != null && mapRouting.size() == 3 && + isValueSet((String) mapRouting.get(ClientProvider.ROUTING_KEY_HOST_NAME)) && isValueSet((String) mapRouting.get(ClientProvider.ROUTING_KEY_SERVER_NAME)) + && isValueSet((String) mapRouting.get(ClientProvider.ROUTING_KEY_SERVER_USER_DIR)))) { + return true; + } else { + return false; + } + } + + protected boolean isHostLevelRouting() { + if ((mapRouting != null && mapRouting.size() == 1 && isValueSet((String) mapRouting.get(ClientProvider.ROUTING_KEY_HOST_NAME)))) { + return true; + } else { + return false; + } + } + + /** + * Checks if a value is null or empty. + * + * @param s The variable need to be checked. + * @return if the variable is not null and not empty. Otherwise return false. + */ + public boolean isValueSet(String s) { + return (s != null && s.trim().isEmpty() == false) ? true : false; + } + + HttpsURLConnection getConnection(URL originalUrl, HttpMethod method) throws IOException { + return getConnection(originalUrl, method, false); + } + + HttpsURLConnection getConnection(URL originalUrl, HttpMethod method, boolean ignoreProxy) throws IOException { + return getConnection(originalUrl, method, ignoreProxy, null); + } + + HttpsURLConnection getConnection(URL originalUrl, HttpMethod method, boolean ignoreProxy, Map routingInfo) throws IOException { + URL url = originalUrl; + String sURL = originalUrl.toString(); + + //For MBean routing we only care about server level routing, so that's our proxy mode. Other users/extenders of this class, + //such as file transfer, might also check for host level routing. + final boolean inProxyMode = !ignoreProxy && isServerLevelRouting(); + if (inProxyMode && sURL.indexOf(ClientConstants.ROUTER_URI) < 0) { + //If we're talking to a server that has a version at or greater than 4, then we don't need the /router URL. + final String asURL = serverVersion >= 4 ? sURL : sURL.replaceFirst(ClientConstants.CONNECTOR_URI, ClientConstants.ROUTER_URI); + try { + url = AccessController.doPrivileged( + new PrivilegedExceptionAction() { + @Override + public URL run() throws MalformedURLException { + return new URL(asURL); + } + }); + } catch (PrivilegedActionException e) { + throw new IOException(e.getMessage()); + } + + } + HttpsURLConnection connection = getBasicConnection(url, method); + // If routing info is explicitly provided to this method always set the request properties with the routing information. + if (inProxyMode || routingInfo != null) { + // Use the MBeanServerConnection's current routing context if routing info wasn't explicitly provided to this method. + if (routingInfo == null) { + routingInfo = mapRouting; + } + connection.addRequestProperty(ClientProvider.ROUTING_KEY_HOST_NAME, (String) routingInfo.get(ClientProvider.ROUTING_KEY_HOST_NAME)); + connection.addRequestProperty(ClientProvider.ROUTING_KEY_SERVER_USER_DIR, (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_USER_DIR)); + connection.addRequestProperty(ClientProvider.ROUTING_KEY_SERVER_NAME, (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_NAME)); + if (inProxyMode) { + connection.addRequestProperty(ClientProvider.READ_TIMEOUT, String.valueOf(connector.getReadTimeout())); + } + } + return connection; + } + + /** + * Attemps to recover the connection, either to the current endpoint or to other endpoints, depending + * on the configuration of this connector and availability of endpoints. + * + * If we cannot connect to any of the available endpoints, this method will disconnect the connector and any subsequent call + * attempts will throw exceptions. If we can connect to a new endpoint, or recover the connection to our old endpoint, then + * the notification area and all URLs will be setup to use the connected endpoint. + * + * Appropriate JMXConnector-level notifications are sent for all events. + * + * @param t represents the exception that led us in here, or null. + */ + protected void recoverConnection(Throwable t) { + recoverConnection(t, false); + } + + protected void recoverConnection(Throwable t, boolean skipCurrentEndpoint) { + final String methodName = "recoverConnection"; + + //We don't want to synchronize this method because we don't want a pile of threads + //to queue up waiting to come in, each doing the same connection recovery. Instead, we + //use an atomic boolean to guard entry so that only 1 thread does the actual recovery. + if (!isRecoveringConnection.compareAndSet(false, true)) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Exiting. Another thread is doing the recovery"); + } + + //another thread is currently trying to recover the connection, so we can exit. + return; + } + + //We wrap the entire code below in a try{} so that we're sure to reset the isRecoveringConnection value. + try { + + if (!isConnected()) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Connection has been closed."); + } + //the connection has been closed + return; + } + + //The first thing we do is emit the notification that we have temporarily lost connection + connector.connectionTemporarilyLost(t); + + //Get the current endpoint + final String originalEndpoint = connector.getCurrentEndpoint(); + + //Try to re-connect to the current endpoint first. This is to keep the same behaviour for non-WLM scenarios, where there is + //only 1 endpoint and the user may have configured an amount of time that they want to wait for that server to be up. For WLM + //scenarios, users can set this time to 0 so that we don't retry the current endpoint and instead move onto the other endpoints + //right away. Alternatively, WLM users can set this time to be > 0 so that they retry the current endpoint first, if they wish. + + final int maxServerRestartTime = connector.getMaxServerWaitTime(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "[" + RESTClientMessagesUtil.getObjID(this) + "] Waiting for current endpoint [" + originalEndpoint + + "] to come up. Max time: " + + maxServerRestartTime); + } + + if (!skipCurrentEndpoint && maxServerRestartTime > 0) { + final int serverStatusPollingInterval = connector.getServerStatusPollingInterval(); + final long endTime = System.nanoTime() + maxServerRestartTime * NANOS_IN_A_MILLISECOND; + + while (System.nanoTime() < endTime) { + // Try to set up new NotificationArea, re-register notifications if successful + try { + if (testConnection(originalEndpoint)) { + //Our notification registry will be null if we came into recovery mode during the connector's init + if (notificationRegistry == null) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Returning sucessfully. No notification to recover."); + } + //We still need to send the connection restored + connector.connectionRestored(null); + return; + } + notificationRegistry.setupNotificationArea(); + if (notificationRegistry.restoreNotificationRegistrations(true)) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Returning sucessfully, notification restored for current endpoint."); + } + return; + } + } + } catch (Throwable throwable) { + // ignore and try again + } + long currentTime = System.nanoTime(); + if (currentTime < endTime) { + try { + long millisToWait = (endTime - currentTime + (NANOS_IN_A_MILLISECOND - 1)) / NANOS_IN_A_MILLISECOND; // round up - to avoid 0 + Thread.sleep(Math.min(millisToWait, serverStatusPollingInterval)); + } catch (InterruptedException ie) { + // Connection being closed; return false so thread exits + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Returning false, interrupted:" + ie); + } + //disconnect (this will also emit a FAILED notification) + connectionFailed(t); + return; + } + } + } + } + + //Get the full list of endpoints. + List endpoints = connector.getEndpointList(); + + for (String endpoint : endpoints) { + //we already tried the original endpoint, so skip that one. + if (endpoint.equals(originalEndpoint)) { + continue; + } + + if (testConnection(endpoint)) { + //Set our tentative new endpoint so we can attempt to setup notifications. + //If this fails we don't need to worry about re-instating the old endpoint because we + //will either override that value with another endpoint further down the list, or if none are + //available we will fail the entire connection. + connector.setCurrentEndpoint(endpoint); + + try { + + if (notificationRegistry == null) { + //haven't setup the notification thread yet + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Returning sucessfully."); + } + //NOTE: we don't emit an OPEN notification because we're in the connector' initialization process, + //which will already emit an OPEN notification. + return; + } + + //Setup notification area on the new endpoint + notificationRegistry.setupNotificationArea(); + + //restore notifications (don't send restored notification, since we're actually using a new endpoint) + if (notificationRegistry.restoreNotificationRegistrations(false)) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), methodName, "Returning sucessfully, notification restored."); + } + + //everything is ready to go, so emit OPENED notification + connector.connectionOpened(); + + //Re-load the server info because it could have changed (ie: server version, URLs) + loadJMXServerInfo(); + + if (connector.logFailovers()) { + String connectMsg = RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.MEMBER_CONNECT, endpoint); + logger.logp(Level.INFO, logger.getName(), methodName, connectMsg); + } + + return; + } + //could not restore notifications, so try next endpoint + continue; + } catch (Throwable e) { + //ignore and try next endpoint + continue; + } + } + } + + //disconnect (this will also emit a FAILED notification) + connectionFailed(t); + + return; + } finally { + //we're done with the recovery (either by return or by runtime exceptions), so restore atomic state + isRecoveringConnection.set(false); + } + } + + private void findInitialEndpoint() throws IOException { + //Get the full list of endpoints. + List endpoints = connector.getEndpointList(); + String connectMsg; + + if (endpoints != null) { + if (endpoints.size() == 1) { + connector.setCurrentEndpoint(endpoints.get(0)); + return; + } + + for (String endpoint : endpoints) { + if (testConnection(endpoint)) { + connector.setCurrentEndpoint(endpoint); + return; + } + } + } + + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.NO_AVAILABLE_ENDPOINTS)); + } + + private URL getSimpleURL(String endpoint) throws MalformedURLException { + String[] endpointSegments = splitEndpoint(endpoint); + return new URL("https", endpointSegments[0], Integer.valueOf(endpointSegments[1]), "/IBMJMXConnectorREST/mbeanServer"); + } + + private boolean testConnection(String endpoint) { + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), "testConnection", "Testing connection for endpoint " + endpoint); + } + + //Build our test URL + URL testURL = null; + try { + //Make the most simple URL available on the server side + testURL = getSimpleURL(endpoint); + } catch (Exception e) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "testConnection", "Failed while making URL:" + e.getMessage()); + } + //Very unlikely to fail here, but return false if it happens + return false; + } + + //Try to connect to the simple URL + try { + HttpsURLConnection connection = getBasicConnection(testURL, HttpMethod.GET); + final int responseCode = connection.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "testConnection", "Successful!"); + } + return true; + } + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "testConnection", "Failed connection attempt with response code:" + responseCode); + } + return false; + + } catch (IOException e) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "testConnection", "Failed connection attempt with exception:" + e.getMessage()); + } + return false; + } + + } + + public class ServerPollingThread extends Thread { + + /** + * The current polling mode we're in. Failover vs Notification. + */ + private PollingMode mode = null; + + /** + * The amount of time this thread waits betweeen server polls. Needs + * to be volatile because other threads will trigger a change to this value. + * The actual wait interval will be directly related to the polling mode we're in. + */ + private volatile long waitInterval = 0; + + /** + * Flag used to synchronize stand-by operations + */ + private final Object waitFlag = new PollingWaitFlag(); + + /** + * Inner class to use for the standby-lock (as suggested by findbugs) + */ + private class PollingWaitFlag {} + + //Constructor + private ServerPollingThread(PollingMode mode) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "ServerPollingThread", "Created thread: " + getCustomId()); + } + // polling thread should be run as a daemon by default + setDaemon(true); + setName("JMX-REST-Client-Polling"); + changeMode(mode); + } + + public String getCustomId() { + return "ThreadID[" + this.getId() + "], from [" + connector.getConnectionId() + "]"; + } + + //This method gets called by the RESTMBeanServerConnection when certain events occur + protected void changeMode(PollingMode newMode) { + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "changeMode", "Changing mode from " + mode + " to " + newMode + " in thread: " + getCustomId()); + } + + //Only take action if we're changing polling mode + if (mode != newMode) { + synchronized (waitFlag) { + //Update mode + mode = newMode; + + if (mode == PollingMode.NOTIFICATION) { + waitInterval = connector.getNotificationFetchInterval(); + } else { + waitInterval = connector.getServerFailoverInterval(); + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "changeMode", "waitInterval is now: " + waitInterval); + } + + //Notify thread to wake up. Only 1 thread (serverPollingThread) will be + //potentially waiting on this flag, so we can use notify() instead of notifyAll(). + waitFlag.notify(); + } + } + } + + /** {@inheritDoc} */ + @Override + public void run() { + final String sourceMethod = "run"; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, "Running thread: " + getCustomId()); + } + + JSONConverter converter = JSONConverter.getConverter(); + + mainLoop: while (!interrupted() && isConnected()) { + URL targetURL = null; + HttpsURLConnection connection = null; + + //We cache the value of "mode" during every iteration of the while loop in case + //another thread changes our polling mode during a HTTP request. We want each + //HTTP request/response to have equal modes, and only change in the next iteration. + final PollingMode currentMode = mode; + + try { + if (currentMode == PollingMode.NOTIFICATION) { + //Connect to inboxURL + targetURL = notificationRegistry.getInboxURL(); + connection = getConnection(targetURL, HttpMethod.GET, true); + connection.setReadTimeout(getConnector().getNotificationReadTimeout()); + } else { + //Connect to a simple URL to ping server + targetURL = getSimpleURL(connector.getCurrentEndpoint()); + connection = getConnection(targetURL, HttpMethod.GET, true); + } + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Making a call to URL [" + targetURL + "] inside thread: " + getCustomId()); + } + + } catch (IOException io) { + //If we got here we have problems other than server connection, so we must fail right away + logger.logp(Level.FINE, logger.getName(), sourceMethod, io.getMessage(), io); + connectionFailed(getRequestErrorException(sourceMethod, io, targetURL)); + break mainLoop; + } + + try { + // Check response code from server + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), sourceMethod, "Response code: " + responseCode); + } + + } catch (ConnectException ce) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, ce.getMessage(), ce); + recoverConnection(ce); + continue mainLoop; + } catch (IOException io) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, io.getMessage(), io); + continue mainLoop; + } + + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + try { + + if (currentMode == PollingMode.NOTIFICATION) { + // Process and return server response, which should be an array of Notifications + NotificationRecord[] notificationRecords = converter.readNotificationRecords(connection.getInputStream()); + + if (notificationRecords != null && isConnected()) { + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Received " + notificationRecords.length + " notifications"); + } + + for (NotificationRecord nr : notificationRecords) { + Notification n = nr.getNotification(); + Object source = n.getSource(); + if (!(source instanceof ObjectName)) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, "Notification source was not ObjectName: " + source); + getConnector().notificationLost(n); + continue; + } + + // Deliver the notification + ClientNotificationRegistration localRegistration = notificationRegistry.getRegistrationMap().get(nr.getNotificationTargetInformation()); + if (localRegistration != null) { + try { + localRegistration.handleNotification(n); + } catch (Exception e) { + logSevereException(sourceMethod, RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.NOTIFICATION_LOST), e); + getConnector().notificationLost(n); + } + } else { + getConnector().notificationLost(n); + } + } + + if (notificationRecords.length > 0) { + //try to fetch right away, in case this is a burst of notifications + continue mainLoop; + } + } + } else { + //no-op for failover polling, just break into the sleep segment + } + break; + } catch (ClassNotFoundException cnf) { + // Not a REST connector bug per se; not need to log this case + throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); + } catch (Exception e) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, e.getMessage(), e); + throw getResponseErrorException(sourceMethod, e, targetURL); + } + case HttpURLConnection.HTTP_NOT_FOUND: + Throwable ex = new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.URL_NOT_FOUND)); + logger.logp(Level.FINE, logger.getName(), sourceMethod, ex.getMessage()); + recoverConnection(ex); + continue mainLoop; + + case HttpURLConnection.HTTP_GONE: + // Notification area went away; try to re-establish + Throwable t = getServerThrowable(sourceMethod, connection); + logger.logp(Level.FINE, logger.getName(), sourceMethod, t.getMessage()); + recoverConnection(t); + continue mainLoop; + + case HttpURLConnection.HTTP_BAD_REQUEST: + case HttpURLConnection.HTTP_INTERNAL_ERROR: + // Server response should be a serialized Throwable + Throwable ie = getServerThrowable(sourceMethod, connection); + logger.logp(Level.FINE, sourceMethod, logger.getName(), ie.getMessage()); + throw ie; + case HttpURLConnection.HTTP_UNAUTHORIZED: + case HttpURLConnection.HTTP_FORBIDDEN: + throw getBadCredentialsException(responseCode, connection); + default: + throw getResponseCodeErrorException(sourceMethod, responseCode, connection); + } + } catch (ClosedByInterruptException ie) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, ie.getMessage()); + break mainLoop; + } catch (Throwable t) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, t.getMessage()); + //If we get an unknown exception in this polling thread we must try to reconnect, which + //will disconnect the connector if the server is not returning proper requests. + recoverConnection(t); + continue mainLoop; + } + + //We need to wait a certain amount of time before making the next request + if (waitInterval > 0) { + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), sourceMethod, "Calling sleep for " + waitInterval + " milliseconds on thread: " + getCustomId()); + } + try { + synchronized (waitFlag) { + waitFlag.wait(waitInterval); + } + } catch (InterruptedException e) { + if (logger.isLoggable(Level.FINE)) { + logger.logp(Level.FINE, logger.getName(), sourceMethod, "Interrupted sleep in thread: " + getCustomId()); + } + } + } + } + + JSONConverter.returnConverter(converter); + } + } + + /** + * Properly split a given endpoint into host/port. + * + * @param endpoint in the form host:port, where host could be a named host, an IPv4 or IPv6 address. + * @return a String array where [0] is the host and [1] is the port. + */ + public static String[] splitEndpoint(String endpoint) { + //The way our endpoints are constructed ensures that we will always have a ":" present..so don't need to check for -1 + final int lastColon = endpoint.lastIndexOf(":"); + String[] splitString = new String[2]; + splitString[0] = endpoint.substring(0, lastColon); + splitString[1] = endpoint.substring(lastColon + 1, endpoint.length()); + + if (logger.isLoggable(Level.FINEST)) { + logger.logp(Level.FINEST, logger.getName(), "splitEndpoint", "Split " + endpoint + " into " + splitString[0] + " and " + splitString[1]); + } + + return splitString; + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ServerNotificationListenerEntry.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ServerNotificationListenerEntry.java new file mode 100755 index 00000000000..fb6b90c6217 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/ServerNotificationListenerEntry.java @@ -0,0 +1,62 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.NotificationFilter; +import javax.management.ObjectName; + +import com.ibm.ws.jmx.connector.converter.NotificationTargetInformation; + +class ServerNotificationListenerEntry { + public final NotificationTargetInformation nti; + public final ObjectName listener; + public final NotificationFilter filter; + public final Object handback; + + private static final Logger logger = Logger.getLogger(ServerNotificationListenerEntry.class.getName()); + + /** + * @param listener + * @param filter + * @param handback + */ + ServerNotificationListenerEntry(NotificationTargetInformation nti, ObjectName listener, NotificationFilter filter, Object handback) { + this.nti = nti; + this.listener = listener; + this.filter = filter; + this.handback = handback; + + if (logger.isLoggable(Level.FINER)) { + logger.logp(Level.FINER, logger.getName(), "init", "targetInfo: " + nti + " | listener: " + listener + " | filter: " + filter + " | handback: " + handback); + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ServerNotificationListenerEntry)) + return false; + ServerNotificationListenerEntry other = (ServerNotificationListenerEntry) o; + return nti.equals(other.nti) && listener.equals(other.listener) && filter == other.filter && handback == other.handback; + } + + @Override + public int hashCode() { + return nti.hashCode() + listener.hashCode() + + (filter != null ? filter.hashCode() : 0) + + (handback != null ? handback.hashCode() : 0); + } + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/package-info.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/package-info.java new file mode 100755 index 00000000000..59084992b27 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/package-info.java @@ -0,0 +1,17 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.0 + */ +@org.osgi.annotation.versioning.Version("1.0") +package com.ibm.ws.jmx.connector.client.rest.internal; + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessagesUtil.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessagesUtil.java new file mode 100755 index 00000000000..39798e60228 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/FileTransferClientMessagesUtil.java @@ -0,0 +1,48 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal.resources; + +import java.text.MessageFormat; +import java.util.ResourceBundle; + +/** + * + */ +public class FileTransferClientMessagesUtil { + + private static final ResourceBundle logMessages = ResourceBundle.getBundle("com.ibm.ws.jmx.connector.client.rest.internal.resources.FileTransferClientMessages"); + + // Error messages + public static final String CLIENT_ERROR = "filetransfer.client.error"; + public static final String SERVER_ERROR = "filetransfer.server.error"; + public static final String BAD_CREDENTIALS = "filetransfer.client.bad.credentials"; + public static final String RESPONSE_CODE_ERROR = "filetransfer.response.code.error"; + public static final String UNSUPPORTED_OPERATION = "filetransfer.unsupported.operation"; + + // Info messages + public static final String CLIENT_INIT = "filetransfer.client.init"; + public static final String DOWNLOAD_TO_FILE = "filetransfer.download.file"; + public static final String UPLOAD_FROM_FILE = "filetransfer.upload.file"; + public static final String DELETE_FILE = "filetransfer.delete.file"; + public static final String DELETE_ALL = "filetransfer.delete.all"; + + public static String getMessage(String messageName, Object... arguments) { + if (arguments.length > 0) + return MessageFormat.format(logMessages.getString(messageName), arguments); + else + return logMessages.getString(messageName); + } + + public static String getObjID(Object obj) { + return obj.getClass().getSimpleName() + "@" + System.identityHashCode(obj); + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessagesUtil.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessagesUtil.java new file mode 100755 index 00000000000..af3d56b5ea3 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/internal/resources/RESTClientMessagesUtil.java @@ -0,0 +1,75 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.client.rest.internal.resources; + +import java.text.MessageFormat; +import java.util.ResourceBundle; + +/** + * + */ +public class RESTClientMessagesUtil { + + private static final ResourceBundle logMessages = ResourceBundle.getBundle("com.ibm.ws.jmx.connector.client.rest.internal.resources.RESTClientMessages"); + + // Severe log messages + public static final String REQUEST_ERROR = "jmx.rest.client.request.error"; + public static final String RESPONSE_ERROR = "jmx.rest.client.response.error"; + public static final String RESPONSE_CODE_ERROR = "jmx.rest.client.response.code.error"; + + // Exception messages + public static final String SERVER_THROWABLE_EXCEPTION = "jmx.rest.client.server.throwable.exception"; + public static final String SERVER_RESULT_EXCEPTION = "jmx.rest.client.server.result.exception"; + public static final String NOT_CONNECTED = "jmx.rest.client.not.connected"; + public static final String URL_NOT_FOUND = "jmx.rest.client.url.not.found"; + public static final String CLASS_NAME_NULL = "jmx.rest.client.class.name.null"; + public static final String ATTRIBUTE_NAME_NULL = "jmx.rest.client.attribute.name.null"; + public static final String ATTRIBUTE_NAMES_NULL = "jmx.rest.client.attribute.names.null"; + public static final String ATTRIBUTE_NULL = "jmx.rest.client.attribute.null"; + public static final String ATTRIBUTE_LIST_NULL = "jmx.rest.client.attribute.list.null"; + public static final String OBJECT_NAME_NULL = "jmx.rest.client.object.name.null"; + public static final String UNEXPECTED_SERVER_THROWABLE = "jmx.rest.client.unexpected.server.throwable"; + + // Exception messages with parameters + public static final String BAD_CREDENTIALS = "jmx.rest.client.bad.credentials"; + public static final String BAD_USER_CREDENTIALS = "jmx.rest.client.bad.user.credentials"; + public static final String OBJECT_NAME_PATTERN = "jmx.rest.client.object.name.pattern"; + public static final String INSTANCE_NOT_FOUND = "jmx.rest.client.instance.not.found"; + public static final String ATTRIBUTE_NOT_FOUND = "jmx.rest.client.attribute.not.found"; + public static final String OPERATION_NOT_FOUND = "jmx.rest.client.operation.not.found"; + public static final String LISTENER_NOT_FOUND = "jmx.rest.client.listener.not.found"; + + // Connection listener messages + public static final String NOTIFICATION_LOST = "jmx.rest.client.notification.lost"; + public static final String CONNECTION_FAILED = "jmx.rest.client.connection.failed"; + public static final String CONNECTION_TEMPORARILY_LOST = "jmx.rest.client.connection.temporarily.lost"; + public static final String CONNECTION_RESTORED_WITH_EXCEPTIONS = "jmx.rest.client.connection.restored.with.exceptions"; + public static final String CONNECTION_RESTORED = "jmx.rest.client.connection.restored"; + public static final String MEMBER_CONNECT = "jmx.rest.client.connection.connect"; + public static final String MEMBER_DISCONNECT = "jmx.rest.client.connection.disconnect"; + + // Endpoint related messages + public static final String NULL_SERVICE_URL = "jmx.rest.client.connection.illegal.argument"; + public static final String INVALID_ENDPOINT = "jmx.rest.client.connection.invalid.endpoint"; + public static final String NO_AVAILABLE_ENDPOINTS = "jmx.rest.client.connection.no.endpoints"; + + public static String getMessage(String messageName, Object... arguments) { + if (arguments.length > 0) + return MessageFormat.format(logMessages.getString(messageName), arguments); + else + return logMessages.getString(messageName); + } + + public static String getObjID(Object obj) { + return obj.getClass().getSimpleName() + "@" + System.identityHashCode(obj); + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/package-info.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/package-info.java new file mode 100755 index 00000000000..32487a53f4b --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/client/rest/package-info.java @@ -0,0 +1,16 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.4.0 + */ +@org.osgi.annotation.versioning.Version("1.4.0") +package com.ibm.ws.jmx.connector.client.rest; diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java new file mode 100755 index 00000000000..caa62fa9de2 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java @@ -0,0 +1,4418 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012,2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.converter; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.Array; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.Stack; +import java.util.TreeMap; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.management.Attribute; +import javax.management.AttributeChangeNotification; +import javax.management.AttributeChangeNotificationFilter; +import javax.management.AttributeList; +import javax.management.Descriptor; +import javax.management.ImmutableDescriptor; +import javax.management.MBeanAttributeInfo; +import javax.management.MBeanConstructorInfo; +import javax.management.MBeanInfo; +import javax.management.MBeanNotificationInfo; +import javax.management.MBeanOperationInfo; +import javax.management.MBeanParameterInfo; +import javax.management.MBeanServerNotification; +import javax.management.MalformedObjectNameException; +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationFilterSupport; +import javax.management.ObjectInstance; +import javax.management.ObjectName; +import javax.management.QueryExp; +import javax.management.openmbean.ArrayType; +import javax.management.openmbean.CompositeData; +import javax.management.openmbean.CompositeDataSupport; +import javax.management.openmbean.CompositeType; +import javax.management.openmbean.OpenDataException; +import javax.management.openmbean.OpenType; +import javax.management.openmbean.SimpleType; +import javax.management.openmbean.TabularData; +import javax.management.openmbean.TabularDataSupport; +import javax.management.openmbean.TabularType; +import javax.management.relation.MBeanServerNotificationFilter; +import javax.management.relation.RelationNotification; +import javax.management.remote.JMXConnectionNotification; +import javax.management.timer.TimerNotification; + +import com.ibm.json.java.JSON; +import com.ibm.json.java.JSONArray; +import com.ibm.json.java.JSONArtifact; +import com.ibm.json.java.JSONObject; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import com.ibm.ws.jmx.connector.datatypes.ConversionException; +import com.ibm.ws.jmx.connector.datatypes.CreateMBean; +import com.ibm.ws.jmx.connector.datatypes.Invocation; +import com.ibm.ws.jmx.connector.datatypes.JMXServerInfo; +import com.ibm.ws.jmx.connector.datatypes.MBeanInfoWrapper; +import com.ibm.ws.jmx.connector.datatypes.MBeanQuery; +import com.ibm.ws.jmx.connector.datatypes.NotificationArea; +import com.ibm.ws.jmx.connector.datatypes.NotificationRegistration; +import com.ibm.ws.jmx.connector.datatypes.NotificationSettings; +import com.ibm.ws.jmx.connector.datatypes.ObjectInstanceWrapper; +import com.ibm.ws.jmx.connector.datatypes.ServerNotificationRegistration; +import com.ibm.ws.jmx.connector.datatypes.ServerNotificationRegistration.Operation; + +/** + * Class used to convert JSON data for use as input and output to the JMX/REST + * connector. + *

+ * Note that the internals of this class are NOT thread safe, but the contract + * to obtain an instance is. Do not use the same instance of this class in + * multiple threads. Obtain a new instance each time an action is required + * using the following pattern: + *

{@code JSONConverter converter = JSONConverter.getConverter();}
{@code ...}
{@code JSONConverter.returnConverter(converter); } + */ +public class JSONConverter { + private static final Logger logger = Logger.getLogger(JSONConverter.class.getName()); + private static final boolean USE_BASE64_FOR_POJO = false; + private static final boolean USE_BASE64_FOR_MBEANINFO = false; + + private static DefaultSerializationHelper defaultHelper = new DefaultSerializationHelper(); + private static SerializationHelper helper = defaultHelper; + + // All supported interfaces/classes. + private static enum TYPE { + _Byte, _Short, _Integer, _Long, _Float, _Double, _Character, _Boolean, + Byte, Short, Integer, Long, Float, Double, Character, Boolean, + String, BigInteger, BigDecimal, Date, ObjectName, + + Object, + Collection, Map, + CompositeData, TabularData, + + List, Set, + ArrayList, LinkedList, Vector, + HashMap, Hashtable, TreeMap, + HashSet, + CompositeDataSupport, TabularDataSupport + } + + // Map from supported classes to Type enumeration, so that we can + // switch on the returned value. Implementations classes corresponding + // to the second half of the constants map to the base concepts: + // Collection / Map / CompositeData / TabularData. + // This map is used for writing and reading. + private static final Map, TYPE> SupportedClasses = new HashMap, TYPE>(); + static { + SupportedClasses.put(Byte.TYPE, TYPE._Byte); + SupportedClasses.put(Short.TYPE, TYPE._Short); + SupportedClasses.put(Integer.TYPE, TYPE._Integer); + SupportedClasses.put(Long.TYPE, TYPE._Long); + SupportedClasses.put(Float.TYPE, TYPE._Float); + SupportedClasses.put(Double.TYPE, TYPE._Double); + SupportedClasses.put(Character.TYPE, TYPE._Character); + SupportedClasses.put(Boolean.TYPE, TYPE._Boolean); + SupportedClasses.put(Byte.class, TYPE.Byte); + SupportedClasses.put(Short.class, TYPE.Short); + SupportedClasses.put(Integer.class, TYPE.Integer); + SupportedClasses.put(Long.class, TYPE.Long); + SupportedClasses.put(Float.class, TYPE.Float); + SupportedClasses.put(Double.class, TYPE.Double); + SupportedClasses.put(Character.class, TYPE.Character); + SupportedClasses.put(Boolean.class, TYPE.Boolean); + SupportedClasses.put(String.class, TYPE.String); + SupportedClasses.put(BigInteger.class, TYPE.BigInteger); + SupportedClasses.put(BigDecimal.class, TYPE.BigDecimal); + SupportedClasses.put(Date.class, TYPE.Date); + SupportedClasses.put(ObjectName.class, TYPE.ObjectName); + + SupportedClasses.put(Object.class, TYPE.Object); + SupportedClasses.put(Collection.class, TYPE.Collection); + SupportedClasses.put(Map.class, TYPE.Map); + SupportedClasses.put(CompositeData.class, TYPE.CompositeData); + SupportedClasses.put(TabularData.class, TYPE.TabularData); + + SupportedClasses.put(List.class, TYPE.Collection); + SupportedClasses.put(Set.class, TYPE.Collection); + SupportedClasses.put(ArrayList.class, TYPE.Collection); + SupportedClasses.put(LinkedList.class, TYPE.Collection); + SupportedClasses.put(Vector.class, TYPE.Collection); + SupportedClasses.put(HashMap.class, TYPE.Map); + SupportedClasses.put(Hashtable.class, TYPE.Map); + SupportedClasses.put(TreeMap.class, TYPE.Map); + SupportedClasses.put(HashSet.class, TYPE.Collection); + SupportedClasses.put(CompositeDataSupport.class, TYPE.CompositeData); + SupportedClasses.put(TabularDataSupport.class, TYPE.TabularData); + } + + // Set of 13 simple value classes corresponding to values that can be + // represented as Strings, hence used as keys in simple maps. + // Unlike SimpleValues, this one doesn't include java.lang.Object. + // This map is used only during writing. + private static final Set> SimpleKeys = new HashSet>(); + static { + SimpleKeys.add(Byte.class); + SimpleKeys.add(Short.class); + SimpleKeys.add(Integer.class); + SimpleKeys.add(Long.class); + SimpleKeys.add(Float.class); + SimpleKeys.add(Double.class); + SimpleKeys.add(Character.class); + SimpleKeys.add(Boolean.class); + SimpleKeys.add(String.class); + SimpleKeys.add(BigInteger.class); + SimpleKeys.add(BigDecimal.class); + SimpleKeys.add(Date.class); + SimpleKeys.add(ObjectName.class); + } + + // Set of 8 primitive, 8 corresponding built-in, and String classes. + // Array of these types can't contain instance of other classes. + private static final Set> SimpleArrays = new HashSet>(); + static { + SimpleArrays.add(Byte.TYPE); + SimpleArrays.add(Short.TYPE); + SimpleArrays.add(Integer.TYPE); + SimpleArrays.add(Long.TYPE); + SimpleArrays.add(Float.TYPE); + SimpleArrays.add(Double.TYPE); + SimpleArrays.add(Character.TYPE); + SimpleArrays.add(Boolean.TYPE); + SimpleArrays.add(Byte.class); + SimpleArrays.add(Short.class); + SimpleArrays.add(Integer.class); + SimpleArrays.add(Long.class); + SimpleArrays.add(Float.class); + SimpleArrays.add(Double.class); + SimpleArrays.add(Character.class); + SimpleArrays.add(Boolean.class); + SimpleArrays.add(String.class); + } + + // Set of 14 simple value classes corresponding to values that can be + // represented as Strings. + // This map is used only during reading. + private static final Map SimpleValues = new HashMap(); + static { + SimpleValues.put(Byte.class.getName(), TYPE.Byte); + SimpleValues.put(Short.class.getName(), TYPE.Short); + SimpleValues.put(Integer.class.getName(), TYPE.Integer); + SimpleValues.put(Long.class.getName(), TYPE.Long); + SimpleValues.put(Float.class.getName(), TYPE.Float); + SimpleValues.put(Double.class.getName(), TYPE.Double); + SimpleValues.put(Character.class.getName(), TYPE.Character); + SimpleValues.put(Boolean.class.getName(), TYPE.Boolean); + SimpleValues.put(String.class.getName(), TYPE.String); + SimpleValues.put(BigInteger.class.getName(), TYPE.BigInteger); + SimpleValues.put(BigDecimal.class.getName(), TYPE.BigDecimal); + SimpleValues.put(Date.class.getName(), TYPE.Date); + SimpleValues.put(Object.class.getName(), TYPE.Object); + SimpleValues.put(ObjectName.class.getName(), TYPE.ObjectName); + } + + // The map from class names to the simple open types. + // This map is only used during reading. + private static final Map> Name2SimpleTypes = new HashMap>(); + static { + // Don't need to worry about VOID + Name2SimpleTypes.put(Byte.class.getName(), SimpleType.BYTE); + Name2SimpleTypes.put(Short.class.getName(), SimpleType.SHORT); + Name2SimpleTypes.put(Integer.class.getName(), SimpleType.INTEGER); + Name2SimpleTypes.put(Long.class.getName(), SimpleType.LONG); + Name2SimpleTypes.put(Float.class.getName(), SimpleType.FLOAT); + Name2SimpleTypes.put(Double.class.getName(), SimpleType.DOUBLE); + Name2SimpleTypes.put(Character.class.getName(), SimpleType.CHARACTER); + Name2SimpleTypes.put(Boolean.class.getName(), SimpleType.BOOLEAN); + Name2SimpleTypes.put(String.class.getName(), SimpleType.STRING); + Name2SimpleTypes.put(BigInteger.class.getName(), SimpleType.BIGINTEGER); + Name2SimpleTypes.put(BigDecimal.class.getName(), SimpleType.BIGDECIMAL); + Name2SimpleTypes.put(Date.class.getName(), SimpleType.DATE); + Name2SimpleTypes.put(ObjectName.class.getName(), SimpleType.OBJECTNAME); + } + + // The simple open types to the type enumerations. + // This map is only used during reading. + private static final Map, TYPE> SimpleOpenTypes = new HashMap, TYPE>(); + static { + // Don't need to worry about VOID + SimpleOpenTypes.put(SimpleType.BYTE, TYPE.Byte); + SimpleOpenTypes.put(SimpleType.SHORT, TYPE.Short); + SimpleOpenTypes.put(SimpleType.INTEGER, TYPE.Integer); + SimpleOpenTypes.put(SimpleType.LONG, TYPE.Long); + SimpleOpenTypes.put(SimpleType.FLOAT, TYPE.Float); + SimpleOpenTypes.put(SimpleType.DOUBLE, TYPE.Double); + SimpleOpenTypes.put(SimpleType.CHARACTER, TYPE.Character); + SimpleOpenTypes.put(SimpleType.BOOLEAN, TYPE.Boolean); + SimpleOpenTypes.put(SimpleType.STRING, TYPE.String); + SimpleOpenTypes.put(SimpleType.BIGINTEGER, TYPE.BigInteger); + SimpleOpenTypes.put(SimpleType.BIGDECIMAL, TYPE.BigDecimal); + SimpleOpenTypes.put(SimpleType.DATE, TYPE.Date); + SimpleOpenTypes.put(SimpleType.OBJECTNAME, TYPE.ObjectName); + } + + // Map from names of complex structure classes to the type enumerations. + // This map is only used during reading. + private static final Map StructuredClasses = new HashMap(); + static { + StructuredClasses.put(ArrayList.class.getName(), TYPE.ArrayList); + StructuredClasses.put(LinkedList.class.getName(), TYPE.LinkedList); + StructuredClasses.put(Vector.class.getName(), TYPE.Vector); + StructuredClasses.put(HashMap.class.getName(), TYPE.HashMap); + StructuredClasses.put(Hashtable.class.getName(), TYPE.Hashtable); + StructuredClasses.put(TreeMap.class.getName(), TYPE.TreeMap); + StructuredClasses.put(HashSet.class.getName(), TYPE.HashSet); + StructuredClasses.put(CompositeDataSupport.class.getName(), TYPE.CompositeDataSupport); + StructuredClasses.put(TabularDataSupport.class.getName(), TYPE.TabularDataSupport); + } + + // Names of JSON object members. + private static final String N_API = "api"; + private static final byte[] OM_API = { '"', 'a', 'p', 'i', '"', ':' }; + private static final String N_ATTRIBUTENAME = "attributeName"; + private static final byte[] OM_ATTRIBUTENAME = { '"', 'a', 't', 't', 'r', 'i', 'b', 'u', 't', 'e', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_ATTRIBUTES = "attributes"; + private static final byte[] OM_ATTRIBUTES = { '"', 'a', 't', 't', 'r', 'i', 'b', 'u', 't', 'e', 's', '"', ':' }; + private static final String N_ATTRIBUTES_URL = "attributes_URL"; + private static final byte[] OM_ATTRIBUTES_URL = { '"', 'a', 't', 't', 'r', 'i', 'b', 'u', 't', 'e', 's', '_', 'U', 'R', 'L', '"', ':' }; + private static final String N_ATTRIBUTETYPE = "attributeType"; + private static final byte[] OM_ATTRIBUTETYPE = { '"', 'a', 't', 't', 'r', 'i', 'b', 'u', 't', 'e', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_CLASSNAME = "className"; + private static final byte[] OM_CLASSNAME = { '"', 'c', 'l', 'a', 's', 's', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_CLIENT = "client"; + private static final byte[] OM_CLIENT = { '"', 'c', 'l', 'i', 'e', 'n', 't', '"', ':' }; + private static final String N_CONNECTIONID = "connectionId"; + private static final byte[] OM_CONNECTIONID = { '"', 'c', 'o', 'n', 'n', 'e', 'c', 't', 'i', 'o', 'n', 'I', 'd', '"', ':' }; + private static final String N_CONSTRUCTORS = "constructors"; + private static final byte[] OM_CONSTRUCTORS = { '"', 'c', 'o', 'n', 's', 't', 'r', 'u', 'c', 't', 'o', 'r', 's', '"', ':' }; + private static final String N_CREATEMBEAN = "createMBean"; + private static final byte[] OM_CREATEMBEAN = { '"', 'c', 'r', 'e', 'a', 't', 'e', 'M', 'B', 'e', 'a', 'n', '"', ':' }; + private static final String N_DEFAULTDOMAIN = "defaultDomain"; + private static final byte[] OM_DEFAULTDOMAIN = { '"', 'd', 'e', 'f', 'a', 'u', 'l', 't', 'D', 'o', 'm', 'a', 'i', 'n', '"', ':' }; + private static final String N_DELIVERYINTERVAL = "deliveryInterval"; + private static final byte[] OM_DELIVERYINTERVAL = { '"', 'd', 'e', 'l', 'i', 'v', 'e', 'r', 'y', 'I', 'n', 't', 'e', 'r', 'v', 'a', 'l', '"', ':' }; + private static final String N_DESCRIPTION = "description"; + private static final byte[] OM_DESCRIPTION = { '"', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'i', 'o', 'n', '"', ':' }; + private static final String N_DESCRIPTOR = "descriptor"; + private static final byte[] OM_DESCRIPTOR = { '"', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', '"', ':' }; + private static final String N_DIMENSION = "dimension"; + private static final byte[] OM_DIMENSION = { '"', 'd', 'i', 'm', 'e', 'n', 's', 'i', 'o', 'n', '"', ':' }; + private static final String N_DISABLED = "disabled"; + private static final byte[] OM_DISABLED = { '"', 'd', 'i', 's', 'a', 'b', 'l', 'e', 'd', '"', ':' }; + private static final String N_DOMAINS = "domains"; + private static final byte[] OM_DOMAINS = { '"', 'd', 'o', 'm', 'a', 'i', 'n', 's', '"', ':' }; + private static final String N_ELEMENTTYPE = "elementType"; + private static final byte[] OM_ELEMENTTYPE = { '"', 'e', 'l', 'e', 'm', 'e', 'n', 't', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_ENABLED = "enabled"; + private static final byte[] OM_ENABLED = { '"', 'e', 'n', 'a', 'b', 'l', 'e', 'd', '"', ':' }; + private static final String N_ENTRIES = "entries"; + private static final byte[] OM_ENTRIES = { '"', 'e', 'n', 't', 'r', 'i', 'e', 's', '"', ':' }; + private static final String N_FILE_TRANSFER = "fileTransfer"; + private static final byte[] OM_FILE_TRANSFER = { '"', 'f', 'i', 'l', 'e', 'T', 'r', 'a', 'n', 's', 'f', 'e', 'r', '"', ':' }; + private static final String N_FILTER = "filter"; + private static final byte[] OM_FILTER = { '"', 'f', 'i', 'l', 't', 'e', 'r', '"', ':' }; + private static final String N_FILTERID = "filterID"; + private static final byte[] OM_FILTERID = { '"', 'f', 'i', 'l', 't', 'e', 'r', 'I', 'D', '"', ':' }; + private static final String N_FILTERS = "filters"; + private static final byte[] OM_FILTERS = { '"', 'f', 'i', 'l', 't', 'e', 'r', 's', '"', ':' }; + private static final String N_GRAPH = "graph"; + private static final byte[] OM_GRAPH = { '"', 'g', 'r', 'a', 'p', 'h', '"', ':' }; + private static final String N_HANDBACK = "handback"; + private static final byte[] OM_HANDBACK = { '"', 'h', 'a', 'n', 'd', 'b', 'a', 'c', 'k', '"', ':' }; + private static final String N_HANDBACKID = "handbackID"; + private static final byte[] OM_HANDBACKID = { '"', 'h', 'a', 'n', 'd', 'b', 'a', 'c', 'k', 'I', 'D', '"', ':' }; + private static final String N_HOSTNAME = "hostName"; + private static final byte[] OM_HOSTNAME = { '"', 'h', 'o', 's', 't', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_IMPACT = "impact"; + private static final byte[] OM_IMPACT = { '"', 'i', 'm', 'p', 'a', 'c', 't', '"', ':' }; + private static final String N_INBOX = "inbox"; + private static final byte[] OM_INBOX = { '"', 'i', 'n', 'b', 'o', 'x', '"', ':' }; + private static final String N_INBOXEXPIRY = "inboxExpiry"; + private static final byte[] OM_INBOXEXPIRTY = { '"', 'i', 'n', 'b', 'o', 'x', 'E', 'x', 'p', 'i', 'r', 'y', '"', ':' }; + private static final String N_INDEXNAMES = "indexNames"; + private static final byte[] OM_INDEXNAMES = { '"', 'i', 'n', 'd', 'e', 'x', 'N', 'a', 'm', 'e', 's', '"', ':' }; + private static final String N_INSTANCEOF = "instanceOf"; + private static final byte[] OM_INSTANCEOF = { '"', 'i', 'n', 's', 't', 'a', 'n', 'c', 'e', 'O', 'f', '"', ':' }; + private static final String N_ISIS = "isIs"; + private static final byte[] OM_ISIS = { '"', 'i', 's', 'I', 's', '"', ':' }; + private static final String N_ISREADABLE = "isReadable"; + private static final byte[] OM_ISREADABLE = { '"', 'i', 's', 'R', 'e', 'a', 'd', 'a', 'b', 'l', 'e', '"', ':' }; + private static final String N_ISWRITABLE = "isWritable"; + private static final byte[] OM_ISWRITABLE = { '"', 'i', 's', 'W', 'r', 'i', 't', 'a', 'b', 'l', 'e', '"', ':' }; + private static final String N_ITEMS = "items"; + private static final byte[] OM_ITEMS = { '"', 'i', 't', 'e', 'm', 's', '"', ':' }; + private static final String N_LISTENER = "listener"; + private static final byte[] OM_LISTENER = { '"', 'l', 'i', 's', 't', 'e', 'n', 'e', 'r', '"', ':' }; + private static final String N_LOADERNAME = "loaderName"; + private static final byte[] OM_LOADERNAME = { '"', 'l', 'o', 'a', 'd', 'e', 'r', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_KEY = "key"; + private static final byte[] OM_KEY = { '"', 'k', 'e', 'y', '"', ':' }; + private static final String N_KEYTYPE = "keyType"; + private static final byte[] OM_KEYTYPE = { '"', 'k', 'e', 'y', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_MBEANCOUNT = "mbeanCount"; + private static final byte[] OM_MBEANCOUNT = { '"', 'm', 'b', 'e', 'a', 'n', 'C', 'o', 'u', 'n', 't', '"', ':' }; + private static final String N_MBEANNAME = "mbeanName"; + private static final byte[] OM_MBEANNAME = { '"', 'm', 'b', 'e', 'a', 'n', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_MBEANS = "mbeans"; + private static final byte[] OM_MBEANS = { '"', 'm', 'b', 'e', 'a', 'n', 's', '"', ':' }; + private static final String N_MBEANSTOUNREGISTER = "mbeansToUnregister"; + private static final byte[] OM_MBEANSTOUNREGISTER = { '"', 'm', 'b', 'e', 'a', 'n', 's', 'T', 'o', 'U', 'n', 'r', 'e', 'g', 'i', 's', 't', 'e', 'r', '"', ':' }; + private static final String N_MESSAGE = "message"; + private static final byte[] OM_MESSAGE = { '"', 'm', 'e', 's', 's', 'a', 'g', 'e', '"', ':' }; + private static final String N_NAME = "name"; + private static final byte[] OM_NAME = { '"', 'n', 'a', 'm', 'e', '"', ':' }; + private static final String N_NAMES = "names"; + private static final byte[] OM_NAMES = { '"', 'n', 'a', 'm', 'e', 's', '"', ':' }; + private static final String N_NEWROLEVALUE = "newRoleValue"; + private static final byte[] OM_NEWROLEVALUE = { '"', 'n', 'e', 'w', 'R', 'o', 'l', 'e', 'V', 'a', 'l', 'u', 'e', '"', ':' }; + private static final String N_NEWVALUE = "newValue"; + private static final byte[] OM_NEWVALUE = { '"', 'n', 'e', 'w', 'V', 'a', 'l', 'u', 'e', '"', ':' }; + private static final String N_NOTIFICATIONID = "notificationID"; + private static final byte[] OM_NOTIFICATIONID = { '"', 'n', 'o', 't', 'i', 'f', 'i', 'c', 'a', 't', 'i', 'o', 'n', 'I', 'D', '"', ':' }; + private static final String N_NOTIFICATIONS = "notifications"; + private static final byte[] OM_NOTIFICATIONS = { '"', 'n', 'o', 't', 'i', 'f', 'i', 'c', 'a', 't', 'i', 'o', 'n', 's', '"', ':' }; + private static final String N_NOTIFTYPES = "notifTypes"; + private static final byte[] OM_NOTIFTYPES = { '"', 'n', 'o', 't', 'i', 'f', 'T', 'y', 'p', 'e', 's', '"', ':' }; + private static final String N_OBJECTNAME = "objectName"; + private static final byte[] OM_OBJECTNAME = { '"', 'o', 'b', 'j', 'e', 'c', 't', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_OLDROLEVALUE = "oldRoleValue"; + private static final byte[] OM_OLDROLEVALUE = { '"', 'o', 'l', 'd', 'R', 'o', 'l', 'e', 'V', 'a', 'l', 'u', 'e', '"', ':' }; + private static final String N_OLDVALUE = "oldValue"; + private static final byte[] OM_OLDVALUE = { '"', 'o', 'l', 'd', 'V', 'a', 'l', 'u', 'e', '"', ':' }; + private static final String N_OPENTYPE = "openType"; + private static final byte[] OM_OPENTYPE = { '"', 'o', 'p', 'e', 'n', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_OPENTYPECLASS = "openTypeClass"; + private static final byte[] OM_OPENTYPECLASS = { '"', 'o', 'p', 'e', 'n', 'T', 'y', 'p', 'e', 'C', 'l', 'a', 's', 's', '"', ':' }; + private static final String N_OPENTYPES = "openTypes"; + private static final byte[] OM_OPENTYPES = { '"', 'o', 'p', 'e', 'n', 'T', 'y', 'p', 'e', 's', '"', ':' }; + private static final String N_OPERATION = "operation"; + private static final byte[] OM_OPERATION = { '"', 'o', 'p', 'e', 'r', 'a', 't', 'i', 'o', 'n', '"', ':' }; + private static final String N_OPERATIONS = "operations"; + private static final byte[] OM_OPERATIONS = { '"', 'o', 'p', 'e', 'r', 'a', 't', 'i', 'o', 'n', 's', '"', ':' }; + private static final String N_PARAMS = "params"; + private static final byte[] OM_PARAMS = { '"', 'p', 'a', 'r', 'a', 'm', 's', '"', ':' }; + private static final String N_QUERYEXP = "queryExp"; + private static final byte[] OM_QUERYEXP = { '"', 'q', 'u', 'e', 'r', 'y', 'E', 'x', 'p', '"', ':' }; + private static final String N_REGISTRATIONS = "registrations"; + private static final byte[] OM_REGISTRATIONS = { '"', 'r', 'e', 'g', 'i', 's', 't', 'r', 'a', 't', 'i', 'o', 'n', 's', '"', ':' }; + private static final String N_RELATIONID = "relationId"; + private static final byte[] OM_RELATIONID = { '"', 'r', 'e', 'l', 'a', 't', 'i', 'o', 'n', 'I', 'd', '"', ':' }; + private static final String N_RELATIONTYPENAME = "relationTypeName"; + private static final byte[] OM_RELATIONTYPENAME = { '"', 'r', 'e', 'l', 'a', 't', 'i', 'o', 'n', 'T', 'y', 'p', 'e', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_RETURNTYPE = "returnType"; + private static final byte[] OM_RETURNTYPE = { '"', 'r', 'e', 't', 'u', 'r', 'n', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_ROLENAME = "roleName"; + private static final byte[] OM_ROLENAME = { '"', 'r', 'o', 'l', 'e', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_ROWTYPE = "rowType"; + private static final byte[] OM_ROWTYPE = { '"', 'r', 'o', 'w', 'T', 'y', 'p', 'e', '"', ':' }; + private static final String N_SEQUENCENUMBER = "sequenceNumber"; + private static final byte[] OM_SEQUENCENUMBER = { '"', 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 'N', 'u', 'm', 'b', 'e', 'r', '"', ':' }; + private static final String N_SERIALIZED = "serialized"; + private static final byte[] OM_SERIALIZED = { '"', 's', 'e', 'r', 'i', 'a', 'l', 'i', 'z', 'e', 'd', '"', ':' }; + private static final String N_SERVERNAME = "serverName"; + private static final byte[] OM_SERVERNAME = { '"', 's', 'e', 'r', 'v', 'e', 'r', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_SERVERREGISTRATIONS = "serverRegistrations"; + private static final byte[] OM_SERVERREGISTRATIONS = { '"', 's', 'e', 'r', 'v', 'e', 'r', 'R', 'e', 'g', 'i', 's', 't', 'r', 'a', 't', 'i', 'o', 'n', 's', '"', ':' }; + private static final String N_SERVERUSERDIR = "serverUserDir"; + private static final byte[] OM_SERVERUSERDIR = { '"', 's', 'e', 'r', 'v', 'e', 'r', 'U', 's', 'e', 'r', 'D', 'i', 'r', '"', ':' }; + private static final String N_SIGNATURE = "signature"; + private static final byte[] OM_SIGNATURE = { '"', 's', 'i', 'g', 'n', 'a', 't', 'u', 'r', 'e', '"', ':' }; + private static final String N_SIMPLEKEY = "simpleKey"; + private static final byte[] OM_SIMPLEKEY = { '"', 's', 'i', 'm', 'p', 'l', 'e', 'K', 'e', 'y', '"', ':' }; + private static final String N_SOURCE = "source"; + private static final byte[] OM_SOURCE = { '"', 's', 'o', 'u', 'r', 'c', 'e', '"', ':' }; + // "stacktrace" is not read by the Java client. + // private static final String N_STACKTRACE = "stackTrace"; + private static final byte[] OM_STACKTRACE = { '"', 's', 't', 'a', 'c', 'k', 'T', 'r', 'a', 'c', 'e', '"', ':' }; + private static final String N_THROWABLE = "throwable"; + private static final byte[] OM_THROWABLE = { '"', 't', 'h', 'r', 'o', 'w', 'a', 'b', 'l', 'e', '"', ':' }; + private static final String N_TIMESTAMP = "timeStamp"; + private static final byte[] OM_TIMESTAMP = { '"', 't', 'i', 'm', 'e', 'S', 't', 'a', 'm', 'p', '"', ':' }; + private static final String N_TYPE = "type"; + private static final byte[] OM_TYPE = { '"', 't', 'y', 'p', 'e', '"', ':' }; + private static final String N_TYPENAME = "typeName"; + private static final byte[] OM_TYPENAME = { '"', 't', 'y', 'p', 'e', 'N', 'a', 'm', 'e', '"', ':' }; + private static final String N_TYPES = "types"; + private static final byte[] OM_TYPES = { '"', 't', 'y', 'p', 'e', 's', '"', ':' }; + private static final String N_URL = "URL"; + private static final byte[] OM_URL = { '"', 'U', 'R', 'L', '"', ':' }; + private static final String N_USELOADER = "useLoader"; + private static final byte[] OM_USELOADER = { '"', 'u', 's', 'e', 'L', 'o', 'a', 'd', 'e', 'r', '"', ':' }; + private static final String N_USERDATA = "userData"; + private static final byte[] OM_USERDATA = { '"', 'u', 's', 'e', 'r', 'D', 'a', 't', 'a', '"', ':' }; + private static final String N_USESIGNATURE = "useSignature"; + private static final byte[] OM_USESIGNATURE = { '"', 'u', 's', 'e', 'S', 'i', 'g', 'n', 'a', 't', 'u', 'r', 'e', '"', ':' }; + private static final String N_VALUE = "value"; + private static final byte[] OM_VALUE = { '"', 'v', 'a', 'l', 'u', 'e', '"', ':' }; + private static final String N_VALUES = "values"; + private static final byte[] OM_VALUES = { '"', 'v', 'a', 'l', 'u', 'e', 's', '"', ':' }; + private static final String N_VERSION = "version"; + private static final byte[] OM_VERSION = { '"', 'v', 'e', 'r', 's', 'i', 'o', 'n', '"', ':' }; + + private static final byte[] LONG_MIN = { '-', '9', '2', '2', '3', '3', '7', + '2', '0', '3', '6', '8', '5', '4', + '7', '7', '5', '8', '0', '8' }; + private static final byte[] INT_MIN = { '-', '2', '1', '4', '7', '4', '8', + '3', '6', '4', '8' }; + private static final byte[] TRUE = { 't', 'r', 'u', 'e' }; + private static final byte[] FALSE = { 'f', 'a', 'l', 's', 'e' }; + private static final byte[] NULL = { 'n', 'u', 'l', 'l' }; + private static final Object OBJECT = new Object(); + + // Maps used by base64 encoding/decoding + private static final byte[] BASE64 = new byte[64]; + private static final byte[] BASE64_D = new byte[128]; + static { + for (int i = 0; i < 128; i++) { + BASE64_D[i] = -1; + } + for (byte i = 0; i < 26; i++) { + BASE64[i] = (byte) (i + 'A'); + BASE64_D[i + 'A'] = i; + } + for (int i = 0; i < 26; i++) { + BASE64[i + 26] = (byte) (i + 'a'); + BASE64_D[i + 'a'] = (byte) (i + 26); + } + for (int i = 0; i < 10; i++) { + BASE64[i + 52] = (byte) (i + '0'); + BASE64_D[i + '0'] = (byte) (i + 52); + } + BASE64[62] = '+'; + BASE64[63] = '/'; + BASE64_D['+'] = 62; + BASE64_D['/'] = 63; + BASE64_D['='] = 0; + } + + // Pool of converters, used by the server. + private static final Stack POOL = new Stack(); + + // Byte buffer for writing integers and encoding base64 values. + // Make sure the buffer is long enough to hold LONG_MIN, and is divisible + // by 3, for base64 encoding. + private final byte[] BYTE_BUFFER = new byte[LONG_MIN.length / 3 * 3 + 3]; + + // Whether the next array/object item is the first. If not, need to write ','. + private boolean firstItem; + + // ByteArrayOutputStream used for encoding String to base64 + private final ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream(); + + // Base64OutputStream used to base64 encoding its content + private final Base64OutputStream base64Stream = new Base64OutputStream(); + + // Class for providing base64 encoding capability to an OutputStream + private class Base64OutputStream extends OutputStream { + private OutputStream out; + private int count; + + private void start(OutputStream out) { + this.out = out; + this.count = 0; + } + + @Override + public void write(int b) throws IOException { + // If the buffer is already full, base64-encode it. + // The size is divisible by 3, so no padding is done. + if (count == BYTE_BUFFER.length) { + encodeBase64(); + count = 0; + } + BYTE_BUFFER[count++] = (byte) b; + } + + @Override + public void write(byte b[], int off, int len) throws IOException { + int left = BYTE_BUFFER.length - count; + // If we have more than what the buffer can hold + while (len > left) { + // Fill the buffer and base64 encode it + // The size is divisible by 3, so no padding is done. + System.arraycopy(b, off, BYTE_BUFFER, count, left); + count = BYTE_BUFFER.length; + encodeBase64(); + len -= left; + off += left; + left = BYTE_BUFFER.length; + } + // Copy the rest into the buffer + System.arraycopy(b, off, BYTE_BUFFER, count, len); + count += len; + } + + @Override + public void flush() throws IOException { + // Encode and write out any pending bytes + if (count > 0) { + encodeBase64(); + } + } + + private void end() throws IOException { + flush(); + out = null; + } + + private void encodeBase64() throws IOException { + final int left = count % 3; + int pos = 0, b1, b2, b3; + // For every 3-byte sequence + for (; pos < count - left;) { + b1 = BYTE_BUFFER[pos++]; + b2 = BYTE_BUFFER[pos++]; + b3 = BYTE_BUFFER[pos++]; + // Write out 4 bytes + out.write(BASE64[(b1 >> 2) & 0x3f]); + out.write(BASE64[((b1 & 0x3) << 4) | ((b2 >> 4) & 0xf)]); + out.write(BASE64[((b2 & 0xf) << 2) | ((b3 >> 6) & 0x3)]); + out.write(BASE64[b3 & 0x3f]); + } + // 1 byte is left. Need 2 padding chars '==' + if (left == 1) { + b1 = BYTE_BUFFER[pos]; + out.write(BASE64[(b1 >> 2) & 0x3f]); + out.write(BASE64[(b1 & 0x3) << 4]); + out.write('='); + out.write('='); + } + // 2 bytes are left. Need 1 padding char '=' + else if (left == 2) { + b1 = BYTE_BUFFER[pos++]; + b2 = BYTE_BUFFER[pos++]; + out.write(BASE64[(b1 >> 2) & 0x3f]); + out.write(BASE64[((b1 & 0x3) << 4) | ((b2 >> 4) & 0xf)]); + out.write(BASE64[(b2 & 0xf) << 2]); + out.write('='); + } + count = 0; + } + } + + /** + * Retrieve an instance of the JSON converter. When the converter is no + * longer needed, it can be returned to a global pool for reuse, by + * calling {@link #returnConverter(JSONConverter)}. + * + * @return an instance of the JSONConverter. {@code null} is not returned. + */ + public static JSONConverter getConverter() { + synchronized (POOL) { + if (!POOL.empty()) { + return POOL.pop(); + } + } + return new JSONConverter(); + } + + /** + * Returns the JSONConverter instance to the global pool for reuse later. + * + * @param converter the JSONConverter to return. {@code null} is not supported. + */ + public static void returnConverter(JSONConverter converter) { + if (!POOL.contains(converter)) + POOL.push(converter); + } + + // Use getConverter() + private JSONConverter() {} + + /** + * Encode an integer value as JSON. An array is used to wrap the value: + * [ Integer ] + * + * @param out The stream to write JSON to + * @param value The integer value to encode + * @throws IOException If an I/O error occurs + * @see #readInt(InputStream) + */ + public void writeInt(OutputStream out, int value) throws IOException { + writeStartArray(out); + writeIntInternal(out, value); + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve an integer value. + * + * @param in The stream to read JSON from + * @return The decoded integer value + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeInt(OutputStream, int) + */ + public int readInt(InputStream in) throws ConversionException, IOException { + JSONArray json = parseArray(in); + if (json.size() != 1) { + throwConversionException("readInt() expects one item in the array: [ Integer ].", json); + } + return readIntInternal(json.get(0)); + } + + /** + * Encode a boolean value as JSON. An array is used to wrap the value: + * [ true | false ] + * + * @param out The stream to write JSON to + * @param value The boolean value to encode + * @throws IOException If an I/O error occurs + * @see #readBoolean(InputStream) + */ + public void writeBoolean(OutputStream out, boolean value) throws IOException { + writeStartArray(out); + writeBooleanInternal(out, value); + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve an boolean value. + * + * @param in The stream to read JSON from + * @return The decoded boolean value + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeInt(OutputStream, int) + */ + public boolean readBoolean(InputStream in) throws ConversionException, IOException { + JSONArray json = parseArray(in); + if (json.size() != 1) { + throwConversionException("readBoolean() expects one item in the array: [ true | false ].", json); + } + return readBooleanInternal(json.get(0)); + } + + /** + * Encode a String value as JSON. An array is used to wrap the value: + * [ String ] + * + * @param out The stream to write JSON to + * @param value The String value to encode. + * @throws IOException If an I/O error occurs + * @see #readString(InputStream) + */ + public void writeString(OutputStream out, String value) throws IOException { + writeStartArray(out); + writeStringInternal(out, value); + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve a String value. + * + * @param in The stream to read JSON from + * @return The decoded String value + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeString(OutputStream, String) + */ + public String readString(InputStream in) throws ConversionException, IOException { + JSONArray json = parseArray(in); + if (json.size() != 1) { + throwConversionException("readString() expects one item in the array: [ String ].", json); + } + return readStringInternal(json.get(0)); + } + + /** + * Encode a String array as JSON: + * [ String* ] + * + * @param out The stream to write JSON to + * @param value The String array to encode. Can't be null. + * @throws IOException If an I/O error occurs + */ + public void writeStringArray(OutputStream out, String[] value) throws IOException { + writeStringArrayInternal(out, value); + } + + /** + * Decode a JSON document to retrieve a String array. + * + * @param in The stream to read JSON from + * @return The decoded String array + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeStringArray(OutputStream, String[]) + */ + public String[] readStringArray(InputStream in) throws ConversionException, IOException { + return readStringArrayInternal(parse(in)); + } + + /** + * Encode an Object as JSON. + * + * Format: + * + * { + * serialized: Base64, ? // If object has cyclic references. Otherwise use the following fields instead. + * value: Value, ? + * type: Type, ? + * openTypes: [ OpenType * ], ? // Only if open types are used + * } + * + * *** Value *** + * + * 1. For "null" value, or a value that's not expressible in JSON + * + * null + * + * 2. For a simple value (primitive, String, BigInteger/Decimal, Date, + * ObjectName), or Object. For Object, "" is used. + * + * String + * + * 3. For array or collection + * + * [ Value* ] + * + * 4. For map where all keys are simple values + * + * { + * String: Value * + * } + * + * 5. For map with complex keys + * + * [ {key: Value, value: Value}* ] + * + * 6. For CompositeData + * + * { + * String: Value * + * } + * + * 7. and TabularData + * + * [ CompositeData* ] + * + * *** Type *** + * + * 1. For "null" value + * + * null + * + * 2. For a simple value, arrays of primitives or final simple values, + * or Object. For Object, "" is used. + * + * String // The class name + * + * 3. Otherwise + * + * { + * class: String, // Class name of the object + * serialized: Base64 ? // Optional: If the class is not supported. The java serialization of the value. + * } + * + * The following additional fields apply depending on the kind of value. + * + * 3.1 For complex array or collection classes: + * + * { + * items: [ Type* ] + * } + * + * 3.4 For maps + * + * { + * simpleKey: boolean, // Whether all keys are simple. Then each entry has a "key" field. + * entries: [ + * { + * key: String, ? // For simple key + * keyType: Type, + * value: Type + * } * + * ] + * + * 3.5 For CompositeData and TabularData + * + * { + * openType: Integer // Reference to the OpenType array in root Type + * } + * + * *** OpenType *** + * + * 1. For SimpleType instances: + * + * String // The name of the simple type. + * + * 2. For all other OpenTypes: + * + * { + * openTypeClass: String, // The OpenType class. + * serialized: Base64 // Optional: If the class is not supported. The java serialization of the OpenType object. + * + * className: String, + * typeName: String, + * description: String, + * } + * + * 2.1 ArrayType + * + * { + * dimension: Integer, + * elementType: Integer, + * } + * + * 2.2 CompositeType + * + * { + * items: { String: { description: String, type: Integer } *} + * } + * + * 2.3 TabularType + * + * { + * rowType: Integer, + * indexNames: [String*] + * } + * + * @param out The stream to write JSON to + * @param value The Object to encode. Can be null. + * @throws IOException If an I/O error occurs + * @see #readPOJO(InputStream) + */ + public void writePOJO(OutputStream out, Object value) throws IOException { + writePOJOInternal(out, value); + } + + /** + * Decode a JSON document to retrieve an Object. + * + * @param in The stream to read JSON from + * @return The decoded Object + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writePOJO(OutputStream, Object) + */ + public Object readPOJO(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + return readPOJOInternal(parse(in)); + } + + /** + * Encode a JMX instance as JSON: + * { + * "version" : Integer, + * "mbeans" : URL, + * "createMBean" : URL, + * "mbeanCount" : URL, + * "defaultDomain" : URL, + * "domains" : URL, + * "notifications" : URL, + * "instanceOf" : URL + * } + * + * @param out The stream to write JSON to + * @param value The JMX instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readJMX(InputStream) + */ + public void writeJMX(OutputStream out, JMXServerInfo value) throws IOException { + assert value != null; + writeStartObject(out); + writeIntField(out, OM_VERSION, value.version); + writeStringField(out, OM_MBEANS, value.mbeansURL); + writeStringField(out, OM_CREATEMBEAN, value.createMBeanURL); + writeStringField(out, OM_MBEANCOUNT, value.mbeanCountURL); + writeStringField(out, OM_DEFAULTDOMAIN, value.defaultDomainURL); + writeStringField(out, OM_DOMAINS, value.domainsURL); + writeStringField(out, OM_NOTIFICATIONS, value.notificationsURL); + writeStringField(out, OM_INSTANCEOF, value.instanceOfURL); + writeStringField(out, OM_FILE_TRANSFER, value.fileTransferURL); + writeStringField(out, OM_API, value.apiURL); + writeStringField(out, OM_GRAPH, value.graphURL); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a JMX instance. + * + * @param in The stream to read JSON from + * @return The decoded JMX instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeJMX(OutputStream, JMXServerInfo) + */ + public JMXServerInfo readJMX(InputStream in) throws ConversionException, IOException { + JSONObject json = parseObject(in); + JMXServerInfo ret = new JMXServerInfo(); + ret.version = readIntInternal(json.get(N_VERSION)); + ret.mbeansURL = readStringInternal(json.get(N_MBEANS)); + ret.createMBeanURL = readStringInternal(json.get(N_CREATEMBEAN)); + ret.mbeanCountURL = readStringInternal(json.get(N_MBEANCOUNT)); + ret.defaultDomainURL = readStringInternal(json.get(N_DEFAULTDOMAIN)); + ret.domainsURL = readStringInternal(json.get(N_DOMAINS)); + ret.notificationsURL = readStringInternal(json.get(N_NOTIFICATIONS)); + ret.instanceOfURL = readStringInternal(json.get(N_INSTANCEOF)); + ret.fileTransferURL = readStringInternal(json.get(N_FILE_TRANSFER)); + ret.apiURL = readStringInternal(json.get(N_API)); + ret.graphURL = readStringInternal(json.get(N_GRAPH)); + return ret; + } + + /** + * Encode an ObjectInstanceWrapper instance as JSON: + * { + * "objectName" : ObjectName, + * "className" : String, + * "URL" : URL, + * } + * + * @param out The stream to write JSON to + * @param value The ObjectInstanceWrapper instance to encode. + * The value and value.objectInstance can't be null. + * @throws IOException If an I/O error occurs + * @see #readObjectInstance(InputStream) + */ + public void writeObjectInstance(OutputStream out, ObjectInstanceWrapper value) throws IOException { + // ObjectInstance has no known sub-class. + assert value != null && value.objectInstance != null; + writeStartObject(out); + writeObjectNameField(out, OM_OBJECTNAME, value.objectInstance.getObjectName()); + writeStringField(out, OM_CLASSNAME, value.objectInstance.getClassName()); + writeStringField(out, OM_URL, value.mbeanInfoURL); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve an ObjectInstanceWrapper instance. + * + * @param in The stream to read JSON from + * @return The decoded ObjectInstanceWrapper instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeObjectInstance(OutputStream, ObjectInstanceWrapper) + */ + public ObjectInstanceWrapper readObjectInstance(InputStream in) throws ConversionException, IOException { + return readObjectInstanceInternal(parse(in)); + } + + /** + * Encode an ObjectInstanceWrapper array as JSON: + * [ ObjectInstanceWrapper* ] + * + * @param out The stream to write JSON to + * @param value The ObjectInstanceWrapper array to encode. Can't be null. + * And none of its entries can be null. + * @throws IOException If an I/O error occurs + * @see #readObjectInstances(InputStream) + * @see #writeObjectInstance(OutputStream, ObjectInstanceWrapper) + */ + public void writeObjectInstanceArray(OutputStream out, ObjectInstanceWrapper[] value) throws IOException { + assert value != null; + writeStartArray(out); + for (ObjectInstanceWrapper item : value) { + writeArrayItem(out); + writeObjectInstance(out, item); + } + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve an ObjectInstanceWrapper array. + * + * @param in The stream to read JSON from + * @return The decoded ObjectInstanceWrapper array + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeObjectInstanceArray(OutputStream, ObjectInstanceWrapper[]) + * @see #readObjectInstance(InputStream) + */ + public ObjectInstanceWrapper[] readObjectInstances(InputStream in) throws ConversionException, IOException { + JSONArray json = parseArray(in); + ObjectInstanceWrapper[] ret = new ObjectInstanceWrapper[json.size()]; + int pos = 0; + for (Object item : json) { + ret[pos++] = readObjectInstanceInternal(item); + } + return ret; + } + + /** + * Encode an MBeanQuery instance as JSON: + * { + * "objectName" : ObjectName, + * "queryExp" : Base64, + * "className" : String, + * } + * + * @param out The stream to write JSON to + * @param value The MBeanQuery instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readMBeanQuery(InputStream) + */ + public void writeMBeanQuery(OutputStream out, MBeanQuery value) throws IOException { + assert value != null; + writeStartObject(out); + writeObjectNameField(out, OM_OBJECTNAME, value.objectName); + // TODO: Produce proper JSON for QueryExp? + writeSerializedField(out, OM_QUERYEXP, value.queryExp); + writeStringField(out, OM_CLASSNAME, value.className); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve an MBeanQuery instance. + * + * @param in The stream to read JSON from + * @return The decoded MBeanQuery instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeMBeanQuery(OutputStream, MBeanQuery) + */ + public MBeanQuery readMBeanQuery(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + MBeanQuery ret = new MBeanQuery(); + ret.objectName = readObjectName(json.get(N_OBJECTNAME)); + Object queryExp = readSerialized(json.get(N_QUERYEXP)); + if (queryExp != null && !(queryExp instanceof QueryExp)) { + throwConversionException("readMBeanQuery() receives an instance that's not a QueryExp.", json.get(N_QUERYEXP)); + } + ret.queryExp = (QueryExp) queryExp; + ret.className = readStringInternal(json.get(N_CLASSNAME)); + return ret; + } + + /** + * Encode a CreateMBean instance as JSON: + * { + * "className" : String, + * "objectName" : ObjectName, + * "loaderName" : ObjectName, + * "params" : [ POJO* ], + * "signature" : [ String* ], + * "useLoader" : Boolean, + * "useSignatue" : Boolean + * } + * + * @param out The stream to write JSON to + * @param value The CreateMBean instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readCreateMBean(InputStream) + */ + public void writeCreateMBean(OutputStream out, CreateMBean value) throws IOException { + assert value != null; + writeStartObject(out); + writeStringField(out, OM_CLASSNAME, value.className); + writeObjectNameField(out, OM_OBJECTNAME, value.objectName); + writeObjectNameField(out, OM_LOADERNAME, value.loaderName); + writePOJOArrayField(out, OM_PARAMS, value.params); + writeStringArrayField(out, OM_SIGNATURE, value.signature); + writeBooleanField(out, OM_USELOADER, value.useLoader); + writeBooleanField(out, OM_USESIGNATURE, value.useSignature); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a CreateMBean instance. + * + * @param in The stream to read JSON from + * @return The decoded CreateMBean instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeCreateMBean(OutputStream, CreateMBean) + */ + public CreateMBean readCreateMBean(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + CreateMBean ret = new CreateMBean(); + ret.objectName = readObjectName(json.get(N_OBJECTNAME)); + ret.className = readStringInternal(json.get(N_CLASSNAME)); + ret.loaderName = readObjectName(json.get(N_LOADERNAME)); + ret.params = readPOJOArray(json.get(N_PARAMS)); + ret.signature = readStringArrayInternal(json.get(N_SIGNATURE)); + ret.useLoader = readBooleanInternal(json.get(N_USELOADER)); + ret.useSignature = readBooleanInternal(json.get(N_USESIGNATURE)); + return ret; + } + + /** + * Encode an MBeanInfoWrapper instance as JSON: + * { + * "className" : String, + * "description" : String, + * "descriptor" : Descriptor, + * "attributes" : [ MBeanAttributeInfo* ], + * "attributes_URL" : URL, + * "constructors" : [ MBeanConstructorInfo* ], + * "notifications" : [ MBeanNotificationInfo* ], + * "operations" : [ MBeanOperationInfo* ] + * } + * + * Descriptor: + * { + * "names" : [ String* ],{ + * "values" : [ POJO* ] + * } + * + * MBeanAttributeInfo: + * { + * "name" : String, + * "type" : String, + * "description" : String, + * "descriptor" : Descriptor, + * "isIs" : Boolean, + * "isReadable" : Boolean, + * "isWritable" : Boolean, + * "URL" : URL + * } + * + * MBeanConstructorInfo: + * { + * "name" : String, + * "description" : String, + * "descriptor" : Descriptor, + * "signature" : [ MBeanParameterInfo* ] + * } + * + * MBeanParameterInfo: + * { + * "name" : String, + * "type" : String, + * "description" : String, + * "descriptor" : Descriptor + * } + * + * MBeanNotificationInfo: + * { + * "name" : String, + * "description" : String, + * "descriptor" : Descriptor, + * "notifTypes" [ String* ] + * } + * + * MBeanOperationInfo: + * { + * "name" : String, + * "description" : String, + * "descriptor" : Descriptor, + * "impact" : Integer, + * "returnType" : String, + * "signature" : [ MBeanParameterInfo* ], + * "URI" : URI + * } + * + * @param out The stream to write JSON to + * @param value The MBeanInfoWrapper instance to encode. + * The value and its members can't be null. + * @throws IOException If an I/O error occurs + * @see #readMBeanInfo(InputStream) + */ + public void writeMBeanInfo(OutputStream out, MBeanInfoWrapper value) throws IOException { + // TODO: MBeanInfo has 2 sub-classes, Model*Support and Open*Support. + // How to handle them? "Open" has references to OpenTMBean*Info. + // Model has more convenience methods for retrieving individual + // items, and methods to set the descriptors. + // Same for subclasses of the various items. + assert value != null && value.mbeanInfo != null && value.attributeURLs != null && value.operationURLs != null; + writeStartObject(out); + if (USE_BASE64_FOR_MBEANINFO) { + writeSerializedField(out, OM_SERIALIZED, value.mbeanInfo); + writeStringField(out, OM_ATTRIBUTES_URL, value.attributesURL); + writeSerializedField(out, OM_ATTRIBUTES, value.attributeURLs); + writeSerializedField(out, OM_OPERATIONS, value.operationURLs); + return; + } + if (value.mbeanInfo.getClass() != MBeanInfo.class) { + writeSerializedField(out, OM_SERIALIZED, value.mbeanInfo); + } + writeStringField(out, OM_CLASSNAME, value.mbeanInfo.getClassName()); + writeStringField(out, OM_DESCRIPTION, value.mbeanInfo.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, value.mbeanInfo.getDescriptor()); + writeAttributes(out, OM_ATTRIBUTES, value.mbeanInfo.getAttributes(), value.attributeURLs); + writeStringField(out, OM_ATTRIBUTES_URL, value.attributesURL); + writeConstructors(out, OM_CONSTRUCTORS, value.mbeanInfo.getConstructors()); + writeNotifications(out, OM_NOTIFICATIONS, value.mbeanInfo.getNotifications()); + writeOperations(out, OM_OPERATIONS, value.mbeanInfo.getOperations(), value.operationURLs); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve an MBeanInfoWrapper instance. + * + * Note that all descriptors are of class ImmutableDescriptor. + * + * @param in The stream to read JSON from + * @return The decoded MBeanInfoWrapper instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeMBeanInfo(OutputStream, MBeanInfoWrapper) + */ + @SuppressWarnings("unchecked") + public MBeanInfoWrapper readMBeanInfo(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + MBeanInfoWrapper ret = new MBeanInfoWrapper(); + if (USE_BASE64_FOR_MBEANINFO) { + Object o = readSerialized(json.get(N_SERIALIZED)); + if (!(o instanceof MBeanInfo)) { + throwConversionException("readMBeanInfo() receives an instance that's not a MBeanInfo.", json.get(N_SERIALIZED)); + } + ret.mbeanInfo = (MBeanInfo) o; + ret.attributesURL = readStringInternal(json.get(N_ATTRIBUTES_URL)); + o = readSerialized(json.get(OM_ATTRIBUTES)); + if (!(o instanceof HashMap)) { + throwConversionException("readMBeanInfo() receives an instance that's not a HashMap.", json.get(OM_ATTRIBUTES)); + } + ret.attributeURLs = (Map) o; + o = readSerialized(json.get(OM_OPERATIONS)); + if (!(o instanceof HashMap)) { + throwConversionException("readMBeanInfo() receives an instance that's not a HashMap.", json.get(OM_OPERATIONS)); + } + ret.operationURLs = (Map) o; + return ret; + } + ret.attributeURLs = new HashMap(); + ret.operationURLs = new HashMap(); + String className = readStringInternal(json.get(N_CLASSNAME)); + String description = readStringInternal(json.get(N_DESCRIPTION)); + Descriptor descriptor = readDescriptor(json.get(N_DESCRIPTOR)); + MBeanAttributeInfo[] attributes = readAttributes(json.get(N_ATTRIBUTES), ret.attributeURLs); + String attributeURL = readStringInternal(json.get(N_ATTRIBUTES_URL)); + MBeanConstructorInfo[] constructors = readConstructors(json.get(N_CONSTRUCTORS)); + MBeanNotificationInfo[] notifications = readNotifications(json.get(N_NOTIFICATIONS)); + MBeanOperationInfo[] operations = readOperations(json.get(N_OPERATIONS), ret.operationURLs); + ret.attributesURL = attributeURL; + Object o = json.get(N_SERIALIZED); + if (o != null) { + o = readSerialized(o); + if (!(o instanceof MBeanInfo)) { + throwConversionException("readMBeanInfo() receives an instance that's not a MBeanInfo.", json.get(N_SERIALIZED)); + } + ret.mbeanInfo = (MBeanInfo) o; + } else { + ret.mbeanInfo = new MBeanInfo(className, description, attributes, + constructors, operations, notifications, + descriptor); + } + return ret; + } + + /** + * Encode an AttributeList instance as JSON: + * [ { + * "name" : String, + * "value" : POJO + * }* ] + * + * @param out The stream to write JSON to + * @param value The AttributeList instance to encode. Can be null, + * but its Attribute items can't be null. + * @throws IOException If an I/O error occurs + * @see #readAttributeList(InputStream) + */ + public void writeAttributeList(OutputStream out, AttributeList value) throws IOException { + // AttributeList has no known sub-class. + writeStartArray(out); + if (value != null) { + for (Attribute item : value.asList()) { + assert item != null; + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writePOJOField(out, OM_VALUE, item.getValue()); + writeEndObject(out); + } + } + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve an AttributeList instance. + * + * @param in The stream to read JSON from + * @return The decoded AttributeList instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeAttributeList(OutputStream, AttributeList) + */ + public AttributeList readAttributeList(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONArray json = parseArray(in); + AttributeList ret = new AttributeList(); + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readAttributeList() receives an items that's not a JSONObject.", item); + } + JSONObject jo = (JSONObject) item; + String name = readStringInternal(jo.get(N_NAME)); + Object value = readPOJOInternal(jo.get(N_VALUE)); + ret.add(new Attribute(name, value)); + } + return ret; + } + + /** + * Encode an Invocation instance as JSON: + * { + * "params" : [ POJO* ], + * "signature" : [ String* ] + * } + * + * @param out The stream to write JSON to + * @param value The Invocation instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readInvocation(InputStream) + */ + public void writeInvocation(OutputStream out, Invocation value) throws IOException { + assert value != null; + writeStartObject(out); + writePOJOArrayField(out, OM_PARAMS, value.params); + writeStringArrayField(out, OM_SIGNATURE, value.signature); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve an Invocation instance. + * + * @param in The stream to read JSON from + * @return The decoded Invocation instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeInvocation(OutputStream, Invocation) + */ + public Invocation readInvocation(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + Invocation ret = new Invocation(); + ret.params = readPOJOArray(json.get(N_PARAMS)); + ret.signature = readStringArrayInternal(json.get(N_SIGNATURE)); + return ret; + } + + /** + * Encode a NotificationArea instance as JSON: + * { + * "registrations" : URL, + * "serverRegistrations" : URL, + * "inbox" : URL + * } + * + * @param out The stream to write JSON to + * @param value The NotificationArea instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readNotificationArea(InputStream) + */ + public void writeNotificationArea(OutputStream out, NotificationArea value) throws IOException { + assert value != null; + writeStartObject(out); + writeStringField(out, OM_REGISTRATIONS, value.registrationsURL); + writeStringField(out, OM_SERVERREGISTRATIONS, value.serverRegistrationsURL); + writeStringField(out, OM_INBOX, value.inboxURL); + writeStringField(out, OM_CLIENT, value.clientURL); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a NotificationArea instance. + * + * @param in The stream to read JSON from + * @return The decoded NotificationArea instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeNotificationArea(OutputStream, NotificationArea) + */ + public NotificationArea readNotificationArea(InputStream in) throws ConversionException, IOException { + JSONObject json = parseObject(in); + NotificationArea ret = new NotificationArea(); + ret.registrationsURL = readStringInternal(json.get(N_REGISTRATIONS)); + ret.serverRegistrationsURL = readStringInternal(json.get(N_SERVERREGISTRATIONS)); + ret.inboxURL = readStringInternal(json.get(N_INBOX)); + ret.clientURL = readStringInternal(json.get(N_CLIENT)); + return ret; + } + + /** + * Encode a NotificationRegistration instance as JSON: + * { + * "objectName" : ObjectName, + * "filters" : [ NotificationFilter* ] + * } + * + * @param out The stream to write JSON to + * @param value The NotificationRegistration instance to encode. + * Can't be null. See writeNotificationFilters() for + * requirements on the filters. + * @throws IOException If an I/O error occurs + * @see #readNotificationRegistration(InputStream) + * @see #writeNotificationFilters(OutputStream, NotificationFilter[]) + */ + public void writeNotificationRegistration(OutputStream out, NotificationRegistration value) throws IOException { + assert value != null; + writeStartObject(out); + writeObjectNameField(out, OM_OBJECTNAME, value.objectName); + writeNotificationFiltersField(out, OM_FILTERS, value.filters); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a NotificationRegistration instance. + * + * @param in The stream to read JSON from + * @return The decoded NotificationRegistration instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeNotificationRegistration(OutputStream, NotificationRegistration) + */ + public NotificationRegistration readNotificationRegistration(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + NotificationRegistration ret = new NotificationRegistration(); + ret.objectName = readObjectName(json.get(N_OBJECTNAME)); + ret.filters = readNotificationFiltersInternal(json.get(N_FILTERS)); + return ret; + } + + /** + * Encode a ServerNotificationRegistration instance as JSON: + * { + * "operation" : ("Add" | "RemoveAll" | "RemoveSpecific") + * "objectName" : ObjectName, + * "listener" : ObjectName, + * "filter" : NotificationFilter, + * "handback" : POJO, + * "filterID" : Integer, + * "handbackID" : Integer + * } + * + * @param out The stream to write JSON to + * @param value The ServerNotificationRegistration instance to encode. + * Can't be null. + * @throws IOException If an I/O error occurs + * @see #readServerNotificationRegistration(InputStream) + */ + public void writeServerNotificationRegistration(OutputStream out, ServerNotificationRegistration value) throws IOException { + assert value != null; + writeStartObject(out); + boolean hasOperation = value.operation != null; + if (hasOperation) { + writeSimpleStringField(out, OM_OPERATION, value.operation.name()); + } + writeObjectNameField(out, OM_OBJECTNAME, value.objectName); + writeObjectNameField(out, OM_LISTENER, value.listener); + writeNotificationFilterField(out, OM_FILTER, value.filter); + writePOJOField(out, OM_HANDBACK, value.handback); + if (hasOperation) { + writeIntField(out, OM_FILTERID, value.filterID); + writeIntField(out, OM_HANDBACKID, value.handbackID); + } + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a ServerNotificationRegistration instance. + * + * @param in The stream to read JSON from + * @return The decoded ServerNotificationRegistration instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeServerNotificationRegistration(OutputStream, ServerNotificationRegistration) + */ + public ServerNotificationRegistration readServerNotificationRegistration(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONObject json = parseObject(in); + ServerNotificationRegistration ret = new ServerNotificationRegistration(); + String name = readStringInternal(json.get(N_OPERATION)); + ret.operation = name != null ? Operation.valueOf(name) : null; + ret.objectName = readObjectName(json.get(N_OBJECTNAME)); + ret.listener = readObjectName(json.get(N_LISTENER)); + ret.filter = readNotificationFilterInternal(json.get(N_FILTER), true); + ret.handback = readPOJOInternal(json.get(N_HANDBACK)); + ret.filterID = readIntInternal(json.get(N_FILTERID)); + ret.handbackID = readIntInternal(json.get(N_HANDBACKID)); + return ret; + } + + /** + * Check if a NotificationFilter is a standard filter that can be + * send to a JMX server. + * + * @param filter The filter to check. Can't be null. + * @return Whether the filter is a standard one + */ + public boolean isSupportedNotificationFilter(NotificationFilter filter) { + Class clazz = filter.getClass(); + return clazz == AttributeChangeNotificationFilter.class || + clazz == MBeanServerNotificationFilter.class || + clazz == NotificationFilterSupport.class; + } + + /** + * Encode a NotificationFilter array as JSON: + * [ NotificationFilter* ] + * + * Format of NotificationFilter: + * { + * className: "AttributeChangeNotificationFilter" | "MBeanServerNotificationFilter" | "NotificationFilterSupport", + * enabled: [ String* ], // For AttributeChangeNotificationFilter and MBeanServerNotificationFilter + * disabled: [ String* ], // For MBeanServerNotificationFilter + * types: [ String* ], // For MBeanServerNotificationFilter and NotificationFilterSupport + * } + * + * @param out The stream to write JSON to + * @param value The NotificationFilter array to encode. Can be null. + * The individual filters can't be null either. They must be of + * one of the 3 known filter classes. + * @throws IOException If an I/O error occurs + * @see #readNotificationFilters(InputStream) + */ + public void writeNotificationFilters(OutputStream out, NotificationFilter[] value) throws IOException { + writeNotificationFiltersInternal(out, value); + } + + /** + * Decode a JSON document to retrieve a NotificationFilter array. + * + * @param in The stream to read JSON from + * @return The decoded NotificationFilter array + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeNotificationFilters(OutputStream, NotificationFilter[]) + */ + public NotificationFilter[] readNotificationFilters(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + return readNotificationFiltersInternal(parseArray(in)); + } + + /** + * Encode an array of Notification instance as JSON: + * + * @param out The stream to write JSON to + * @param value The Notification array to encode. Value can be null, + * but its items can't be null. + * The "source" of the items must be an instance of ObjectName. + * @throws IOException If an I/O error occurs + * @see #readNotifications(InputStream) + */ + public void writeNotifications(OutputStream out, Notification[] value) throws IOException { + final NotificationRecord[] records; + if (value != null) { + records = new NotificationRecord[value.length]; + for (int i = 0; i < value.length; ++i) { + Notification n = value[i]; + if (n != null) { + Object source = n.getSource(); + NotificationRecord nr; + if (source instanceof ObjectName) { + nr = new NotificationRecord(n, (ObjectName) source); + } else { + nr = new NotificationRecord(n, (source != null) ? source.toString() : null); + } + records[i] = nr; + } + } + } else { + records = null; + } + writeNotificationRecords(out, records); + } + + /** + * Encode an array of NotificationRecord instance as JSON: + * [ { + * "className" : "String", // The class name of the Notification object + * "serialized" : "Base64", // If the object is not of one of the known + * // classes, then base64 serialize it. + * "type" : String, + * "source" : POJO, + * "sequenceNumber" : Long, + * "timeStamp" : Long, + * "message" : String, + * "userData" : POJO, + * + * "hostName" : String, // For routed Notifications only + * "serverName" : String, + * "serverUserDir" : String, + * + * "attributeName" : String, // For AttributeChangeNotification only + * "attributeType" : String, + * "oldValue", POJO, + * "newValue", POJO, + * + * "connectionId" : String, // For JMXConnectionNotification + * + * "mbeanName" : String, // For MBeanServerNotification + * + * "relationId" : String, // For RelationNotification + * "relationTypeName" : String, + * "objectName" : String, + * "mbeansToUnregister" : [ String* ], + * "roleName" : String, + * "oldRoleValue" : [String*], + * "newRoleValue" : [String*], + * + * "notificationID" : Integer, // For TimerNotification + * } * ] + * + * @param out The stream to write JSON to + * @param value The NotificationRecord array to encode. Value can be null, + * but its items can't be null. + * The "source" of the items must be an instance of ObjectName. + * @throws IOException If an I/O error occurs + * @see #readNotificationRecords(InputStream) + */ + public void writeNotificationRecords(OutputStream out, NotificationRecord[] value) throws IOException { + writeStartArray(out); + if (value == null) { + writeEndArray(out); + return; + } + + for (NotificationRecord nr : value) { + assert nr != null; + Notification item = nr.getNotification(); + assert item != null; + writeArrayItem(out); + writeStartObject(out); + + // Fields common to all notification classes + Class clazz = item.getClass(); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + writeStringField(out, OM_TYPE, item.getType()); + ObjectName on = null; + if (item.getSource() instanceof String) { + try { + on = new ObjectName((String) item.getSource()); + } catch (Exception e) { + } + } else { + on = (ObjectName) item.getSource(); + } + + writeObjectNameField(out, OM_SOURCE, on); + writeLongField(out, OM_SEQUENCENUMBER, item.getSequenceNumber()); + writeLongField(out, OM_TIMESTAMP, item.getTimeStamp()); + writeStringField(out, OM_MESSAGE, item.getMessage()); + writePOJOField(out, OM_USERDATA, item.getUserData()); + + // Write routing information (host name, server name, server user dir) if this is a routed notification. + final Map routingInfo = nr.getNotificationTargetInformation().getRoutingInformation(); + if (routingInfo != null) { + String hostName = (String) routingInfo.get(ClientProvider.ROUTING_KEY_HOST_NAME); + String serverName = (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_NAME); + String serverUserDir = (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_USER_DIR); + + assert hostName != null; + assert serverName != null; + assert serverUserDir != null; + + writeStringField(out, OM_HOSTNAME, hostName); + writeStringField(out, OM_SERVERNAME, serverName); + writeStringField(out, OM_SERVERUSERDIR, serverUserDir); + } + + if (clazz == Notification.class) { + } else if (clazz == AttributeChangeNotification.class) { + AttributeChangeNotification v = (AttributeChangeNotification) item; + writeStringField(out, OM_ATTRIBUTENAME, v.getAttributeName()); + writeStringField(out, OM_ATTRIBUTETYPE, v.getAttributeType()); + writePOJOField(out, OM_OLDVALUE, v.getOldValue()); + writePOJOField(out, OM_NEWVALUE, v.getNewValue()); + } else if (clazz == JMXConnectionNotification.class) { + JMXConnectionNotification v = (JMXConnectionNotification) item; + writeStringField(out, OM_CONNECTIONID, v.getConnectionId()); + } else if (clazz == MBeanServerNotification.class) { + MBeanServerNotification v = (MBeanServerNotification) item; + writeObjectNameField(out, OM_MBEANNAME, v.getMBeanName()); + } else if (clazz == RelationNotification.class) { + RelationNotification v = (RelationNotification) item; + writeStringField(out, OM_RELATIONID, v.getRelationId()); + writeStringField(out, OM_RELATIONTYPENAME, v.getRelationTypeName()); + writeObjectNameField(out, OM_OBJECTNAME, v.getObjectName()); + String roleName = v.getRoleName(); + if (roleName == null) { + writeObjectNameListField(out, OM_MBEANSTOUNREGISTER, v.getMBeansToUnregister()); + } else { + writeStringField(out, OM_ROLENAME, v.getRoleName()); + writeObjectNameListField(out, OM_OLDROLEVALUE, v.getOldRoleValue()); + writeObjectNameListField(out, OM_NEWROLEVALUE, v.getNewRoleValue()); + } + } else if (clazz == TimerNotification.class) { + TimerNotification v = (TimerNotification) item; + writeIntField(out, OM_NOTIFICATIONID, v.getNotificationID()); + } else { + // MonitorNotification and TimerAlarmClockNotification are + // known, but either the class or the constructor is not + // visible, and we have to use base64. + // SnmpTableEntryNotification is a sun specific implementation. + writeSerializedField(out, OM_SERIALIZED, item); + } + + writeEndObject(out); + } + writeEndArray(out); + } + + /** + * Decode a JSON document to retrieve an array of Notification instances. + * + * @param in The stream to read JSON from + * @return The decoded Notification array + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeNotifications(OutputStream, Notification[]) + */ + public Notification[] readNotifications(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + final NotificationRecord[] records = readNotificationRecords(in); + final Notification[] ret = new Notification[records.length]; + for (int i = 0; i < records.length; ++i) { + ret[i] = records[i].getNotification(); + } + return ret; + } + + /** + * Decode a JSON document to retrieve an array of NotificationRecord instances. + * + * @param in The stream to read JSON from + * @return The non-null decoded NotificationRecord array + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeNotificationRecords(OutputStream, NotificationRecord[]) + */ + public NotificationRecord[] readNotificationRecords(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + JSONArray json = parseArray(in); + int size = json.size(); + NotificationRecord[] ret = new NotificationRecord[size]; + for (int i = 0; i < size; i++) { + Object o = json.get(i); + if (!(o instanceof JSONObject)) { + throwConversionException("readNotifications() expects a JSONObject.", o); + } + JSONObject obj = (JSONObject) o; + + // Fields common to all Notification classes. + String className = readStringInternal(obj.get(N_CLASSNAME)); + String type = readStringInternal(obj.get(N_TYPE)); + ObjectName source = readObjectName(obj.get(N_SOURCE)); + long sequenceNumber = readLongInternal(obj.get(N_SEQUENCENUMBER)); + long timeStamp = readLongInternal(obj.get(N_TIMESTAMP)); + String message = readStringInternal(obj.get(N_MESSAGE)); + Object userData = readPOJOInternal(obj.get(N_USERDATA)); + + // Read routing information (host name, server name, server user dir) if this is a routed notification. + String hostName = readStringInternal(obj.get(N_HOSTNAME)); + String serverName; + String serverUserDir; + if (hostName != null) { + serverName = readStringInternal(obj.get(N_SERVERNAME)); + serverUserDir = readStringInternal(obj.get(N_SERVERUSERDIR)); + } else { + serverName = null; + serverUserDir = null; + } + + Notification n; + if ("javax.management.Notification".equals(className)) { + n = new Notification(type, source, sequenceNumber, timeStamp, message); + } else if ("javax.management.AttributeChangeNotification".equals(className)) { + if (!AttributeChangeNotification.ATTRIBUTE_CHANGE.equals(type)) { + throwConversionException("Type for AttributeChangeNotification should be ATTRIBUTE_CHANGE", o); + } + String attributeName = readStringInternal(obj.get(N_ATTRIBUTENAME)); + String attributeType = readStringInternal(obj.get(N_ATTRIBUTETYPE)); + Object oldValue = readPOJOInternal(obj.get(N_OLDVALUE)); + Object newValue = readPOJOInternal(obj.get(N_NEWVALUE)); + n = new AttributeChangeNotification(source, sequenceNumber, timeStamp, message, + attributeName, attributeType, oldValue, newValue); + } else if ("javax.management.remote.JMXConnectionNotification".equals(className)) { + String connectionId = readStringInternal(obj.get(N_CONNECTIONID)); + n = new JMXConnectionNotification(type, source, connectionId, sequenceNumber, message, userData); + // Replace the value set by the constructor + n.setTimeStamp(timeStamp); + } else if ("javax.management.MBeanServerNotification".equals(className)) { + ObjectName objectName = readObjectName(obj.get(N_MBEANNAME)); + n = new MBeanServerNotification(type, source, sequenceNumber, objectName); + // Replace the value set by the constructor + n.setTimeStamp(timeStamp); + } else if ("javax.management.relation.RelationNotification".equals(className)) { + String relationId = readStringInternal(obj.get(N_RELATIONID)); + String typeName = readStringInternal(obj.get(N_RELATIONTYPENAME)); + ObjectName objectName = readObjectName(obj.get(N_OBJECTNAME)); + String roleName = readStringInternal(obj.get(N_ROLENAME)); + if (roleName == null) { + List mbeansToUnregister = readObjectNameList(obj.get(N_MBEANSTOUNREGISTER)); + n = new RelationNotification(type, source, sequenceNumber, timeStamp, message, + relationId, typeName, objectName, mbeansToUnregister); + } else { + List oldValue = readObjectNameList(obj.get(N_OLDROLEVALUE)); + List newValue = readObjectNameList(obj.get(N_NEWROLEVALUE)); + n = new RelationNotification(type, source, sequenceNumber, timeStamp, message, + relationId, typeName, objectName, + roleName, oldValue, newValue); + } + } else if ("javax.management.timer.TimerNotification".equals(className)) { + Integer notificationID = readIntInternal(obj.get(N_NOTIFICATIONID)); + n = new TimerNotification(type, source, sequenceNumber, timeStamp, message, notificationID); + } else { + Object serialized = readSerialized(obj.get(N_SERIALIZED)); + if (!(serialized instanceof Notification)) { + throwConversionException("readNotifications() expects a Notification.", o); + } + n = (Notification) serialized; + } + + n.setUserData(userData); + + final NotificationRecord nr; + if (hostName != null) { + nr = new NotificationRecord(n, source, hostName, serverName, serverUserDir); + } else { + nr = new NotificationRecord(n, source); + } + ret[i] = nr; + } + return ret; + } + + /** + * Encode a NotificationSettings instance as JSON: + * { + * "deliveryInterval" : Integer + * } + * + * @param out The stream to write JSON to + * @param value The NotificationSettings instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readNotificationSettings(InputStream) + */ + public void writeNotificationSettings(OutputStream out, NotificationSettings value) throws IOException { + assert value != null; + writeStartObject(out); + writeIntField(out, OM_DELIVERYINTERVAL, value.deliveryInterval); + writeIntField(out, OM_INBOXEXPIRTY, value.inboxExpiry); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a NotificationSettings instance. + * + * @param in The stream to read JSON from + * @return The decoded NotificationSettings instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @see #writeNotificationSettings(OutputStream, NotificationSettings) + */ + public NotificationSettings readNotificationSettings(InputStream in) throws ConversionException, IOException { + JSONObject json = parseObject(in); + NotificationSettings ret = new NotificationSettings(); + ret.deliveryInterval = readIntInternal(json.get(N_DELIVERYINTERVAL)); + ret.inboxExpiry = readIntInternal(json.get(N_INBOXEXPIRY)); + return ret; + } + + /** + * Encode a Throwable instance as JSON: + * { + * "throwable" : Base64, + * "stackTrace" : String + * } + * + * @param out The stream to write JSON to + * @param value The Throwable instance to encode. Can't be null. + * @throws IOException If an I/O error occurs + * @see #readThrowable(InputStream) + */ + public void writeThrowable(OutputStream out, Throwable value) throws IOException { + assert value != null; + writeStartObject(out); + writeSerializedField(out, OM_THROWABLE, value); + StringWriter sw = new StringWriter(); + value.printStackTrace(new PrintWriter(sw)); + writeStringField(out, OM_STACKTRACE, sw.toString()); + writeEndObject(out); + } + + /** + * Decode a JSON document to retrieve a Throwable instance. + * + * @param in The stream to read JSON from + * @return The decoded Throwable instance + * @throws ConversionException If JSON uses unexpected structure/format + * @throws IOException If an I/O error occurs or if JSON is ill-formed. + * @throws ClassNotFoundException If needed class can't be found. + * @see #writeThrowable(OutputStream, Throwable) + */ + public Throwable readThrowable(InputStream in) throws ConversionException, IOException, ClassNotFoundException { + byte[] byteInputStream = convertInputStreamToBytes(in); + ByteArrayInputStream bais = new ByteArrayInputStream(byteInputStream); + JSONObject json = null; + try { + json = parseObject(bais); + } catch (IOException ex) { + bais.reset(); + throw new RuntimeException(convertStreamToString(bais)); + } + Object t = readSerialized(json.get(N_THROWABLE)); + if (!(t instanceof Throwable)) { + throwConversionException("readThrowable() receives an instance that's not a Throwable.", json.get(N_THROWABLE)); + } + return (Throwable) t; + } + + /** + * Converts inputstream to bytearray + * + * @param in + * @return + * @throws IOException + */ + private byte[] convertInputStreamToBytes(InputStream in) throws IOException { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + + int len; + byte[] data = new byte[16384]; + + while ((len = in.read(data, 0, data.length)) != -1) { + buffer.write(data, 0, len); + } + + buffer.flush(); + return buffer.toByteArray(); + } + + /** + * Converts inputstream to String + * + * @param in + * @return + * @throws IOException + */ + + private String convertStreamToString(InputStream input) throws IOException { + BufferedReader reader = new BufferedReader(new InputStreamReader(input)); + StringBuilder sb = new StringBuilder(); + String line = null; + + while ((line = reader.readLine()) != null) { + sb.append(line); + } + + input.close(); + return sb.toString(); + } + + /** + * Encode a String in base64. The content of the string is first encoded + * as UTF-8 bytes, the bytes are then base64 encoded. The resulting base64 + * value is returned as a String. + * + * @param value The String to encode + * @return The encoded base64 String + * @throws ConversionException If the String content can not be UTF-8 encoded. + */ + public String encodeStringAsBase64(String value) throws ConversionException { + try { + return encodeStringAsBase64Internal(value); + } catch (IOException e) { + // Will never happen + return null; + } + } + + @SuppressWarnings("deprecation") + private String encodeStringAsBase64Internal(String value) throws ConversionException, IOException { + final Base64OutputStream out = base64Stream; + byteArrayOS.reset(); + out.start(byteArrayOS); + for (int i = 0; i < value.length(); i++) { + char ch = value.charAt(i); + if (ch < 0x80) { + // 1-byte + out.write(ch); + } else if (ch < 0x800) { + // 2-byte + out.write(0xC0 | (ch >> 6)); + out.write(0x80 | (0x3F & ch)); + } else if (ch < 0xD800 || ch >= 0xE000) { + // 3-byte + out.write(0xE0 | (ch >> 12)); + out.write(0x80 | (0x3F & (ch >> 6))); + out.write(0x80 | (0x3F & ch)); + } else if (ch < 0xDC00) { + // 4-byte. Surrogate pair. + if (i == value.length() - 1) { + // Error if second half is missing + utf8EncodeError(value); + } else { + char ch2 = value.charAt(i + 1); + if (ch2 >= 0xDC00 && ch2 < 0xE000) { + int c = 0x00010000 + ((ch - 0xD800) << 10) + (ch2 - 0xDC00); + out.write(0xF0 | (c >> 18)); /* no mask needed */ + out.write(0x80 | (0x3F & (c >> 12))); + out.write(0x80 | (0x3F & (c >> 6))); + out.write(0x80 | (0x3F & c)); + i++; + } else { + // Error if second half is out of range + utf8EncodeError(value); + } + } + } else { + // Error if first half is out of range + utf8EncodeError(value); + } + } + out.end(); + // Base64 encoded String only has ASCII characters. + return byteArrayOS.toString(0); + } + + private void writeStartObject(OutputStream out) throws IOException { + out.write('{'); + firstItem = true; + } + + private void writeFieldName(OutputStream out, byte[] name) throws IOException { + if (firstItem) { + firstItem = false; + } else { + out.write(','); + } + out.write(name); + } + + private void writeSimpleFieldName(OutputStream out, String name) throws IOException { + if (firstItem) { + firstItem = false; + } else { + out.write(','); + } + writeSimpleString(out, name); + out.write(':'); + } + + private void escapeFieldName(OutputStream out, String name) throws IOException { + if (firstItem) { + firstItem = false; + } else { + out.write(','); + } + writeStringInternal(out, name); + out.write(':'); + } + + private void writeEndObject(OutputStream out) throws IOException { + out.write('}'); + firstItem = false; + } + + private void writeStartArray(OutputStream out) throws IOException { + out.write('['); + firstItem = true; + } + + private void writeArrayItem(OutputStream out) throws IOException { + if (firstItem) { + firstItem = false; + } else { + out.write(','); + } + } + + private void writeEndArray(OutputStream out) throws IOException { + out.write(']'); + firstItem = false; + } + + /** + * Debug (dump) the contents of an input stream. This effectively copies + * the input stream into a byte array, dumps one and then returns another. + * If logging is not enabled, nothing happens. + * + * @param in + * @throws IOException + */ + private InputStream debugInputStream(InputStream in) throws IOException { + if (logger.isLoggable(Level.FINEST)) { + final byte[] buffer = new byte[1024]; + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + int len; + String line; + + logger.finest("[START] Dumping the InputStream that will be passed to JSON.parse()"); + while ((len = in.read(buffer)) > -1) { + baos.write(buffer, 0, len); + } + baos.flush(); + + ByteArrayInputStream dumpIn = new ByteArrayInputStream(baos.toByteArray()); + BufferedReader br = new BufferedReader(new InputStreamReader(dumpIn)); + while ((line = br.readLine()) != null) { + logger.finest(line); + } + logger.finest("[END] Dumping the InputStream that will be passed to JSON.parse()"); + + return new ByteArrayInputStream(baos.toByteArray()); + } else { + return in; + + } + } + + /** + * Parse (and possible debug) the InputStream as a JSONArtifact. + * + * @param in + * @return + * @throws IOException + */ + private JSONArtifact debugAndParse(InputStream in) throws IOException { + return JSON.parse(debugInputStream(in)); + } + + private Object parse(InputStream in) throws IOException { + return debugAndParse(in); + } + + private JSONObject parseObject(InputStream in) throws ConversionException, IOException { + JSONArtifact json = debugAndParse(in); + if (!(json instanceof JSONObject)) { + throwConversionException("parseObject() receives an instance that's not a JSONObject.", json); + } + return (JSONObject) json; + } + + private JSONArray parseArray(InputStream in) throws ConversionException, IOException { + JSONArtifact json = debugAndParse(in); + if (!(json instanceof JSONArray)) { + throwConversionException("parseArray() receives an instance that's not a JSONArray.", json); + } + return (JSONArray) json; + } + + private byte readByteInternal(Object in) throws ConversionException { + int value = readIntInternal(in); + if (value > Byte.MAX_VALUE || value < Byte.MIN_VALUE) { + throwConversionException("readByteInternal() receives an out-of-range value.", in); + } + return (byte) value; + } + + private short readShortInternal(Object in) throws ConversionException { + int value = readIntInternal(in); + if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) { + throwConversionException("readShortInternal() receives an out-of-range value.", in); + } + return (short) value; + } + + private void writeIntField(OutputStream out, byte[] name, int value) throws IOException { + writeFieldName(out, name); + writeIntInternal(out, value); + } + + private void writeIntInternal(OutputStream out, int value) throws IOException { + out.write('"'); + encodeInt(out, value); + out.write('"'); + } + + private void encodeInt(OutputStream out, int value) throws IOException { + if (value < 0) { + // -Integer.MIN_VALUE is out of "int" range. Special-casing it. + if (value == Integer.MIN_VALUE) { + out.write(INT_MIN); + return; + } + + // Turn value to positive so that % and / work as expected. + out.write('-'); + value = -value; + } + + // Write from right to left + final byte[] bytes = BYTE_BUFFER; + int pos = BYTE_BUFFER.length; + do { + int q = value / 10; + int r = value - (q << 3) - (q << 1); // same as (value - q * 10) + value = q; + bytes[--pos] = (byte) (r + '0'); + } while (value != 0); + + out.write(bytes, pos, BYTE_BUFFER.length - pos); + } + + private int readIntInternal(Object in) throws ConversionException { + if (in == null) { + return 0; + } + + if (!(in instanceof String)) { + throwConversionException("readIntInternal() expects a String.", in); + } + try { + return Integer.parseInt((String) in); + } catch (NumberFormatException e) { + throwConversionException(e, in); + return 0; + } + } + + private void writeLongField(OutputStream out, byte[] name, long value) throws IOException { + writeFieldName(out, name); + writeLongInternal(out, value); + } + + private void writeLongInternal(OutputStream out, long value) throws IOException { + out.write('"'); + encodeLong(out, value); + out.write('"'); + } + + private void encodeLong(OutputStream out, long value) throws IOException { + if (value < 0) { + // -Long.MIN_VALUE is out of "long" range. Special-casing it. + if (value == Long.MIN_VALUE) { + out.write(LONG_MIN); + return; + } + + // Turn value to positive so that % and / work as expected. + out.write('-'); + value = -value; + } + + // Write from right to left + final byte[] bytes = BYTE_BUFFER; + int pos = BYTE_BUFFER.length; + do { + long q = value / 10; + long r = value - (q << 3) - (q << 1); // same as (value - q * 10) + value = q; + bytes[--pos] = (byte) (r + '0'); + } while (value != 0); + + out.write(bytes, pos, BYTE_BUFFER.length - pos); + } + + private long readLongInternal(Object in) throws ConversionException { + if (!(in instanceof String)) { + throwConversionException("readLongInternal() expects a String.", in); + } + try { + return Long.parseLong((String) in); + } catch (NumberFormatException e) { + throwConversionException(e, in); + return 0; + } + } + + private float readFloatInternal(Object in) throws ConversionException { + if (!(in instanceof String)) { + throwConversionException("readFloatInternal() expects a String.", in); + } + try { + return Float.parseFloat((String) in); + } catch (NumberFormatException e) { + throwConversionException(e, in); + return 0; + } + } + + private double readDoubleInternal(Object in) throws ConversionException { + if (!(in instanceof String)) { + throwConversionException("readDoubleInternal() expects a String.", in); + } + try { + return Double.parseDouble((String) in); + } catch (NumberFormatException e) { + throwConversionException(e, in); + return 0; + } + } + + private char readCharInternal(Object in) throws ConversionException { + if (!(in instanceof String)) { + throwConversionException("readCharInternal() expects a String.", in); + } + String str = (String) in; + if (str.length() != 1) { + throwConversionException("readCharInternal() expects a String of length 1.", in); + } + return str.charAt(0); + } + + private void writeBooleanField(OutputStream out, byte[] name, boolean value) throws IOException { + writeFieldName(out, name); + writeBooleanInternal(out, value); + } + + private void writeBooleanInternal(OutputStream out, boolean value) throws IOException { + out.write(value ? TRUE : FALSE); + } + + private boolean readBooleanInternal(Object in) throws ConversionException { + if (!(in instanceof Boolean)) { + throwConversionException("readBooleanInternal() expects a Boolean.", in); + } + return ((Boolean) in).booleanValue(); + } + + private void writeSimpleStringField(OutputStream out, byte[] name, CharSequence value) throws IOException { + writeFieldName(out, name); + writeSimpleString(out, value); + } + + // Called for ASCII Strings that don't contain any need-to-escape characters. + // The value can't be null. + private void writeSimpleString(OutputStream out, CharSequence value) throws IOException { + out.write('"'); + for (int i = 0; i < value.length(); i++) { + out.write(value.charAt(i)); + } + out.write('"'); + } + + private void writeStringField(OutputStream out, byte[] name, String value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStringInternal(out, value); + } + + private void writeStringInternal(OutputStream out, String value) throws IOException { + if (value == null) { + out.write(NULL); + return; + } + + out.write('"'); + escapeString(out, value); + out.write('"'); + } + + private void escapeString(OutputStream out, String value) throws IOException { + for (int i = 0; i < value.length(); i++) { + char ch = value.charAt(i); + // Escape '"' and '\' + if (ch == '"') { + out.write('\\'); + out.write('"'); + } else if (ch == '\\') { + out.write('\\'); + out.write('\\'); + } else if (ch >= 0x80) { + // Multi-byte chars + if (ch < 0x800) { + // 2-byte + out.write(0xC0 | (ch >> 6)); + out.write(0x80 | (0x3F & ch)); + } else if (ch < 0xD800 || ch >= 0xE000) { + // 3-byte + out.write(0xE0 | (ch >> 12)); + out.write(0x80 | (0x3F & (ch >> 6))); + out.write(0x80 | (0x3F & ch)); + } else if (ch < 0xDC00) { + // 4-byte. Surrogate pair. + if (i == value.length() - 1) { + // Error if second half is missing + writeInvalidChar(out, ch); + } else { + char ch2 = value.charAt(i + 1); + if (ch2 >= 0xDC00 && ch2 < 0xE000) { + int c = 0x00010000 + ((ch - 0xD800) << 10) + (ch2 - 0xDC00); + out.write(0xF0 | (c >> 18)); /* no mask needed */ + out.write(0x80 | (0x3F & (c >> 12))); + out.write(0x80 | (0x3F & (c >> 6))); + out.write(0x80 | (0x3F & c)); + i++; + } else { + // Error if second half is out of range + writeInvalidChar(out, ch); + } + } + } else { + // Error if first half is out of range + writeInvalidChar(out, ch); + } + } else if (ch >= 0x20) { + // Common case: ASCII and not special + out.write(ch); + } else { + // Escape control characters. + out.write('\\'); + switch (ch) { + case 8: + out.write('b'); + break; + case 9: + out.write('t'); + break; + case 0xA: + out.write('n'); + break; + case 0xC: + out.write('f'); + break; + case 0xD: + out.write('r'); + break; + default: + out.write('u'); + out.write('0'); + out.write('0'); + out.write(hex(ch >> 4)); + out.write(hex(ch & 0xf)); + } + } + } + } + + private void writeInvalidChar(OutputStream out, char value) throws IOException { + out.write('\\'); + out.write('u'); + out.write(hex(value >> 12)); + out.write(hex((value >> 8) & 0xf)); + out.write(hex((value >> 4) & 0xf)); + out.write(hex(value & 0xf)); + } + + private byte hex(int value) { + return (byte) (value < 10 ? value + '0' : value + 'A' - 10); + } + + private String readStringInternal(Object in) throws ConversionException { + if (in == null) { + return null; + } + if (!(in instanceof String)) { + throwConversionException("readStringInternal() expects a String.", in); + } + // The JSON parser already decoded the string. + return (String) in; + } + + private void writeStringArrayField(OutputStream out, byte[] name, String[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStringArrayInternal(out, value); + } + + private void writeStringArrayInternal(OutputStream out, String[] value) throws IOException { + writeStartArray(out); + if (value != null) { + for (String s : value) { + writeArrayItem(out); + writeStringInternal(out, s); + } + } + writeEndArray(out); + } + + private String[] readStringArrayInternal(Object in) throws ConversionException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readStringArrayInternal() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + int size = json.size(); + String[] ret = new String[size]; + for (int i = 0; i < size; i++) { + ret[i] = readStringInternal(json.get(i)); + } + return ret; + } + + private void writeSerializedField(OutputStream out, byte[] name, Object value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeSerialized(out, value); + } + + private void writeSerialized(OutputStream out, Object value) throws IOException { + if (value == null) { + out.write(NULL); + return; + } + out.write('"'); + base64Stream.start(out); + ObjectOutputStream objectOut = new ObjectOutputStream(base64Stream); + objectOut.writeObject(value); + base64Stream.end(); + out.write('"'); + } + + private Object readSerialized(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof String)) { + throwConversionException("readSerialized() expects a String.", in); + } + String value = (String) in; + int slen = value.length(); + if (slen == 0 || slen / 4 * 4 != slen) { + base64DecodeError(in); + } + int blen = slen / 4 * 3; + byte[] binary = new byte[blen]; + int c1 = 0, c2 = 0, c3 = 0, c4 = 0, pos = 0; + for (int i = 0; i < slen;) { + c1 = value.charAt(i++); + c2 = value.charAt(i++); + c3 = value.charAt(i++); + c4 = value.charAt(i++); + if (c1 >= BASE64_D.length || BASE64_D[c1] == -1 || + c2 >= BASE64_D.length || BASE64_D[c2] == -1 || + c2 >= BASE64_D.length || BASE64_D[c3] == -1 || + c2 >= BASE64_D.length || BASE64_D[c4] == -1) { + base64DecodeError(in); + } + c1 = BASE64_D[c1]; + c2 = BASE64_D[c2]; + c3 = BASE64_D[c3]; + c4 = BASE64_D[c4]; + binary[pos++] = (byte) ((c1 << 2) | (c2 >> 4)); + binary[pos++] = (byte) ((c2 << 4) | (c3 >> 2)); + binary[pos++] = (byte) ((c3 << 6) | c4); + } + + if (value.charAt(slen - 1) == '=') { + if (binary[--blen] != 0) { + base64DecodeError(in); + } + if (value.charAt(slen - 2) == '=') { + if (binary[--blen] != 0) { + base64DecodeError(in); + } + } + } + + return helper.readObject(in, blen, binary); + } + + public static void setSerializationHelper(SerializationHelper sh) { + if (null == sh) { + helper = defaultHelper; + } else { + helper = sh; + } + } + + private void writePOJOField(OutputStream out, byte[] name, Object value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writePOJOInternal(out, value); + } + + private void writePOJOInternal(OutputStream out, Object value) throws IOException { + if (USE_BASE64_FOR_POJO) { + writeStartObject(out); + if (value != null) { + writeSimpleStringField(out, OM_CLASSNAME, value.getClass().getName()); + writeSerializedField(out, OM_SERIALIZED, value); + } + writeEndObject(out); + return; + } + + writeStartObject(out); + // Merge this with the "writeType" method? + // Then need to write "type" content into the byateArrayOS. + if (hasCycle(value, new Stack())) { + // If the value object contains cycle, then java-serialize it. + writeSerializedField(out, OM_SERIALIZED, value); + } else { + writeFieldName(out, OM_VALUE); + writePOJOValue(out, value); + writeFieldName(out, OM_TYPE); + List> openTypes = new ArrayList>(); + writePOJOType(out, value, openTypes); + writeOpenTypes(out, openTypes); + } + writeEndObject(out); + } + + private boolean hasCycle(Object value, Stack seen) { + if (value == null) { + return false; + } + + for (Object o : seen) { + if (o == value) { + return true; + } + } + + Class clazz = value.getClass(); + + if (clazz.isArray()) { + Class componentType = clazz.getComponentType(); + if (componentType.isPrimitive()) { + return false; + } + + Class leaf = componentType; + while (leaf.isArray()) { + leaf = leaf.getComponentType(); + } + if (SupportedClasses.get(leaf) == null) { + return false; + } + + if (SimpleArrays.contains(leaf)) { + return false; + } + + seen.push(value); + for (Object o : (Object[]) value) { + if (hasCycle(o, seen)) { + return true; + } + } + seen.pop(); + return false; + } + + TYPE type = SupportedClasses.get(clazz); + if (type == null) { + return false; + } + + switch (type) { + case Byte: + case Short: + case Integer: + case Long: + case Float: + case Double: + case Character: + case Boolean: + case String: + case BigInteger: + case BigDecimal: + case Date: + case Object: + return false; + case Collection: + seen.push(value); + for (Object o : (Collection) value) { + if (hasCycle(o, seen)) { + return true; + } + } + seen.pop(); + return false; + case Map: + Map map = (Map) value; + seen.push(value); + for (Entry entry : map.entrySet()) { + if (hasCycle(entry.getKey(), seen)) { + return true; + } + if (hasCycle(entry.getValue(), seen)) { + return true; + } + } + seen.pop(); + return false; + case CompositeData: + CompositeData composite = (CompositeData) value; + seen.push(value); + for (String key : composite.getCompositeType().keySet()) { + if (hasCycle(composite.get(key), seen)) { + return true; + } + } + seen.pop(); + return false; + case TabularData: + TabularData tabular = (TabularData) value; + seen.push(value); + for (Object o : tabular.values()) { + if (hasCycle(o, seen)) { + return true; + } + } + seen.pop(); + return false; + } + return false; + } + + private void writePOJOValue(OutputStream out, Object value) throws IOException { + if (value == null) { + // - For "null" value: + // value: null + out.write(NULL); + return; + } + + Class clazz = value.getClass(); + + if (clazz.isArray()) { + // - For array + // value: [ Value* ] + Class componentType = clazz.getComponentType(); + if (componentType.isPrimitive()) { + writePrimitiveArray(out, value, componentType); + return; + } + + writeStartArray(out); + for (Object o : (Object[]) value) { + writeArrayItem(out); + writePOJOValue(out, o); + } + writeEndArray(out); + return; + } + + TYPE type = SupportedClasses.get(clazz); + if (type == null) { + if (value instanceof TabularData) { + type = TYPE.TabularData; + } else if (value instanceof CompositeData) { + type = TYPE.CompositeData; + } else if (value instanceof Map) { + type = TYPE.Map; + } else if (value instanceof Collection) { + type = TYPE.Collection; + } else if (value instanceof BigInteger) { + type = TYPE.BigInteger; + } else if (value instanceof BigDecimal) { + type = TYPE.BigDecimal; + } else if (value instanceof Date) { + type = TYPE.Date; + } else if (value instanceof ObjectName) { + type = TYPE.ObjectName; + } else { + // - For a value that's not expressible in JSON: + // null + out.write(NULL); + return; + } + } + + switch (type) { + case Byte: + case Short: + case Integer: + case Long: + case Float: + case Double: + case Boolean: + case BigInteger: + case BigDecimal: + // These value are ASCII without \ or " character, so no + // escaping is needed. + // - For a simple value + // value: String representation + writeSimpleString(out, value.toString()); + return; + case String: + writeStringInternal(out, (String) value); + return; + case ObjectName: + writeObjectName(out, (ObjectName) value); + return; + case Date: + writeLongInternal(out, ((Date) value).getTime()); + return; + case Object: + // - For an Object: + // value: "". "null" isn't very accurate. + writeSimpleString(out, ""); + return; + case Character: + // Could be special; may need to escape. + writeStringInternal(out, value.toString()); + return; + case Collection: + // - For Collection + // value: [ Value* ] + writeStartArray(out); + for (Object o : (Collection) value) { + writeArrayItem(out); + writePOJOValue(out, o); + } + writeEndArray(out); + return; + case Map: + Map map = (Map) value; + if (map.isEmpty()) { + writeStartObject(out); + writeEndObject(out); + return; + } + boolean simpleKey = true; + for (Object key : map.keySet()) { + // If a key is "null", then treat as complex key + if (key == null || !SimpleKeys.contains(key.getClass())) { + simpleKey = false; + break; + } + } + if (simpleKey) { + // - For map with simple key: + // value: { + // String: Value * + // } + writeStartObject(out); + for (Entry entry : map.entrySet()) { + Object key = entry.getKey(); + Object v = entry.getValue(); + if (key instanceof String) { + escapeFieldName(out, (String) key); + } else { + writeSimpleFieldName(out, key.toString()); + } + writePOJOValue(out, v); + } + writeEndObject(out); + } else { + // -For map with complex keys + // value: [ {key: Value, value: Value}* ] + writeStartArray(out); + for (Entry entry : map.entrySet()) { + Object key = entry.getKey(); + writeArrayItem(out); + writeStartObject(out); + writeFieldName(out, OM_KEY); + writePOJOValue(out, key); + writeFieldName(out, OM_VALUE); + writePOJOValue(out, entry.getValue()); + writeEndObject(out); + } + writeEndArray(out); + } + return; + case CompositeData: + // - For CompositeData + // value: { + // String: Value * // Key can't be null + // } + CompositeData composite = (CompositeData) value; + writeStartObject(out); + for (String key : composite.getCompositeType().keySet()) { + escapeFieldName(out, key); + writePOJOValue(out, composite.get(key)); + } + writeEndObject(out); + return; + case TabularData: + // - TabularData + // value: [ CompositeData * ] + TabularData tabular = (TabularData) value; + writeStartArray(out); + for (Object item : tabular.values()) { + writeArrayItem(out); + writePOJOValue(out, item); + } + writeEndArray(out); + return; + } + } + + private void writePrimitiveArray(OutputStream out, Object value, Class component) throws IOException { + switch (SupportedClasses.get(component)) { + case _Byte: + case Byte: + writeStartArray(out); + for (byte v : (byte[]) value) { + writeArrayItem(out); + writeIntInternal(out, v); + } + writeEndArray(out); + break; + case _Short: + case Short: + writeStartArray(out); + for (short v : (short[]) value) { + writeArrayItem(out); + writeIntInternal(out, v); + } + writeEndArray(out); + break; + case _Integer: + case Integer: + writeStartArray(out); + for (int v : (int[]) value) { + writeArrayItem(out); + writeIntInternal(out, v); + } + writeEndArray(out); + break; + case _Long: + case Long: + writeStartArray(out); + for (long v : (long[]) value) { + writeArrayItem(out); + writeLongInternal(out, v); + } + writeEndArray(out); + break; + case _Float: + case Float: + writeStartArray(out); + for (Float v : (Float[]) value) { + writeArrayItem(out); + writeSimpleString(out, Float.toString(v)); + } + writeEndArray(out); + break; + case _Double: + case Double: + writeStartArray(out); + for (Double v : (Double[]) value) { + writeArrayItem(out); + writeSimpleString(out, Double.toString(v)); + } + writeEndArray(out); + break; + case _Character: + case Character: + writeStartArray(out); + for (char v : (char[]) value) { + writeArrayItem(out); + writeIntInternal(out, v); + } + writeEndArray(out); + break; + case _Boolean: + case Boolean: + writeStartArray(out); + for (boolean v : (boolean[]) value) { + writeArrayItem(out); + out.write(v ? TRUE : FALSE); + } + writeEndArray(out); + break; + default: + break; + } + } + + private void writePOJOType(OutputStream out, Object value, List> openTypes) throws IOException { + if (value == null) { + // - For "null" value: + // type: null + out.write(NULL); + return; + } + + Class clazz = value.getClass(); + + if (clazz.isArray()) { + // - For simple array + // type: String + // - For complex array + // type: { + // className: String, ? + // value: Base64, ? + // items: [ Type* ] ? + // } + Class componentType = clazz.getComponentType(); + if (componentType.isPrimitive()) { + writeSimpleString(out, clazz.getName()); + return; + } + + Class leaf = componentType; + while (leaf.isArray()) { + leaf = leaf.getComponentType(); + } + if (SupportedClasses.get(leaf) == null) { + // Unknown array type. Java serialize it + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + writeSerializedField(out, OM_VALUE, value); + writeEndObject(out); + // And do not produce type information for the subtree. + return; + } + + if (SimpleArrays.contains(leaf)) { + writeSimpleString(out, clazz.getName()); + // Don't need further type information for simple arrays + return; + } + + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + writeFieldName(out, OM_ITEMS); + writeStartArray(out); + + for (Object o : (Object[]) value) { + writeArrayItem(out); + writePOJOType(out, o, openTypes); + } + writeEndArray(out); + writeEndObject(out); + return; + } + + TYPE type = SupportedClasses.get(clazz); + if (type == null) { + // Unknown array type. Java serialize it + // type: { + // className: String, ? + // value: Base64, ? + // } + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + writeSerializedField(out, OM_VALUE, value); + writeEndObject(out); + // And do not produce type information for the subtree. + return; + } + + switch (type) { + case Byte: + case Short: + case Integer: + case Long: + case Float: + case Double: + case Character: + case Boolean: + case String: + case BigInteger: + case BigDecimal: + case Date: + case ObjectName: + case Object: + // - For a simple value + // type: String (class name) + // These value are ASCII without \ or " character, so no + // escaping is needed. + writeSimpleString(out, clazz.getName()); + return; + case Collection: + // - For Collection + // type: { + // className: String, + // items: [ Type* ] + // } + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + writeFieldName(out, OM_ITEMS); + writeStartArray(out); + for (Object o : (Collection) value) { + writeArrayItem(out); + writePOJOType(out, o, openTypes); + } + writeEndArray(out); + writeEndObject(out); + return; + case Map: + Map map = (Map) value; + // - For maps + // type: { + // className: String, + // simpleKey: boolean, + // entries: [ + // { + // key:String, ? // For simple key + // keyType:Type, + // value:Type + // } * + // ] + // } + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + if (map.isEmpty()) { + writeEndObject(out); + return; + } + + boolean simpleKey = true; + for (Object key : map.keySet()) { + // If a key is "null", then treat as complex key + if (key == null || !SimpleKeys.contains(key.getClass())) { + simpleKey = false; + break; + } + } + + writeBooleanField(out, OM_SIMPLEKEY, simpleKey); + writeFieldName(out, OM_ENTRIES); + writeStartArray(out); + for (Entry entry : map.entrySet()) { + Object key = entry.getKey(); + writeArrayItem(out); + writeStartObject(out); + if (simpleKey) { + if (key instanceof String) { + writeStringField(out, OM_KEY, (String) key); + } else { + writeSimpleStringField(out, OM_KEY, key.toString()); + } + } + writeFieldName(out, OM_KEYTYPE); + writePOJOType(out, key, openTypes); + writeFieldName(out, OM_VALUE); + writePOJOType(out, entry.getValue(), openTypes); + writeEndObject(out); + } + writeEndArray(out); + writeEndObject(out); + return; + case CompositeData: + // - For CompositeData + // type: { + // className: String, + // openType: Integer // Reference to the OpenType array in root Type + // } + CompositeData composite = (CompositeData) value; + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + CompositeType ct = composite.getCompositeType(); + writeOpenTypeField(out, OM_OPENTYPE, ct, openTypes); + writeEndObject(out); + return; + case TabularData: + // - TabularData + // type: { + // className: String, + // openType: Integer // Reference to the OpenType array in root Type + // } + TabularData tabular = (TabularData) value; + writeStartObject(out); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + TabularType tt = tabular.getTabularType(); + writeOpenTypeField(out, OM_OPENTYPE, tt, openTypes); + writeEndObject(out); + break; + default: + break; + } + } + + private void writeOpenTypeField(OutputStream out, byte[] name, OpenType openType, List> openTypes) throws IOException { + int idx = openTypes.indexOf(openType); + if (idx < 0) { + writeIntField(out, name, openTypes.size()); + openTypes.add(openType); + } else { + writeIntField(out, name, idx); + } + } + + private void writeOpenTypes(OutputStream out, List> openTypes) throws IOException { + if (openTypes.isEmpty()) { + return; + } + + writeFieldName(out, OM_OPENTYPES); + writeStartArray(out); + for (int i = 0; i < openTypes.size(); i++) { + writeArrayItem(out); + OpenType ot = openTypes.get(i); + Class clazz = ot.getClass(); + if (clazz == SimpleType.class) { + // - For SimpleType instances: + // String // The name of the simple type. + writeSimpleString(out, ((SimpleType) ot).getTypeName()); + } else { + // - For all other OpenTypes: + // { + // openTypeClass: String, + // className: String, + // typeName: String, + // description: String, + // } + writeStartObject(out); + writeSimpleStringField(out, OM_OPENTYPECLASS, clazz.getName()); + writeSimpleStringField(out, OM_CLASSNAME, ot.getClassName()); + writeStringField(out, OM_TYPENAME, ot.getTypeName()); + writeStringField(out, OM_DESCRIPTION, ot.getDescription()); + if (clazz == ArrayType.class) { + // - ArrayType + // { + // dimension: Integer, + // elementType: Integer, + // } + ArrayType at = (ArrayType) ot; + writeIntField(out, OM_DIMENSION, at.getDimension()); + OpenType elemntType = at.getElementOpenType(); + writeOpenTypeField(out, OM_ELEMENTTYPE, elemntType, openTypes); + } else if (clazz == CompositeType.class) { + // - CompositeType + // { + // items: [ { key: String, description: String, type: Integer } *] + // } + CompositeType ct = (CompositeType) ot; + writeFieldName(out, OM_ITEMS); + writeStartArray(out); + for (String key : ct.keySet()) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_KEY, key); + writeStringField(out, OM_DESCRIPTION, ct.getDescription(key)); + writeOpenTypeField(out, OM_TYPE, ct.getType(key), openTypes); + writeEndObject(out); + } + writeEndArray(out); + } else if (clazz == TabularType.class) { + // - TabularType + // { + // rowType: Integer, + // indexNames: [String*] + // } + TabularType tt = (TabularType) ot; + writeOpenTypeField(out, OM_ROWTYPE, tt.getRowType(), openTypes); + writeFieldName(out, OM_INDEXNAMES); + writeStartArray(out); + for (String name : tt.getIndexNames()) { + writeArrayItem(out); + writeStringInternal(out, name); + } + writeEndArray(out); + } else { + // - For unknown OpenTypes + // { + // serialized: Base64 + // } + writeSerializedField(out, OM_SERIALIZED, ot); + } + writeEndObject(out); + } + } + writeEndArray(out); + } + + private Object readPOJOInternal(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONObject)) { + throwConversionException("readPOJOInternal() expects a JSONObject.", in); + } + JSONObject json = (JSONObject) in; + Object o = json.get(N_SERIALIZED); + if (o != null) { + // If the original object contains cycle, then java-deserialize it. + return readSerialized(o); + } + if (USE_BASE64_FOR_POJO) { + return null; + } + OpenType[] openTypes = readOpenTypes(json.get(N_OPENTYPES)); + return readPOJOValue(json.get(N_VALUE), json.get(N_TYPE), openTypes); + } + + private OpenType[] readOpenTypes(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readOpenTypes() expects a JSONArray.", in); + } + + JSONArray json = (JSONArray) in; + int size = json.size(); + OpenType[] openTypes = new OpenType[size]; + try { + for (int i = 0; i < size; i++) { + readOpenType(json, i, openTypes); + } + } catch (OpenDataException e) { + throwConversionException(e, in); + } + return openTypes; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private OpenType readOpenType(JSONArray json, int i, OpenType[] openTypes) throws ConversionException, ClassNotFoundException, OpenDataException { + if (openTypes[i] != null) { + return openTypes[i]; + } + Object o = json.get(i); + if (o instanceof String) { + openTypes[i] = Name2SimpleTypes.get(o); + if (openTypes[i] == null) { + throwConversionException("readOpenType() received an unknown simple type name.", o); + } + return openTypes[i]; + } + + if (!(o instanceof JSONObject)) { + throwConversionException("readOpenType() expects a JSONObject.", o); + } + + JSONObject type = (JSONObject) o; + Object serialized = type.get(N_SERIALIZED); + if (serialized != null) { + Object ret = readSerialized(serialized); + if (!(ret instanceof OpenType)) { + throwConversionException("readOpenType() expects an OpenType.", serialized); + } + return openTypes[i] = (OpenType) ret; + } + + String openTypeClass = readStringInternal(type.get(N_OPENTYPECLASS)); + if ("javax.management.openmbean.ArrayType".equals(openTypeClass)) { + int dimension = readIntInternal(type.get(N_DIMENSION)); + int elementType = readIntInternal(type.get(N_ELEMENTTYPE)); + if (elementType < 0 || elementType >= openTypes.length) { + throwConversionException("readOpenType() receives an out-of-range open type index.", type.get(N_ELEMENTTYPE)); + } + OpenType etype = readOpenType(json, elementType, openTypes); + if (etype instanceof SimpleType) { + return openTypes[i] = new ArrayType((SimpleType) etype, true); + } else { + return openTypes[i] = new ArrayType(dimension, etype); + } + } + + if ("javax.management.openmbean.CompositeType".equals(openTypeClass)) { + String typeName = readStringInternal(type.get(N_TYPENAME)); + String description = readStringInternal(type.get(N_DESCRIPTION)); + + o = type.get(N_ITEMS); + if (!(o instanceof JSONArray)) { + throwConversionException("readOpenType() expects a JSONArray.", o); + } + + JSONArray items = (JSONArray) o; + int size = items.size(); + String[] itemNames = new String[size]; + String[] itemDescriptions = new String[size]; + OpenType[] itemTypes = new OpenType[size]; + for (int p = 0; p < size; p++) { + o = items.get(p); + if (!(o instanceof JSONObject)) { + throwConversionException("readOpenType() expects a JSONObject.", o); + } + + JSONObject item = (JSONObject) o; + itemNames[p] = readStringInternal(item.get(N_KEY)); + itemDescriptions[p] = readStringInternal(item.get(N_DESCRIPTION)); + int itemType = readIntInternal(item.get(N_TYPE)); + if (itemType < 0 || itemType >= openTypes.length) { + throwConversionException("readOpenType() receives an out-of-range open type index.", item.get(N_TYPE)); + } + itemTypes[p] = readOpenType(json, itemType, openTypes); + } + return openTypes[i] = new CompositeType(typeName, description, itemNames, itemDescriptions, itemTypes); + } + + if ("javax.management.openmbean.TabularType".equals(openTypeClass)) { + String typeName = readStringInternal(type.get(N_TYPENAME)); + String description = readStringInternal(type.get(N_DESCRIPTION)); + int rowType = readIntInternal(type.get(N_ROWTYPE)); + if (rowType < 0 || rowType >= openTypes.length) { + throwConversionException("readOpenType() receives an out-of-range open type index.", type.get(N_ROWTYPE)); + } + + OpenType rtype = readOpenType(json, rowType, openTypes); + if (!(rtype instanceof CompositeType)) { + throwConversionException("readOpenType() expects a CompositeType.", rtype); + } + + o = type.get(N_INDEXNAMES); + if (!(o instanceof JSONArray)) { + throwConversionException("readOpenType() expects a JSONArray.", o); + } + + JSONArray names = (JSONArray) o; + int size = names.size(); + String[] indexNames = new String[size]; + for (int p = 0; p < size; p++) { + // Service change 119678: + // Original code: indexNames[i] = readStringInternal(names.get(p)); + indexNames[p] = readStringInternal(names.get(p)); + } + return openTypes[i] = new TabularType(typeName, description, (CompositeType) rtype, indexNames); + } + + throwConversionException("readOpenType() received an unknown open type class.", openTypeClass); + return null; + } + + private Object readPOJOValue(Object value, Object type, OpenType[] openTypes) throws ConversionException, ClassNotFoundException { + if (type == null) { + return null; + } + + if (type instanceof String) { + String tstr = (String) type; + TYPE t = SimpleValues.get(tstr); + if (t == null) { + if (tstr.length() > 0 && tstr.charAt(0) == '[') { + return readSimpleArray(value, Class.forName(tstr)); + } + throwConversionException("readPOJOValue() received an unknown class name.", type); + } + return readSimpleValue(value, t); + } + + if (!(type instanceof JSONObject)) { + throwConversionException("readPOJOValue() expects a JSONObject.", type); + } + + JSONObject tjson = (JSONObject) type; + Object o = tjson.get(N_VALUE); + if (o != null) { + return readSerialized(o); + } + + o = tjson.get(N_CLASSNAME); + if (o == null || !(o instanceof String)) { + throwConversionException("readPOJOValue() expects a String.", o); + } + + String className = (String) o; + TYPE t = StructuredClasses.get(className); + if (t == null) { + if (className.length() > 0 && className.charAt(0) == '[') { + return readComplexArray(value, Class.forName(className), tjson.get(N_ITEMS), openTypes); + } + throwConversionException("readPOJOValue() received an unknown class name.", o); + } + switch (t) { + case ArrayList: + return readCollectionValue(value, tjson, new ArrayList(), openTypes); + case LinkedList: + return readCollectionValue(value, tjson, new LinkedList(), openTypes); + case Vector: + return readCollectionValue(value, tjson, new Vector(), openTypes); + case HashSet: + return readCollectionValue(value, tjson, new HashSet(), openTypes); + case HashMap: + return readMapValue(value, tjson, new HashMap(), openTypes); + case Hashtable: + return readMapValue(value, tjson, new Hashtable(), openTypes); + case TreeMap: + return readMapValue(value, tjson, new TreeMap(), openTypes); + case CompositeDataSupport: + case TabularDataSupport: + int ot = readIntInternal(tjson.get(N_OPENTYPE)); + return readOpenData(value, openTypes[ot]); + } + + return null; + } + + private Object readSimpleValue(Object value, TYPE t) throws ConversionException { + if (value == null) { + return null; + } + if (!(value instanceof String)) { + throwConversionException("readSimpleValue() expects a String.", value); + } + String vstr = (String) value; + switch (t) { + case Byte: + return Byte.valueOf(vstr); + case Short: + return Short.valueOf(vstr); + case Integer: + return Integer.valueOf(vstr); + case Long: + return Long.valueOf(vstr); + case Float: + return Float.valueOf(vstr); + case Double: + return Double.valueOf(vstr); + case Character: + if (vstr.length() != 1) { + throwConversionException("readSimpleValue() expects a String of length 1 for Characgter.", value); + } + return Character.valueOf(vstr.charAt(0)); + case Boolean: + return Boolean.valueOf(vstr); + case String: + return vstr; + case BigInteger: + return new BigInteger(vstr); + case BigDecimal: + return new BigDecimal(vstr); + case Date: + return new Date(readLongInternal(vstr)); + case ObjectName: + return readObjectName(vstr); + case Object: + if (vstr.length() != 0) { + throwConversionException("readSimpleValue() expects an empty String for Object.", value); + } + return OBJECT; + } + return null; + } + + private Object readSimpleArray(Object value, Class array) throws ConversionException { + if (value == null) { + return null; + } + if (!(value instanceof JSONArray)) { + throwConversionException("readSimpleArray() expects a JSONArray.", value); + } + JSONArray json = (JSONArray) value; + int size = json.size(); + Class component = array.getComponentType(); + if (component.isArray()) { + Object[] ret = (Object[]) Array.newInstance(component, size); + for (int i = 0; i < size; i++) { + ret[i] = readSimpleArray(json.get(i), component); + } + return ret; + } + if (component.isPrimitive()) { + return readPrimitiveArray(json, SupportedClasses.get(component)); + } + + Object[] ret = (Object[]) Array.newInstance(component, size); + for (int i = 0; i < size; i++) { + ret[i] = readSimpleValue(json.get(i), SupportedClasses.get(component)); + } + return ret; + } + + private Object readPrimitiveArray(JSONArray value, TYPE type) throws ConversionException { + int size = value.size(); + switch (type) { + case _Byte: + case Byte: + byte[] bytes = new byte[size]; + for (int i = 0; i < size; i++) { + bytes[i] = readByteInternal(value.get(i)); + } + return bytes; + case _Short: + case Short: + short[] shorts = new short[size]; + for (int i = 0; i < size; i++) { + shorts[i] = readShortInternal(value.get(i)); + } + return shorts; + case _Integer: + case Integer: + int[] ints = new int[size]; + for (int i = 0; i < size; i++) { + ints[i] = readIntInternal(value.get(i)); + } + return ints; + case _Long: + case Long: + long[] longs = new long[size]; + for (int i = 0; i < size; i++) { + longs[i] = readLongInternal(value.get(i)); + } + return longs; + case _Float: + case Float: + float[] floats = new float[size]; + for (int i = 0; i < size; i++) { + floats[i] = readFloatInternal(value.get(i)); + } + return floats; + case _Double: + case Double: + double[] doubles = new double[size]; + for (int i = 0; i < size; i++) { + doubles[i] = readDoubleInternal(value.get(i)); + } + return doubles; + case _Character: + case Character: + char[] chars = new char[size]; + for (int i = 0; i < size; i++) { + chars[i] = readCharInternal(value.get(i)); + } + return chars; + case _Boolean: + case Boolean: + boolean[] bools = new boolean[size]; + for (int i = 0; i < size; i++) { + bools[i] = readBooleanInternal(value.get(i)); + } + return bools; + } + return null; + } + + private Object readComplexArray(Object value, Class array, Object type, OpenType[] openTypes) throws ConversionException, ClassNotFoundException { + if (!(value instanceof JSONArray)) { + throwConversionException("readComplexArray() expects a JSONArray.", value); + } + if (!(type instanceof JSONArray)) { + throwConversionException("readComplexArray() expects a JSONArray.", type); + } + JSONArray vjson = (JSONArray) value; + JSONArray tjson = (JSONArray) type; + int size = tjson.size(); + if (size != vjson.size()) { + throwConversionException("readComplexArray() expects same size from value and type arrays.", null); + } + + Object[] ret = (Object[]) Array.newInstance(array.getComponentType(), size); + for (int i = 0; i < size; i++) { + ret[i] = readPOJOValue(vjson.get(i), tjson.get(i), openTypes); + } + return ret; + } + + private Object readCollectionValue(Object value, JSONObject t, Collection ret, OpenType[] openTypes) throws ConversionException, ClassNotFoundException { + Object type = t.get(N_ITEMS); + if (!(value instanceof JSONArray)) { + throwConversionException("readCollectionValue() expects a JSONArray.", value); + } + if (!(type instanceof JSONArray)) { + throwConversionException("readCollectionValue() expects a JSONArray.", type); + } + + JSONArray vjson = (JSONArray) value; + JSONArray tjson = (JSONArray) type; + if (vjson.size() != tjson.size()) { + throwConversionException("readCollectionValue() expects same size from value and type arrays.", null); + } + for (int i = 0; i < tjson.size(); i++) { + ret.add(readPOJOValue(vjson.get(i), tjson.get(i), openTypes)); + } + return ret; + } + + private Object readMapValue(Object value, JSONObject t, Map ret, OpenType[] openTypes) throws ConversionException, ClassNotFoundException { + if (value == null) { + return ret; + } + + Object simple = t.get(N_SIMPLEKEY); + + if (simple == null) { + return ret; + } + + if (!(simple instanceof Boolean)) { + throwConversionException("readMapValue() expects a Boolean.", simple); + } + boolean simpleKey = ((Boolean) simple).booleanValue(); + + Object type = t.get(N_ENTRIES); + if (!(type instanceof JSONArray)) { + throwConversionException("readMapValue() expects a JSONArray.", type); + } + JSONArray tjson = (JSONArray) type; + + if (simpleKey) { + if (!(value instanceof JSONObject)) { + throwConversionException("readMapValue() expects a JSONObject.", value); + } + JSONObject vjson = (JSONObject) value; + if (tjson.size() != vjson.size()) { + throwConversionException("readMapValue() expects same size from value and type arrays.", null); + } + for (Object e : tjson) { + if (!(e instanceof JSONObject)) { + throwConversionException("readMapValue() expects a JSONObject.", e); + } + JSONObject entry = (JSONObject) e; + Object k = entry.get(N_KEY); + if (!(k instanceof String)) { + throwConversionException("readMapValue() expects a String.", k); + } + String key = (String) k; + ret.put(readPOJOValue(key, entry.get(N_KEYTYPE), openTypes), + readPOJOValue(vjson.get(key), entry.get(N_VALUE), openTypes)); + } + } else { + if (!(value instanceof JSONArray)) { + throwConversionException("readMapValue() expects a JSONArray.", value); + } + JSONArray vjson = (JSONArray) value; + if (tjson.size() != vjson.size()) { + throwConversionException("readMapValue() expects same size from value and type arrays.", null); + } + for (int i = 0; i < tjson.size(); i++) { + Object te = tjson.get(i); + if (!(te instanceof JSONObject)) { + throwConversionException("readMapValue() expects a JSONObject.", te); + } + JSONObject tentry = (JSONObject) te; + Object ve = vjson.get(i); + if (!(ve instanceof JSONObject)) { + throwConversionException("readMapValue() expects a JSONObject.", ve); + } + JSONObject ventry = (JSONObject) ve; + ret.put(readPOJOValue(ventry.get(N_KEY), tentry.get(N_KEYTYPE), openTypes), + readPOJOValue(ventry.get(N_VALUE), tentry.get(N_VALUE), openTypes)); + } + } + return ret; + } + + private Object readOpenData(Object value, OpenType openType) throws ConversionException { + if (value == null) { + return null; + } + if (openType instanceof SimpleType) { + return readSimpleValue(value, SimpleOpenTypes.get(openType)); + } + if (openType instanceof ArrayType) { + ArrayType at = (ArrayType) openType; + OpenType elementOT = at.getElementOpenType(); + Class elementType = null; + try { + elementType = Class.forName(elementOT.getClassName()); + } catch (ClassNotFoundException e) { + // Should never happen. All open type names are known. + } + + if (!(value instanceof JSONArray)) { + throwConversionException("readOpenData() expects a JSONArray.", value); + } + JSONArray json = (JSONArray) value; + + if (at.isPrimitiveArray()) { + return readPrimitiveArray(json, SupportedClasses.get(elementType)); + } + + int size = json.size(); + Object[] ret = (Object[]) Array.newInstance(elementType, size); + for (int i = 0; i < size; i++) { + ret[i] = readOpenData(json.get(i), elementOT); + } + return ret; + } else if (openType instanceof CompositeType) { + return readCompositeData(value, (CompositeType) openType); + } else if (openType instanceof TabularType) { + TabularType tt = (TabularType) openType; + CompositeType row = tt.getRowType(); + if (!(value instanceof JSONArray)) { + throwConversionException("readOpenData() expects a JSONArray.", value); + } + JSONArray json = (JSONArray) value; + + TabularDataSupport ret = new TabularDataSupport(tt); + for (Object o : json) { + ret.put(readCompositeData(o, row)); + } + return ret; + } + return null; + } + + private CompositeData readCompositeData(Object value, CompositeType ct) throws ConversionException { + Set keys = ct.keySet(); + if (!(value instanceof JSONObject)) { + throwConversionException("readCompositeData() expects a JSONObject.", value); + } + JSONObject json = (JSONObject) value; + + int size = keys.size(); + if (size != json.size()) { + throwConversionException("readCompositeData() expects the same number of entries as in the type.", json); + } + + String[] names = new String[size]; + Object[] values = new Object[size]; + int i = 0; + for (String key : keys) { + names[i] = key; + values[i++] = readOpenData(json.get(key), ct.getType(key)); + } + try { + return new CompositeDataSupport(ct, names, values); + } catch (OpenDataException e) { + // Should never happen. All names/values are constructed based + // on the open type. + } + return null; + } + + private void writePOJOArrayField(OutputStream out, byte[] name, Object[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writePOJOArray(out, value); + } + + private void writePOJOArray(OutputStream out, Object[] value) throws IOException { + writeStartArray(out); + for (Object o : value) { + writeArrayItem(out); + writePOJOInternal(out, o); + } + writeEndArray(out); + } + + private Object[] readPOJOArray(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readPOJOArray() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + int size = json.size(); + Object[] ret = new Object[size]; + for (int i = 0; i < size; i++) { + ret[i] = readPOJOInternal(json.get(i)); + } + return ret; + } + + private void writeObjectNameListField(OutputStream out, byte[] name, List value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (ObjectName item : value) { + writeArrayItem(out); + writeObjectName(out, item); + } + writeEndArray(out); + } + + private List readObjectNameList(Object in) throws ConversionException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readObjectNameList() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + int size = json.size(); + List ret = new ArrayList(size); + for (Object o : json) { + ret.add(readObjectName(o)); + } + return ret; + } + + private void writeObjectNameField(OutputStream out, byte[] name, ObjectName value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeObjectName(out, value); + } + + private void writeObjectName(OutputStream out, ObjectName value) throws IOException { + // ObjectName has no known sub-class. + writeStringInternal(out, value.toString()); + } + + private ObjectName readObjectName(Object in) throws ConversionException { + if (in == null) { + return null; + } + try { + return new ObjectName(readStringInternal(in)); + } catch (MalformedObjectNameException e) { + throwConversionException(e, in); + return null; + } + } + + private ObjectInstanceWrapper readObjectInstanceInternal(Object in) throws ConversionException { + if (!(in instanceof JSONObject)) { + throwConversionException("readObjectInstanceInternal() expects a JSONObject.", in); + } + JSONObject json = (JSONObject) in; + ObjectName objectName = readObjectName(json.get(N_OBJECTNAME)); + String className = readStringInternal(json.get(N_CLASSNAME)); + ObjectInstanceWrapper ret = new ObjectInstanceWrapper(); + ret.objectInstance = new ObjectInstance(objectName, className); + ret.mbeanInfoURL = readStringInternal(json.get(N_URL)); + return ret; + } + + private void writeDescriptor(OutputStream out, byte[] name, Descriptor value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartObject(out); + String[] names = value.getFieldNames(); + writeStringArrayField(out, OM_NAMES, names); + writePOJOArrayField(out, OM_VALUES, value.getFieldValues(names)); + writeEndObject(out); + } + + private Descriptor readDescriptor(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONObject)) { + throwConversionException("readDescriptor() expects a JSONObject.", in); + } + JSONObject json = (JSONObject) in; + String[] names = readStringArrayInternal(json.get(N_NAMES)); + Object[] values = readPOJOArray(json.get(N_VALUES)); + // All descriptors (on the client side) are immutable + return new ImmutableDescriptor(names, values); + } + + private void writeAttributes(OutputStream out, byte[] name, MBeanAttributeInfo[] value, Map urls) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (MBeanAttributeInfo item : value) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writeStringField(out, OM_TYPE, item.getType()); + writeStringField(out, OM_DESCRIPTION, item.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, item.getDescriptor()); + writeBooleanField(out, OM_ISIS, item.isIs()); + writeBooleanField(out, OM_ISREADABLE, item.isReadable()); + writeBooleanField(out, OM_ISWRITABLE, item.isWritable()); + assert urls.containsKey(item.getName()); + writeStringField(out, OM_URL, urls.get(item.getName())); + writeEndObject(out); + } + writeEndArray(out); + } + + private MBeanAttributeInfo[] readAttributes(Object in, Map urls) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readAttributes() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + MBeanAttributeInfo[] ret = new MBeanAttributeInfo[json.size()]; + int pos = 0; + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readAttributes() expects a JSONObject.", item); + } + JSONObject value = (JSONObject) item; + String name = readStringInternal(value.get(N_NAME)); + String type = readStringInternal(value.get(N_TYPE)); + String description = readStringInternal(value.get(N_DESCRIPTION)); + boolean isReadable = readBooleanInternal(value.get(N_ISREADABLE)); + boolean isWritable = readBooleanInternal(value.get(N_ISWRITABLE)); + boolean isIs = readBooleanInternal(value.get(N_ISIS)); + Descriptor descriptor = readDescriptor(value.get(N_DESCRIPTOR)); + ret[pos++] = new MBeanAttributeInfo(name, type, description, + isReadable, isWritable, isIs, + descriptor); + urls.put(name, readStringInternal(value.get(N_URL))); + } + return ret; + } + + private void writeConstructors(OutputStream out, byte[] name, MBeanConstructorInfo[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (MBeanConstructorInfo item : value) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writeStringField(out, OM_DESCRIPTION, item.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, item.getDescriptor()); + writeParameters(out, OM_SIGNATURE, item.getSignature()); + writeEndObject(out); + } + writeEndArray(out); + } + + private MBeanConstructorInfo[] readConstructors(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readConstructors() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + MBeanConstructorInfo[] ret = new MBeanConstructorInfo[json.size()]; + int pos = 0; + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readConstructors() expects a JSONObject.", item); + } + JSONObject value = (JSONObject) item; + String name = readStringInternal(value.get(N_NAME)); + String description = readStringInternal(value.get(N_DESCRIPTION)); + MBeanParameterInfo[] signature = readParameters(value.get(N_SIGNATURE)); + Descriptor descriptor = readDescriptor(value.get(N_DESCRIPTOR)); + ret[pos++] = new MBeanConstructorInfo(name, description, + signature, descriptor); + } + return ret; + } + + private void writeParameters(OutputStream out, byte[] name, MBeanParameterInfo[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (MBeanParameterInfo item : value) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writeStringField(out, OM_TYPE, item.getType()); + writeStringField(out, OM_DESCRIPTION, item.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, item.getDescriptor()); + writeEndObject(out); + } + writeEndArray(out); + } + + private MBeanParameterInfo[] readParameters(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readParameters() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + MBeanParameterInfo[] ret = new MBeanParameterInfo[json.size()]; + int pos = 0; + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readParameters() expects a JSONObject.", item); + } + JSONObject value = (JSONObject) item; + String name = readStringInternal(value.get(N_NAME)); + String type = readStringInternal(value.get(N_TYPE)); + String description = readStringInternal(value.get(N_DESCRIPTION)); + Descriptor descriptor = readDescriptor(value.get(N_DESCRIPTOR)); + ret[pos++] = new MBeanParameterInfo(name, type, description, + descriptor); + } + return ret; + } + + private void writeNotifications(OutputStream out, byte[] name, MBeanNotificationInfo[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (MBeanNotificationInfo item : value) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writeStringField(out, OM_DESCRIPTION, item.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, item.getDescriptor()); + writeStringArrayField(out, OM_NOTIFTYPES, item.getNotifTypes()); + writeEndObject(out); + } + writeEndArray(out); + } + + private MBeanNotificationInfo[] readNotifications(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readNotifications() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + MBeanNotificationInfo[] ret = new MBeanNotificationInfo[json.size()]; + int pos = 0; + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readNotifications() expects a JSONObject.", item); + } + JSONObject value = (JSONObject) item; + String name = readStringInternal(value.get(N_NAME)); + String description = readStringInternal(value.get(N_DESCRIPTION)); + String[] notifTypes = readStringArrayInternal(value.get(N_NOTIFTYPES)); + Descriptor descriptor = readDescriptor(value.get(N_DESCRIPTOR)); + ret[pos++] = new MBeanNotificationInfo(notifTypes, name, description, + descriptor); + } + return ret; + } + + private void writeOperations(OutputStream out, byte[] name, MBeanOperationInfo[] value, Map urls) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeStartArray(out); + for (MBeanOperationInfo item : value) { + writeArrayItem(out); + writeStartObject(out); + writeStringField(out, OM_NAME, item.getName()); + writeStringField(out, OM_DESCRIPTION, item.getDescription()); + writeDescriptor(out, OM_DESCRIPTOR, item.getDescriptor()); + writeIntField(out, OM_IMPACT, item.getImpact()); + writeStringField(out, OM_RETURNTYPE, item.getReturnType()); + writeParameters(out, OM_SIGNATURE, item.getSignature()); + assert urls.containsKey(item.getName()); + writeStringField(out, OM_URL, urls.get(item.getName())); + writeEndObject(out); + } + writeEndArray(out); + } + + private MBeanOperationInfo[] readOperations(Object in, Map urls) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readOperations() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + MBeanOperationInfo[] ret = new MBeanOperationInfo[json.size()]; + int pos = 0; + for (Object item : json) { + if (!(item instanceof JSONObject)) { + throwConversionException("readOperations() expects a JSONObject.", item); + } + JSONObject value = (JSONObject) item; + String description = readStringInternal(value.get(N_DESCRIPTION)); + String name = readStringInternal(value.get(N_NAME)); + int impact = readIntInternal(value.get(N_IMPACT)); + String returnType = readStringInternal(value.get(N_RETURNTYPE)); + MBeanParameterInfo[] signature = readParameters(value.get(N_SIGNATURE)); + Descriptor descriptor = readDescriptor(value.get(N_DESCRIPTOR)); + ret[pos++] = new MBeanOperationInfo(name, description, signature, + returnType, impact, descriptor); + urls.put(name, readStringInternal(value.get(N_URL))); + } + return ret; + } + + private void writeNotificationFiltersField(OutputStream out, byte[] name, NotificationFilter[] value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeNotificationFiltersInternal(out, value); + } + + private void writeNotificationFiltersInternal(OutputStream out, NotificationFilter[] value) throws IOException { + writeStartArray(out); + if (value != null) { + for (NotificationFilter item : value) { + writeArrayItem(out); + writeNotificationFilterInternal(out, item, false); + } + } + writeEndArray(out); + } + + private void writeNotificationFilterInternal(OutputStream out, NotificationFilter value, boolean allowOther) throws IOException { + assert value != null; + writeStartObject(out); + Class clazz = value.getClass(); + writeSimpleStringField(out, OM_CLASSNAME, clazz.getName()); + if (clazz == AttributeChangeNotificationFilter.class) { + writeFieldName(out, OM_ENABLED); + writeStartArray(out); + for (String e : ((AttributeChangeNotificationFilter) value).getEnabledAttributes()) { + writeArrayItem(out); + writeStringInternal(out, e); + } + writeEndArray(out); + } else if (clazz == MBeanServerNotificationFilter.class) { + MBeanServerNotificationFilter filter = (MBeanServerNotificationFilter) value; + byte[] fieldName = OM_ENABLED; + Vector list = filter.getEnabledObjectNames(); + if (list == null) { + fieldName = OM_DISABLED; + list = filter.getDisabledObjectNames(); + } + writeFieldName(out, fieldName); + writeStartArray(out); + for (ObjectName e : list) { + writeArrayItem(out); + writeStringInternal(out, e.toString()); + } + writeEndArray(out); + writeFieldName(out, OM_TYPES); + writeStartArray(out); + for (String e : ((MBeanServerNotificationFilter) value).getEnabledTypes()) { + writeArrayItem(out); + writeStringInternal(out, e); + } + writeEndArray(out); + } else if (clazz == NotificationFilterSupport.class) { + writeFieldName(out, OM_TYPES); + writeStartArray(out); + for (String e : ((NotificationFilterSupport) value).getEnabledTypes()) { + writeArrayItem(out); + writeStringInternal(out, e); + } + writeEndArray(out); + } else if (allowOther) { + writeSerializedField(out, OM_SERIALIZED, value); + } else { + // The caller guarantees that only the known classes are used. + assert false; + } + writeEndObject(out); + } + + private void writeNotificationFilterField(OutputStream out, byte[] name, NotificationFilter value) throws IOException { + if (value == null) { + return; + } + writeFieldName(out, name); + writeNotificationFilterInternal(out, value, true); + } + + private NotificationFilter[] readNotificationFiltersInternal(Object in) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONArray)) { + throwConversionException("readNotificationFiltersInternal() expects a JSONArray.", in); + } + JSONArray json = (JSONArray) in; + NotificationFilter[] ret = new NotificationFilter[json.size()]; + int pos = 0; + for (Object item : json) { + if ((ret[pos++] = readNotificationFilterInternal(item, false)) == null) { + throwConversionException("readNotificationFilterInternal() received a null NotificationListener.", in); + } + } + return ret; + } + + private NotificationFilter readNotificationFilterInternal(Object in, boolean allowOther) throws ConversionException, ClassNotFoundException { + if (in == null) { + return null; + } + if (!(in instanceof JSONObject)) { + throwConversionException("readNotificationFilterInternal() expects a JSONObject.", in); + } + JSONObject json = (JSONObject) in; + String className = readStringInternal(json.get(N_CLASSNAME)); + if ("javax.management.AttributeChangeNotificationFilter".equals(className)) { + AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter(); + String[] enabled = readStringArrayInternal(json.get(N_ENABLED)); + for (String item : enabled) { + filter.enableAttribute(item); + } + return filter; + } else if ("javax.management.relation.MBeanServerNotificationFilter".equals(className)) { + MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter(); + String[] enabled = readStringArrayInternal(json.get(N_ENABLED)); + if (enabled != null) { + for (String item : enabled) { + filter.enableObjectName(readObjectName(item)); + } + } else { + String[] disabled = readStringArrayInternal(json.get(N_DISABLED)); + + if (disabled != null) { + if (disabled.length == 0) { + filter.enableAllObjectNames(); + } else { + for (String item : disabled) { + filter.disableObjectName(readObjectName(item)); + } + } + } + } + String[] types = readStringArrayInternal(json.get(N_TYPES)); + for (String item : types) { + filter.enableType(item); + } + return filter; + } else if ("javax.management.NotificationFilterSupport".equals(className)) { + NotificationFilterSupport filter = new NotificationFilterSupport(); + String[] types = readStringArrayInternal(json.get(N_TYPES)); + for (String item : types) { + filter.enableType(item); + } + return filter; + } else if (allowOther) { + Object o = readSerialized(json.get(N_SERIALIZED)); + if (!(o instanceof NotificationFilter)) { + throwConversionException("readNotificationFilterInternal() expects a NotificationFilter.", in); + } + return (NotificationFilter) o; + } + throwConversionException("readNotificationFilterInternal() received an unknown filter class.", className); + return null; + } + + private void utf8EncodeError(Object json) throws ConversionException { + throwConversionException("encodeStringAsBase64Internal() can't encode the value in UTF-8.", json); + } + + private void base64DecodeError(Object json) throws ConversionException { + throwConversionException("readSerialized() received invalid base64 string.", json); + } + + private static String combineErrorMessage(String message, Object json) throws ConversionException { + try { + if (json instanceof JSONArtifact) { + message = message + "\n\t" + ((JSONArtifact) json).serialize(true); + } else if (json != null) { + message = message + "\n\t" + json.toString(); + } + } catch (IOException e) { + // Should never happen + } + return message; + } + + private static void throwConversionException(String message, Object json) throws ConversionException { + throw new ConversionException(combineErrorMessage(message, json)); + } + + public static void throwConversionException(Throwable t, Object json) throws ConversionException { + throw new ConversionException(combineErrorMessage(t.getMessage(), json), t); + } + + static class DefaultSerializationHelper implements SerializationHelper { + + @Override + public Object readObject(Object in, int blen, byte[] binary) throws ClassNotFoundException, ConversionException { + try { + return new ObjectInputStream(new ByteArrayInputStream(binary, 0, blen)).readObject(); + } catch (IOException e) { + throwConversionException(e, in); + return null; + } + } + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationRecord.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationRecord.java new file mode 100755 index 00000000000..e3fb940bbaa --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationRecord.java @@ -0,0 +1,52 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.converter; + +import javax.management.Notification; +import javax.management.ObjectName; + +/** + * Data structure containing a JMX Notification and information about which target it came from. + */ +public final class NotificationRecord { + + private final Notification n; + private final NotificationTargetInformation nti; + + public NotificationRecord(Notification n, ObjectName name) { + this.n = n; + this.nti = new NotificationTargetInformation(name); + } + + public NotificationRecord(Notification n, String name) { + this.n = n; + this.nti = new NotificationTargetInformation(name); + } + + public NotificationRecord(Notification n, ObjectName name, String hostName, String serverName, String serverUserDir) { + this.n = n; + this.nti = new NotificationTargetInformation(name, hostName, serverName, serverUserDir); + } + + public NotificationRecord(Notification n, String name, String hostName, String serverName, String serverUserDir) { + this.n = n; + this.nti = new NotificationTargetInformation(name, hostName, serverName, serverUserDir); + } + + public Notification getNotification() { + return n; + } + + public NotificationTargetInformation getNotificationTargetInformation() { + return nti; + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationTargetInformation.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationTargetInformation.java new file mode 100755 index 00000000000..0ff818359b5 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/NotificationTargetInformation.java @@ -0,0 +1,120 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.converter; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import javax.management.ObjectName; + +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; + +/** + * Routing information for a JMX Notification which helps the connector + * to correlate a Notification with the appropriate NotificationListener. + * Combined with the ObjectName, the routing information provides a unique + * identifier for an MBean in a cluster of servers. + */ +public final class NotificationTargetInformation { + + private ObjectName name; + private final String nameAsString; + private final Map routingInfo; + + public NotificationTargetInformation(ObjectName name) { + this(name.getCanonicalName()); + this.name = name; + } + + public NotificationTargetInformation(String name) { + this.nameAsString = name; + this.routingInfo = null; + } + + public NotificationTargetInformation(ObjectName name, String hostName, String serverName, String serverUserDir) { + this(name.getCanonicalName(), hostName, serverName, serverUserDir); + this.name = name; + } + + public NotificationTargetInformation(String name, String hostName, String serverName, String serverUserDir) { + Map routingInfo = new HashMap(); + routingInfo.put(ClientProvider.ROUTING_KEY_HOST_NAME, hostName); + routingInfo.put(ClientProvider.ROUTING_KEY_SERVER_NAME, serverName); + routingInfo.put(ClientProvider.ROUTING_KEY_SERVER_USER_DIR, serverUserDir); + this.nameAsString = name; + this.routingInfo = Collections.unmodifiableMap(routingInfo); + } + + public NotificationTargetInformation(ObjectName name, Map routingInfo) { + this(name.getCanonicalName(), routingInfo); + this.name = name; + } + + public NotificationTargetInformation(String name, Map routingInfo) { + this.nameAsString = name; + this.routingInfo = (routingInfo != null) ? Collections.unmodifiableMap(new HashMap(routingInfo)) : null; + } + + // Returns null if this object was not constructed with an ObjectName. + public ObjectName getName() { + return name; + } + + public String getNameAsString() { + return nameAsString; + } + + public Map getRoutingInformation() { + return routingInfo; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof NotificationTargetInformation)) { + return false; + } + NotificationTargetInformation other = (NotificationTargetInformation) obj; + return (nameAsString == other.nameAsString || (nameAsString != null && nameAsString.equals(other.nameAsString))) && + (routingInfo == other.routingInfo || (routingInfo != null && routingInfo.equals(other.routingInfo))); + } + + @Override + public int hashCode() { + if (routingInfo != null) { + int hash = routingInfo.hashCode() * 37; + if (nameAsString != null) { + hash += nameAsString.hashCode(); + } + return hash; + } else if (nameAsString != null) { + return nameAsString.hashCode(); + } + return 0; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("[ObjectName: "); + sb.append(nameAsString); + if (routingInfo != null) { + sb.append(", RoutingInfo: "); + sb.append(routingInfo); + } + sb.append(']'); + return sb.toString(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/SerializationHelper.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/SerializationHelper.java new file mode 100755 index 00000000000..4e96f87549e --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/SerializationHelper.java @@ -0,0 +1,20 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.converter; + +import com.ibm.ws.jmx.connector.datatypes.ConversionException; + +public interface SerializationHelper { + + public Object readObject(Object in, int blen, byte[] binary) throws ClassNotFoundException, ConversionException; + +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/package-info.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/package-info.java new file mode 100755 index 00000000000..5517c821851 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/package-info.java @@ -0,0 +1,17 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.0 + */ +@org.osgi.annotation.versioning.Version("1.0") +package com.ibm.ws.jmx.connector.converter; + diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ConversionException.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ConversionException.java new file mode 100755 index 00000000000..d0524432ad5 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ConversionException.java @@ -0,0 +1,24 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +public final class ConversionException extends Exception { + private static final long serialVersionUID = -2548273252032545919L; + + public ConversionException(String message) { + super(message); + } + + public ConversionException(String message, Throwable t) { + super(message, t); + } +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/CreateMBean.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/CreateMBean.java new file mode 100755 index 00000000000..dcc068e985e --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/CreateMBean.java @@ -0,0 +1,21 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import javax.management.ObjectName; + +public final class CreateMBean { + public ObjectName objectName, loaderName; + public String className, signature[]; + public Object params[]; + public boolean useLoader, useSignature; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/Invocation.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/Invocation.java new file mode 100755 index 00000000000..d886c59a24e --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/Invocation.java @@ -0,0 +1,20 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +/** + * + */ +public final class Invocation { + public String signature[]; + public Object params[]; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/JMXServerInfo.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/JMXServerInfo.java new file mode 100755 index 00000000000..f522876b1e4 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/JMXServerInfo.java @@ -0,0 +1,20 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012-2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +/** + * + */ +public final class JMXServerInfo { + public int version; + public String mbeansURL, createMBeanURL, mbeanCountURL, defaultDomainURL, domainsURL, notificationsURL, instanceOfURL, fileTransferURL, apiURL, graphURL; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanInfoWrapper.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanInfoWrapper.java new file mode 100755 index 00000000000..e2780629057 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanInfoWrapper.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import java.util.Map; + +import javax.management.MBeanInfo; + +/** + * + */ +public final class MBeanInfoWrapper { + public MBeanInfo mbeanInfo; + public String attributesURL; + public Map attributeURLs, operationURLs; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanQuery.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanQuery.java new file mode 100755 index 00000000000..b329fa0e82c --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/MBeanQuery.java @@ -0,0 +1,24 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import javax.management.ObjectName; +import javax.management.QueryExp; + +/** + * + */ +public final class MBeanQuery { + public ObjectName objectName; + public QueryExp queryExp; + public String className; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationArea.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationArea.java new file mode 100755 index 00000000000..7d1a199fb53 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationArea.java @@ -0,0 +1,19 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +/** + * + */ +public final class NotificationArea { + public String registrationsURL, serverRegistrationsURL, inboxURL, clientURL; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationRegistration.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationRegistration.java new file mode 100755 index 00000000000..87adcd57d0c --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationRegistration.java @@ -0,0 +1,23 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import javax.management.NotificationFilter; +import javax.management.ObjectName; + +/** + * + */ +public final class NotificationRegistration { + public ObjectName objectName; + public NotificationFilter filters[]; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationSettings.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationSettings.java new file mode 100755 index 00000000000..e82f19b3637 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/NotificationSettings.java @@ -0,0 +1,17 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +public final class NotificationSettings { + public int deliveryInterval; + public int inboxExpiry; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ObjectInstanceWrapper.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ObjectInstanceWrapper.java new file mode 100755 index 00000000000..c7521a71bc8 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ObjectInstanceWrapper.java @@ -0,0 +1,22 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import javax.management.ObjectInstance; + +/** + * + */ +public final class ObjectInstanceWrapper { + public ObjectInstance objectInstance; + public String mbeanInfoURL; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ServerNotificationRegistration.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ServerNotificationRegistration.java new file mode 100755 index 00000000000..d45ca1e3597 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/ServerNotificationRegistration.java @@ -0,0 +1,27 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.connector.datatypes; + +import javax.management.NotificationFilter; +import javax.management.ObjectName; + +public final class ServerNotificationRegistration { + public enum Operation { + Add, RemoveAll, RemoveSpecific + } + + public Operation operation; + public ObjectName objectName, listener; + public NotificationFilter filter; + public Object handback; + public int filterID, handbackID; +} diff --git a/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/package-info.java b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/package-info.java new file mode 100755 index 00000000000..735402c8433 --- /dev/null +++ b/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/datatypes/package-info.java @@ -0,0 +1,17 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.0 + */ +@org.osgi.annotation.versioning.Version("1.0") +package com.ibm.ws.jmx.connector.datatypes; + diff --git a/dev/com.ibm.ws.jmx_fat/.classpath b/dev/com.ibm.ws.jmx_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.jmx_fat/.classpath.gradle b/dev/com.ibm.ws.jmx_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.jmx_fat/.gitignore b/dev/com.ibm.ws.jmx_fat/.gitignore new file mode 100644 index 00000000000..27e131e35a6 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.jmx_fat/.project b/dev/com.ibm.ws.jmx_fat/.project new file mode 100755 index 00000000000..7aea1fcf31c --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.jmx_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..2d37f3472a8 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +encoding/=UTF-8 +eclipse.preferences.version=1 diff --git a/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..462d94d2e7b --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=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_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +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_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not 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_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=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_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=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_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=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_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=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_and_in_type_parameter=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_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=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_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +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_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=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_new_line_before_closing_brace_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_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=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_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=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_after_at_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=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_labeled_statement=do not 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_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.compact_else_if=true +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_while=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_for_increments=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_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert diff --git a/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..bf3c1827a5d --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +sp_cleanup.add_missing_override_annotations=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.remove_unnecessary_nls_tags=true +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.sort_members=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_unused_private_members=false +org.eclipse.jdt.ui.staticondemandthreshold=99 +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_annotations=true +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.organize_imports=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.always_use_blocks=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.never_use_blocks=false +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members_all=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.always_use_this_for_non_static_field_access=false +eclipse.preferences.version=1 +org.eclipse.jdt.ui.ondemandthreshold=99 +sp_cleanup.add_missing_methods=false +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.format_source_code=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.correct_indentation=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ignorelowercasenames=true +sp_cleanup.add_serial_version_id=false diff --git a/dev/com.ibm.ws.jmx_fat/bnd.bnd b/dev/com.ibm.ws.jmx_fat/bnd.bnd new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.jmx_fat/bnd.bnd.gradle b/dev/com.ibm.ws.jmx_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.jmx_fat/build-test.xml b/dev/com.ibm.ws.jmx_fat/build-test.xml new file mode 100755 index 00000000000..64159bf99af --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/build-test.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx_fat/build.gradle b/dev/com.ibm.ws.jmx_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.jmx_fat/delivery.sets b/dev/com.ibm.ws.jmx_fat/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/AttachSupport.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/AttachSupport.java new file mode 100755 index 00000000000..8b73d8a9d3b --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/AttachSupport.java @@ -0,0 +1,128 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat; + +import java.io.File; +import java.lang.reflect.UndeclaredThrowableException; +import java.util.List; +import java.util.Properties; + +import javax.management.MBeanServerConnection; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +import com.ibm.ws.jmx.fat.attach.VirtualMachineDescriptorProxy; +import com.ibm.ws.jmx.fat.attach.VirtualMachineProxy; +import com.ibm.ws.jmx.fat.attach.VirtualMachineProxyHelper; + +/** + * + */ +public class AttachSupport { + + private static String LOCAL_CONNECTOR_ADDRESS = "com.sun.management.jmxremote.localConnectorAddress"; + + MBeanServerConnection mbsc = null; + + public AttachSupport() throws Exception { + System.setProperty("com.ibm.tools.attach.timeout", "5000"); + List vms = VirtualMachineProxyHelper.list(); + System.out.println("Found the following vms: " + vms); + + for (VirtualMachineDescriptorProxy vmd : vms) { + VirtualMachineProxy vm = null; + try { + vm = VirtualMachineProxyHelper.attach(vmd); + } catch (Exception e) { + continue; + } + + System.out.println("Working with vm " + vm); + + try { + Properties props = vm.getSystemProperties(); + Object bvtServer = props.getProperty("com.ibm.ws.jmx.test.fat"); + System.out.println("Found system property " + bvtServer); + + if (bvtServer != null) { + // Search for the value of "localConnectorAddress" within the VM's system properties and agent properties. + // Oracle's examples check the agent properties but have been finding in practice that the value is found + // from a system property. Trying both in case agent properties are used on some platforms to expose + // the value of "localConnectorAddress". + String connectorAddr = vm.getSystemProperties().getProperty(LOCAL_CONNECTOR_ADDRESS); + System.out.println("Local connector address (system property): " + connectorAddr); + + if (connectorAddr == null) { + connectorAddr = vm.getAgentProperties().getProperty(LOCAL_CONNECTOR_ADDRESS); + System.out.println("Local connector address (agent property): " + connectorAddr); + + // It looks like the 'management' agent hasn't been loaded. Try to load it and read the system property again. + if (connectorAddr == null) { + long start = System.currentTimeMillis(); + System.out.println("Starting the management agent ..." + start); + + final String javaHome = vm.getSystemProperties().getProperty("java.home"); + // Try to load the agent jar from "java.home"/lib. Assumes that "java.home" points to JDK_BASE_DIR/jre. + String agent = javaHome + File.separator + "lib" + File.separator + "management-agent.jar"; + try { + vm.loadAgent(agent); + } catch (UndeclaredThrowableException e) { + Throwable t = e.getCause(); + if (t != null && "AgentLoadException".equals(t.getClass().getSimpleName())) { + // The agent wasn't found. Perhaps "java.home" is pointing to the JDK_BASE_DIR. Try again with "java.home"/jre/lib. + agent = javaHome + File.separator + "jre" + File.separator + "lib" + File.separator + "management-agent.jar"; + vm.loadAgent(agent); + } else { + throw e; + } + } + long end = System.currentTimeMillis(); + System.out.println("Management agent started... " + end + ", took ~" + ((end - start) / 1000) + " seconds"); + + connectorAddr = vm.getSystemProperties().getProperty(LOCAL_CONNECTOR_ADDRESS); + System.out.println("Local connector address (system property): " + connectorAddr); + + if (connectorAddr == null) { + connectorAddr = vm.getAgentProperties().getProperty(LOCAL_CONNECTOR_ADDRESS); + System.out.println("Local connector address (agent property): " + connectorAddr); + } + } + } + + if (connectorAddr != null) { + JMXServiceURL url = new JMXServiceURL(connectorAddr); + System.out.println("JMXServiceURL: " + url); + + JMXConnector connector = JMXConnectorFactory.connect(url); + System.out.println("JMXConnector: " + connector); + + mbsc = connector.getMBeanServerConnection(); + System.out.println("MBeanServerConnection: " + mbsc); + } + return; + } + } finally { + try { + vm.detach(); + } catch (Exception e) { + // Detach failed. Ignore and move on to the next VM. + } + } + } + throw new RuntimeException("Could not find the server VM"); + } + + public MBeanServerConnection getMBeanServer() { + return mbsc; + } +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/ClientConnector.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/ClientConnector.java new file mode 100755 index 00000000000..c3bfc43ca17 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/ClientConnector.java @@ -0,0 +1,60 @@ +package com.ibm.ws.jmx.fat; + +import java.io.IOException; +import java.net.MalformedURLException; + +import javax.management.MBeanServerConnection; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +/** + * + */ +public class ClientConnector { + + MBeanServerConnection mbsc = null; + + public ClientConnector() { + int port = Integer.valueOf(System.getProperty("JMXTest", "8999")); + String URL = "service:jmx:rmi:///jndi/rmi://localhost:" + port + "/server"; + System.out.println("JMX ClientConnector URL " + URL); + + JMXServiceURL url; + try { + url = new JMXServiceURL(URL); + } catch (MalformedURLException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + JMXConnector jmxc; + try { + jmxc = JMXConnectorFactory.connect(url, null); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + try { + mbsc = jmxc.getMBeanServerConnection(); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public MBeanServerConnection getMBeanServer() { + return mbsc; + } +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/FATSuite.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/FATSuite.java new file mode 100755 index 00000000000..baaab80aa51 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/FATSuite.java @@ -0,0 +1,22 @@ +package com.ibm.ws.jmx.fat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ + JMXTest.class }) +public class FATSuite {} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/JMXTest.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/JMXTest.java new file mode 100755 index 00000000000..c4fb6b32ed3 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/JMXTest.java @@ -0,0 +1,239 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.Set; + +import javax.management.InstanceNotFoundException; +import javax.management.JMX; +import javax.management.MBeanInfo; +import javax.management.MBeanOperationInfo; +import javax.management.MBeanServerConnection; +import javax.management.MBeanServerDelegate; +import javax.management.MBeanServerDelegateMBean; +import javax.management.ObjectName; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class JMXTest { + + protected static LibertyServer server; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.jmx.fat"); + server.installSystemFeature("jmxtest-1.0"); + server.copyFileToLibertyInstallRoot("lib", "bundles/com.ibm.ws.jmx.fat_1.0.0.jar"); + + server.startServer("JMXTest.log"); + server.waitForStringInLog("CWWKE0002I"); + assertNotNull("FeatureManager should report update is complete", + server.waitForStringInLog("CWWKF0008I")); + assertNotNull("Server should report it has started", + server.waitForStringInLog("CWWKF0011I")); + assertNotNull("JMXConnectorServer started not found", server.waitForStringInTrace("SERVER_READY|JMXConnectorServer is ready")); + } + + @AfterClass + public static void tearDown() throws Exception { + + if (server != null && server.isStarted()) { + server.stopServer(); + } + server.uninstallSystemFeature("jmxtest-1.0"); + } + + public JMXTest() { + super(); + } + + @Test + public void testMBeanConnector() throws Exception { + ClientConnector cc = new ClientConnector(); + checkMBeanServerConnection(cc.getMBeanServer()); + } + + @Test + public void testMBeanLocalConnector() throws Exception { + String serverRoot = server.getServerRoot(); + LocalConnector lc = new LocalConnector(serverRoot); + checkMBeanServerConnection(lc.getMBeanServer()); + + compareFileContent(lc.getStateFile(), lc.getWorkAreaFile()); + } + + /** + * @param stateFile + * @param workAreaFile + * @throws IOException + */ + private void compareFileContent(File stateFile, File workAreaFile) throws IOException { + BufferedReader reader = new BufferedReader(new FileReader(stateFile)); + String stateLine = reader.readLine(); + reader.close(); + reader = new BufferedReader(new FileReader(workAreaFile)); + String workAreaLine = reader.readLine(); + reader.close(); + + assertEquals("The content of the local address file in the logs/state and workarea files should be the same", stateLine, workAreaLine); + } + + @Test + @Ignore + // Disabling this test. The Attach API has been very unstable + // and is not being used by the tools for connecting to JMX. + public void testMBeanAttachAPI() throws Exception { + AttachSupport as = new AttachSupport(); + checkMBeanServerConnection(as.getMBeanServer()); + } + + @Test + public void testMBeanNotLoaded() throws Exception { + ClientConnector cc = new ClientConnector(); + MBeanServerConnection server = cc.getMBeanServer(); + ObjectName beanCounterName = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.beanCounter"); + + int before = (Integer) server.getAttribute(beanCounterName, "beanCount"); + + ObjectName on = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.testBean3"); + @SuppressWarnings("unused") + MBeanInfo info = server.getMBeanInfo(on); + + int after = (Integer) server.getAttribute(beanCounterName, "beanCount"); + + assertTrue(after == before + 1); + } + + // Simple method that demands the pattern provided matches exactly one mbean + private MBeanInfo getMBeanInfo(MBeanServerConnection connection, ObjectName pattern) throws Exception { + Set mbeans = connection.queryNames(pattern, null); + assertTrue("Expected one mbean matching pattern " + pattern + ", found: " + mbeans.size(), mbeans.size() == 1); + ObjectName name = mbeans.iterator().next(); + MBeanInfo result = connection.getMBeanInfo(name); + assertTrue("No mbean info for " + name, result != null); + return result; + } + + @Test + public void testOSGiMBeans() throws Exception { + ClientConnector cc = new ClientConnector(); + final MBeanServerConnection server = cc.getMBeanServer(); + + //this ObjectName is also ObjectNameConstants.OSGI_CONFIGURATION_ADMIN_MBEAN_NAME + MBeanInfo info = getMBeanInfo(server, new ObjectName("osgi.compendium:service=cm,version=1.3,*")); + MBeanOperationInfo[] ops = info.getOperations(); + + // Check that only read-only operations are available from ConfigurationAdmin. + assertTrue(containsOperation(ops, "getProperties")); + assertTrue(!containsOperation(ops, "deleteForLocation")); + final String mbeanClassName = info.getClassName(); + assertTrue("com.ibm.ws.jmx.internal.ReadOnlyConfigurationAdmin".equals(mbeanClassName)); + + // Sanity check with a few other OSGi JMX MBeans. + // Ensures the delayed registration is working correctly. + //this ObjectName is also ObjectNameConstants.OSGI_FRAMEWORK_MBEAN_NAME + info = getMBeanInfo(server, new ObjectName("osgi.core:type=framework,version=1.7,*")); + assertTrue(info != null); + assertTrue(containsOperation(info.getOperations(), "restartFramework")); + assertTrue(containsOperation(info.getOperations(), "shutdownFramework")); + + //this ObjectName is also ObjectNameConstants.OSGI_BUNDLE_STATE_MBEAN_NAME + info = getMBeanInfo(server, new ObjectName("osgi.core:type=bundleState,version=1.7,*")); + assertTrue(info != null); + assertTrue(containsOperation(info.getOperations(), "listBundles")); + + } + + @Test + public void testDelayedOSGiMBeans() throws Exception { + ClientConnector cc = new ClientConnector(); + final MBeanServerConnection server = cc.getMBeanServer(); + + ObjectName tester = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.delayedMbeanTester"); + ObjectName bean1 = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.delayedMbeanTester.Bean1"); + ObjectName bean2 = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.delayedMbeanTester.Bean2"); + server.invoke(tester, "register", null, null); + + try { + server.getMBeanInfo(bean1); + fail("Expected InstanceNotFoundException"); + } catch (InstanceNotFoundException e) { + //expected + } + server.invoke(tester, "allow1Service", null, null); + //this should work if delayed mbeans are implemented correctly + assertNotNull("Expected successful delayed mbean instantiation", server.getMBeanInfo(bean1)); + + try { + server.getMBeanInfo(bean2); + fail("Expected InstanceNotFoundException"); + } catch (InstanceNotFoundException e) { + //expected + } + + server.invoke(tester, "unregister", null, null); + } + + private boolean containsOperation(MBeanOperationInfo[] ops, String name) { + for (MBeanOperationInfo op : ops) { + if (name.equals(op.getName())) { + return true; + } + } + return false; + } + + private void checkMBeanServerConnection(MBeanServerConnection server) throws Exception { + assertNotNull("Server must not be null", server); + + int numBeans = server.getMBeanCount(); + assertTrue("Number of beans shoud be greater than or equal to 2, numBeans=" + numBeans, numBeans >= 2); + + Set set = server.queryNames(null, null); + + ObjectName on1 = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.testBean1"); + ObjectName on2 = new ObjectName("WebSphere", "name", "com.ibm.ws.jmx.test.fat.testBean2"); + + assertTrue("Set must contain object name '" + on1 + "': found " + set, set.contains(on1)); + assertTrue("Set must contain object name '" + on1 + "': found " + set, set.contains(on2)); + + MBeanInfo info = server.getMBeanInfo(on1); + assertNotNull("MBeanInfo for object name 1 must not be null", info); + + info = server.getMBeanInfo(on2); + assertNotNull("MBeanInfo for object name 2 must not be null", info); + + MBeanServerDelegateMBean serverDelegate = JMX.newMBeanProxy(server, MBeanServerDelegate.DELEGATE_NAME, MBeanServerDelegateMBean.class); + System.out.println("Server delegate: " + serverDelegate); + System.out.println("Mbean server id: " + serverDelegate.getMBeanServerId()); + assertTrue("Expected that server ID starts with WebSphere", + serverDelegate.getMBeanServerId().startsWith("WebSphere")); + } +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/LocalConnector.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/LocalConnector.java new file mode 100755 index 00000000000..44ab6b6fb5d --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/LocalConnector.java @@ -0,0 +1,105 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; + +import javax.management.MBeanServerConnection; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +/** + * + */ +public class LocalConnector { + + private static final String CONNECTOR_ADDRESS_FILE_NAME = "com.ibm.ws.jmx.local.address"; + + MBeanServerConnection mbsc = null; + + private File stateFile; + private File workAreaFile; + + public LocalConnector(String serverRoot) throws IOException { + if (serverRoot == null || serverRoot.length() == 0) { + throw new RuntimeException("server.root property is not set"); + } + serverRoot = serverRoot.replaceAll("\\\\", "/"); + String connectorFile = serverRoot + "/logs/state/" + CONNECTOR_ADDRESS_FILE_NAME; + System.out.println(connectorFile); + + stateFile = new File(connectorFile); + workAreaFile = new File(serverRoot, "workarea/" + CONNECTOR_ADDRESS_FILE_NAME); + + if (stateFile.exists()) { + String connectorAddr = null; + BufferedReader br = null; + try { + br = new BufferedReader(new InputStreamReader(new FileInputStream(stateFile), "UTF-8")); + connectorAddr = br.readLine(); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + try { + if (br != null) { + br.close(); + } + } catch (IOException e) { + // ignore + } + } + if (connectorAddr != null) { + System.out.println("JMX connector address: " + connectorAddr); + JMXConnector connector = null; + try { + JMXServiceURL url = new JMXServiceURL(connectorAddr); + connector = JMXConnectorFactory.connect(url); + System.out.println("JMX Connector: " + connector); + mbsc = connector.getMBeanServerConnection(); + if (mbsc != null) { + return; //Successful, return. + } + } catch (IOException ioe) { + if (connector != null) { + try { + connector.close(); + } catch (IOException e) { + // ignore + } + } + throw (ioe); + } + } else { + System.out.println("JMXConnection: JMX connector address is null. The connector address file is " + stateFile.getAbsolutePath()); + } + } else { + System.out.println("JMXConnection: JMX address file doesn't exist. The connector address file is " + stateFile.getAbsolutePath()); + } + } + + public MBeanServerConnection getMBeanServer() { + return mbsc; + } + + public File getStateFile() { + return stateFile; + } + + public File getWorkAreaFile() { + return workAreaFile; + } +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ForwardingInvocationHandler.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ForwardingInvocationHandler.java new file mode 100755 index 00000000000..7a8fdab1512 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ForwardingInvocationHandler.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat.attach; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * + */ +class ForwardingInvocationHandler implements InvocationHandler { + + private final Object target; + + public ForwardingInvocationHandler(Object target) { + this.target = target; + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + final String name = method.getName(); + if ("getBackingObject".equals(name) && + method.getDeclaringClass() == ObjectProxy.class) { + return target; + } + final Class[] types = method.getParameterTypes(); + try { + Method m = target.getClass().getMethod(name, types); + m.setAccessible(true); + return m.invoke(target, args); + } catch (InvocationTargetException e) { + throw e.getCause(); + } + } +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ObjectProxy.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ObjectProxy.java new file mode 100755 index 00000000000..a26938936ba --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/ObjectProxy.java @@ -0,0 +1,21 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat.attach; + +/** + * + */ +interface ObjectProxy { + + public Object getBackingObject(); + +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineDescriptorProxy.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineDescriptorProxy.java new file mode 100755 index 00000000000..dd2470d6127 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineDescriptorProxy.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat.attach; + +/** + * + */ +public interface VirtualMachineDescriptorProxy { + + public String displayName(); + + public String id(); + + public String toString(); + +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxy.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxy.java new file mode 100755 index 00000000000..292f5ba9c71 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxy.java @@ -0,0 +1,44 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat.attach; + +import java.io.IOException; +import java.util.Properties; + +/** + * + */ +public interface VirtualMachineProxy { + + public void detach() throws IOException; + + public String id(); + + public Properties getAgentProperties() throws IOException; + + public Properties getSystemProperties() throws IOException; + + public void loadAgent(String agent) throws IOException; + + public void loadAgent(String agent, String options) throws IOException; + + public void loadAgentLibrary(String agentLibrary) throws IOException; + + public void loadAgentLibrary(String agentLibrary, String options) throws IOException; + + public void loadAgentPath(String agentPath) throws IOException; + + public void loadAgentPath(String agentPath, String options) throws IOException; + + public String toString(); + +} diff --git a/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxyHelper.java b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxyHelper.java new file mode 100755 index 00000000000..20b4ad85a93 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/fat/src/com/ibm/ws/jmx/fat/attach/VirtualMachineProxyHelper.java @@ -0,0 +1,153 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.fat.attach; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.List; + +/** + * + */ +public final class VirtualMachineProxyHelper { + + private static final String IBM_VIRTUAL_MACHINE = "com.ibm.tools.attach.VirtualMachine"; + private static final String SUN_VIRTUAL_MACHINE = "com.sun.tools.attach.VirtualMachine"; + + private static final String IBM_VIRTUAL_MACHINE_DESCRIPTOR = "com.ibm.tools.attach.VirtualMachineDescriptor"; + private static final String SUN_VIRTUAL_MACHINE_DESCRIPTOR = "com.sun.tools.attach.VirtualMachineDescriptor"; + + private static final Class VIRTUAL_MACHINE_CLASS; + private static final Class VIRTUAL_MACHINE_DESCRIPTOR_CLASS; + static { + Class c1 = null; + Class c2 = null; + try { + // Attempt to load the IBM flavor of the Attach API. + c1 = Class.forName(IBM_VIRTUAL_MACHINE); + c2 = Class.forName(IBM_VIRTUAL_MACHINE_DESCRIPTOR); + } catch (ClassNotFoundException e) { + try { + // Not an IBM JDK. Attempt to load the Oracle/Sun flavor of the Attach API. + // This requires tools.jar. We cannot assume it's on the system classpath + // so we add it to the search path of the ClassLoader. + String javaHome = System.getProperty("java.home"); + // Assumes "java.home" points to JDK_BASE_DIR/jre or JDK_BASE_DIR + File toolsJarLocation1 = new File(javaHome + File.separator + ".." + File.separator + "lib" + File.separator + "tools.jar"); + File toolsJarLocation2 = new File(javaHome + File.separator + "lib" + File.separator + "tools.jar"); + ClassLoader cl = URLClassLoader.newInstance(new URL[] { toolsJarLocation1.toURI().toURL(), + toolsJarLocation2.toURI().toURL() }); + c1 = Class.forName(SUN_VIRTUAL_MACHINE, true, cl); + c2 = Class.forName(SUN_VIRTUAL_MACHINE_DESCRIPTOR, true, cl); + } catch (MalformedURLException e2) { + throw new IllegalStateException(e2); + } catch (ClassNotFoundException e2) { + throw new IllegalStateException("An implementation of the Attach API was not found.", e2); + } + } + VIRTUAL_MACHINE_CLASS = c1; + VIRTUAL_MACHINE_DESCRIPTOR_CLASS = c2; + } + + public static VirtualMachineProxy attach(String id) throws IOException { + try { + Method attachMethod = VIRTUAL_MACHINE_CLASS.getMethod("attach", String.class); + attachMethod.setAccessible(true); + Object vm = attachMethod.invoke(null, id); + if (vm != null) { + return (VirtualMachineProxy) Proxy.newProxyInstance(VirtualMachineProxy.class.getClassLoader(), + new Class[] { VirtualMachineProxy.class }, + new ForwardingInvocationHandler(vm)); + } + return null; + } catch (NoSuchMethodException e) { + throw new IllegalStateException(e); + } catch (IllegalArgumentException e) { + throw new IllegalStateException(e); + } catch (IllegalAccessException e) { + throw new IllegalStateException(e); + } catch (InvocationTargetException e) { + throw new IllegalStateException(e); + } + } + + public static VirtualMachineProxy attach(VirtualMachineDescriptorProxy vmd) throws IOException { + Object _vmd = null; + if (vmd instanceof ObjectProxy) { + _vmd = ((ObjectProxy) vmd).getBackingObject(); + } else if (vmd != null) { + throw new IllegalArgumentException("Unsupported proxy instance."); + } + try { + Method attachMethod = VIRTUAL_MACHINE_CLASS.getMethod("attach", VIRTUAL_MACHINE_DESCRIPTOR_CLASS); + attachMethod.setAccessible(true); + Object vm = attachMethod.invoke(null, _vmd); + if (vm != null) { + return (VirtualMachineProxy) Proxy.newProxyInstance(VirtualMachineProxy.class.getClassLoader(), + new Class[] { VirtualMachineProxy.class }, + new ForwardingInvocationHandler(vm)); + } + return null; + } catch (NoSuchMethodException e) { + throw new IllegalStateException(e); + } catch (IllegalArgumentException e) { + throw new IllegalStateException(e); + } catch (IllegalAccessException e) { + throw new IllegalStateException(e); + } catch (InvocationTargetException e) { + throw new IllegalStateException(e); + } + } + + public static List list() { + try { + Method attachMethod = VIRTUAL_MACHINE_CLASS.getMethod("list"); + attachMethod.setAccessible(true); + @SuppressWarnings("rawtypes") + List list = (List) attachMethod.invoke(null); + if (list == null) { + return null; + } + final int size = list.size(); + List _list = new ArrayList(size); + for (int i = 0; i < size; ++i) { + Object vmd = list.get(i); + if (vmd != null) { + _list.add((VirtualMachineDescriptorProxy) Proxy.newProxyInstance(VirtualMachineDescriptorProxy.class.getClassLoader(), + new Class[] { VirtualMachineDescriptorProxy.class, ObjectProxy.class }, + new ForwardingInvocationHandler(vmd))); + } else { + _list.add(null); + } + } + return _list; + } catch (NoSuchMethodException e) { + throw new IllegalStateException(e); + } catch (IllegalArgumentException e) { + throw new IllegalStateException(e); + } catch (IllegalAccessException e) { + throw new IllegalStateException(e); + } catch (InvocationTargetException e) { + throw new IllegalStateException(e); + } + } + + private VirtualMachineProxyHelper() {} + +} diff --git a/dev/com.ibm.ws.jmx_fat/publish/.gitignore b/dev/com.ibm.ws.jmx_fat/publish/.gitignore new file mode 100644 index 00000000000..7ad6e8cac5f --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/publish/.gitignore @@ -0,0 +1,2 @@ +/bundles +/files diff --git a/dev/com.ibm.ws.jmx_fat/publish/features/jmxtest-1.0.mf b/dev/com.ibm.ws.jmx_fat/publish/features/jmxtest-1.0.mf new file mode 100755 index 00000000000..5b5e26ae2ea --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/publish/features/jmxtest-1.0.mf @@ -0,0 +1,8 @@ + +Subsystem-ManifestVersion: 1 +IBM-ShortName: jmxtest-1.0 +Subsystem-SymbolicName: com.ibm.websphere.jmx.jmxtest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.jmx.fat;version=0 +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/bootstrap.properties b/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/bootstrap.properties new file mode 100755 index 00000000000..703551895b3 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/bootstrap.properties @@ -0,0 +1,5 @@ +bootstrap.include=../testports.properties +com.ibm.ws.logging.trace.specification=*=info=enabled:\ +logservice=all=enabled:\ +com.ibm.ws.jmx.internal=all:\ +com.ibm.ws.kernel.boot.jmx.internal=all:\ diff --git a/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/server.xml b/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/server.xml new file mode 100755 index 00000000000..90b60256d51 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/publish/servers/com.ibm.ws.jmx.fat/server.xml @@ -0,0 +1,8 @@ + + + + localConnector-1.0 + timedexit-1.0 + jmxtest-1.0 + + diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/bnd.bnd b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/bnd.bnd new file mode 100755 index 00000000000..2af06f6876c --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/bnd.bnd @@ -0,0 +1,51 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: JMX Test bundle +Bundle-SymbolicName: com.ibm.ws.jmx.fat +Bundle-Description: Test bundle for the jmx project + +# optional... +WS-TraceGroup: projectExample + +Private-Package: com.ibm.ws.jmx.test.fat + +Import-Package: !*.internal.*, org.osgi.framework;version="1.3", * + +#Include-Resource: OSGI-INF=bvt-bundle/resources/OSGI-INF + +-dsannotations=com.ibm.ws.jmx.test.fat.DelayedMbeanTester + +Service-Component: \ + com.ibm.ws.jmx.test.fat.testBean1;\ + implementation:=com.ibm.ws.jmx.test.fat.TestBean1;\ + provide:='javax.management.DynamicMBean';\ + immediate:=true;\ + configuration-policy:=ignore;\ + properties:="service.vendor=IBM,jmx.objectname=WebSphere:name=com.ibm.ws.jmx.test.fat.testBean1",\ + com.ibm.ws.jmx.test.fat.testBean2;\ + implementation:=com.ibm.ws.jmx.test.fat.TestBean2;\ + provide:='javax.management.DynamicMBean';\ + immediate:=true;\ + configuration-policy:=ignore;\ + properties:="service.vendor=IBM,jmx.objectname=WebSphere:name=com.ibm.ws.jmx.test.fat.testBean2",\ + com.ibm.ws.jmx.test.fat.testBean3;\ + implementation:=com.ibm.ws.jmx.test.fat.TestBean3;\ + provide:='javax.management.DynamicMBean';\ + immediate:=false;\ + configuration-policy:=ignore;\ + properties:="service.vendor=IBM,jmx.objectname=WebSphere:name=com.ibm.ws.jmx.test.fat.testBean3",\ + com.ibm.ws.jmx.test.fat.beanCounter;\ + implementation:=com.ibm.ws.jmx.test.fat.BeanCounter;\ + jmxServer=com.ibm.ws.jmx.PlatformMBeanService;\ + provide:='javax.management.DynamicMBean';\ + immediate:=true;\ + configuration-policy:=ignore;\ + properties:="service.vendor=IBM,jmx.objectname=WebSphere:name=com.ibm.ws.jmx.test.fat.beanCounter",\ + ServerTestConnector;\ + implementation:=com.ibm.ws.jmx.test.fat.ServerConnector;\ + jmxServer=com.ibm.ws.jmx.PlatformMBeanService;\ + immediate:=true;\ + properties:="service.vendor=IBM" diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/BeanCounter.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/BeanCounter.java new file mode 100755 index 00000000000..47afc8a0410 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/BeanCounter.java @@ -0,0 +1,94 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +import java.lang.reflect.Field; + +import javax.management.AttributeNotFoundException; +import javax.management.MBeanException; +import javax.management.MBeanServer; +import javax.management.ReflectionException; + +import org.osgi.framework.ServiceReference; +import org.osgi.service.component.ComponentContext; + +import com.ibm.ws.jmx.PlatformMBeanService; + +/** + * + */ +public class BeanCounter extends TestBean { + + ServiceReference mbeanServerRef; + MBeanServer mBeanServer; + PlatformMBeanService mbeanService; + + /** + * @param name + */ + public BeanCounter() { + super(BeanCounter.class.getName()); + + } + + public void activate(ComponentContext compContext) { + mbeanService = null; + try { + mbeanService = compContext.locateService("jmxServer", mbeanServerRef); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public void deactivate(ComponentContext compContext) {} + + public void setJmxServer(ServiceReference mbeanServerRef) { + this.mbeanServerRef = mbeanServerRef; + } + + public void unsetJmxServer(ServiceReference mbeanServer) {} + + public int getNonDelayedBeanCount() { + MBeanServer server = mbeanService.getMBeanServer(); + try { + Class clazz = server.getClass(); + Field f = clazz.getDeclaredField("last"); + f.setAccessible(true); + server = (MBeanServer) f.get(server); + } catch (Exception e) { + e.printStackTrace(); + } + mBeanServer = server; + return mBeanServer.getMBeanCount(); + } + + @Override + public Object getAttribute(String s) throws AttributeNotFoundException, MBeanException, ReflectionException { + return "beanCount".equals(s) ? getNonDelayedBeanCount() : super.getAttribute(s); + } + + // @Override + // public MBeanInfo getMBeanInfo() { + // try { + // Class clazz = this.getClass(); + // Method getter = clazz.getDeclaredMethod("getNonDelayedBeanCount", null); + // MBeanAttributeInfo aInfo = new MBeanAttributeInfo("beanCount", "beanCounter.beanCount", getter, null); + // MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[] { aInfo }; + // MBeanInfo info = new MBeanInfo(toString(), "bean counter", attrs, null, null, null); + // return info; + // } catch (Exception e) { + // e.printStackTrace(); + // throw new RuntimeException(e); + // } + // } +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTester.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTester.java new file mode 100755 index 00000000000..58896d35bd0 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTester.java @@ -0,0 +1,102 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +import java.util.Hashtable; + +import javax.management.DynamicMBean; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ConfigurationPolicy; + +/** + * Registers and unregisters some "delayed" mbeans that don't like to return the service references + */ +@Component(configurationPolicy = ConfigurationPolicy.IGNORE, + property = { "jmx.objectname=WebSphere:name=com.ibm.ws.jmx.test.fat.delayedMbeanTester" }) +public class DelayedMbeanTester implements DelayedMbeanTesterMBean { + + private BundleContext bundleContext; + private ServiceRegistration reg1; + private boolean allow1; + private ServiceRegistration reg2; + + protected void activate(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + + protected void deactivate() { + this.bundleContext = null; + } + + /* + * (non-Javadoc) + * + * @see com.ibm.ws.jmx.test.fat.DelayedMbeanTesterMBean#register() + */ + @Override + public void register() { + Hashtable properties1 = new Hashtable(); + properties1.put("jmx.objectname", "WebSphere:name=com.ibm.ws.jmx.test.fat.delayedMbeanTester.Bean1"); + reg1 = bundleContext.registerService(DynamicMBean.class.getName(), + new ServiceFactory() { + + @Override + public TestBean getService(Bundle bundle, ServiceRegistration registration) { + return allow1 ? new TestBean("delayed1") : null; + } + + @Override + public void ungetService(Bundle bundle, ServiceRegistration registration, TestBean service) {} + }, + properties1); + Hashtable properties2 = new Hashtable(); + properties2.put("jmx.objectname", "WebSphere:name=com.ibm.ws.jmx.test.fat.delayedMbeanTester.Bean2"); + reg2 = bundleContext.registerService(DynamicMBean.class.getName(), + new ServiceFactory() { + + @Override + public TestBean getService(Bundle bundle, ServiceRegistration registration) { + return null; + } + + @Override + public void ungetService(Bundle bundle, ServiceRegistration registration, TestBean service) {} + }, + properties2); + } + + /* + * (non-Javadoc) + * + * @see com.ibm.ws.jmx.test.fat.DelayedMbeanTesterMBean#allow1Service() + */ + @Override + public void allow1Service() { + allow1 = true; + } + + /* + * (non-Javadoc) + * + * @see com.ibm.ws.jmx.test.fat.DelayedMbeanTesterMBean#unregister() + */ + @Override + public void unregister() { + reg1.unregister(); + reg2.unregister(); + } +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTesterMBean.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTesterMBean.java new file mode 100755 index 00000000000..2ee1918a7fa --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/DelayedMbeanTesterMBean.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +/** + * + */ +public interface DelayedMbeanTesterMBean { + + void register(); + + void allow1Service(); + + void unregister(); + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/Messages.properties b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/Messages.properties new file mode 100755 index 00000000000..c19eb03f649 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/Messages.properties @@ -0,0 +1,4 @@ +STARTED=Registry started with URL {0}. +SERVER=MBeanServer obtained with domains {0}. +SERVER_READY=JMXConnectorServer is ready with open connections {0}. +SERVER_STOPPED=JMXConnectorServer is stopped. diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/ServerConnector.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/ServerConnector.java new file mode 100755 index 00000000000..46d1aa5ae43 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/ServerConnector.java @@ -0,0 +1,161 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.rmi.NoSuchObjectException; +import java.rmi.RemoteException; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; +import java.rmi.server.UnicastRemoteObject; + +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; +import javax.management.remote.JMXServiceURL; + +import org.osgi.framework.ServiceReference; +import org.osgi.service.component.ComponentContext; + +import com.ibm.websphere.ras.Tr; +import com.ibm.websphere.ras.TraceComponent; +import com.ibm.ws.jmx.PlatformMBeanService; +import com.ibm.wsspi.kernel.service.utils.OsgiPropertyUtils; + +/** + * + */ +public class ServerConnector { + private static final TraceComponent tc = Tr.register(ServerConnector.class); + + String URL; + JMXConnectorServer cs; + ComponentContext context; + ServiceReference mbeanServerRef; + Registry registry; + + public ServerConnector() { + super(); + cs = null; + context = null; + mbeanServerRef = null; + registry = null; + } + + public void activate(ComponentContext compContext) { + context = compContext; + + int port = Integer.valueOf(OsgiPropertyUtils.getProperty("bvt.prop.JMXTest", "8999")); + final String URL = "service:jmx:rmi:///jndi/rmi://localhost:" + port + "/server"; + + registry = null; + try { + registry = LocateRegistry.createRegistry(port); + } catch (RemoteException e1) { + // TODO Auto-generated catch block + // Do you need FFDC here? Remember FFDC instrumentation and @FFDCIgnore + // https://websphere.pok.ibm.com/~alpine/secure/docs/dev/API/com.ibm.ws.ras/com/ibm/ws/ffdc/annotation/FFDCIgnore.html + e1.printStackTrace(); + throw new RuntimeException(e1); + } + Tr.info(tc, "STARTED", URL); + + Runnable r = new Runnable() { + + @Override + public void run() { + PlatformMBeanService mbeanServer = null; + try { + mbeanServer = context.locateService("jmxServer", mbeanServerRef); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + Tr.info(tc, "SERVER", strings(mbeanServer.getMBeanServer().getDomains())); + + JMXServiceURL url = null; + try { + url = new JMXServiceURL(URL); + } catch (MalformedURLException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + + try { + cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbeanServer.getMBeanServer()); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + + try { + cs.start(); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + Tr.info(tc, "SERVER_READY", strings(cs.getConnectionIds())); + } + }; + Thread thr = new Thread(r); + thr.start(); + + } + + public void deactivate(ComponentContext compContext) { + try { + cs.stop(); + } catch (IOException e) { + // TODO Auto-generated catch block + // Do you need FFDC here? Remember FFDC instrumentation and @FFDCIgnore + // https://websphere.pok.ibm.com/~alpine/secure/docs/dev/API/com.ibm.ws.ras/com/ibm/ws/ffdc/annotation/FFDCIgnore.html + e.printStackTrace(); + throw new RuntimeException(e); + } + context = null; + try { + UnicastRemoteObject.unexportObject(registry, true); + } catch (NoSuchObjectException e) { + // TODO Auto-generated catch block + // Do you need FFDC here? Remember FFDC instrumentation and @FFDCIgnore + // https://websphere.pok.ibm.com/~alpine/secure/docs/dev/API/com.ibm.ws.ras/com/ibm/ws/ffdc/annotation/FFDCIgnore.html + e.printStackTrace(); + } + registry = null; + Tr.info(tc, "SERVER_STOPPED"); + } + + public void setJmxServer(ServiceReference mbeanServerRef) { + this.mbeanServerRef = mbeanServerRef; + } + + public void unsetJmxServer(ServiceReference mbeanServer) { + cs = null; + } + + private static String strings(String[] strs) { + StringBuilder str = new StringBuilder("["); + if (strs != null) { + boolean first = true; + for (String s : strs) { + if (first) { + first = false; + } else { + str.append(','); + } + str.append(s); + } + } + str.append(']'); + return str.toString(); + } +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean.java new file mode 100755 index 00000000000..1cd79c13a6d --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean.java @@ -0,0 +1,97 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +import java.util.Map; + +import javax.management.Attribute; +import javax.management.AttributeList; +import javax.management.AttributeNotFoundException; +import javax.management.DynamicMBean; +import javax.management.InvalidAttributeValueException; +import javax.management.MBeanException; +import javax.management.MBeanInfo; +import javax.management.ReflectionException; + +/** + * + */ +public class TestBean implements DynamicMBean { + + private final String name; + + protected TestBean(String name) { + System.setProperty("com.ibm.ws.jmx.test.fat", "true"); + this.name = name; + } + + /** + * DS method to activate this component. + * Best practice: this should be a protected method, not public or private + * + * @param properties : Map containing service properties + */ + protected void activate(Map properties) {} + + /** + * DS method to deactivate this component. + * Best practice: this should be a protected method, not public or private + * + * @param reason int representation of reason the component is stopping + */ + protected void deactivate(int reason) {} + + @Override + public String toString() { + return name; + } + + /** {@inheritDoc} */ + @Override + public Object getAttribute(String arg0) throws AttributeNotFoundException, MBeanException, ReflectionException { + return toString(); + } + + /** {@inheritDoc} */ + @Override + public AttributeList getAttributes(String[] arg0) { + // TODO Auto-generated method stub + return null; + } + + /** {@inheritDoc} */ + @Override + public MBeanInfo getMBeanInfo() { + return new MBeanInfo(name, "test bean", null, null, null, null); + } + + /** {@inheritDoc} */ + @Override + public Object invoke(String arg0, Object[] arg1, String[] arg2) throws MBeanException, ReflectionException { + // TODO Auto-generated method stub + return null; + } + + /** {@inheritDoc} */ + @Override + public void setAttribute(Attribute arg0) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { + // TODO Auto-generated method stub + + } + + /** {@inheritDoc} */ + @Override + public AttributeList setAttributes(AttributeList arg0) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean1.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean1.java new file mode 100755 index 00000000000..065c567bfca --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean1.java @@ -0,0 +1,21 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +/** + * + */ +public class TestBean1 extends TestBean { + public TestBean1() { + super(TestBean1.class.getName()); + } +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean2.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean2.java new file mode 100755 index 00000000000..dcce080f80e --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean2.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +/** + * + */ +public class TestBean2 extends TestBean { + + public TestBean2() { + super(TestBean2.class.getName()); + + // System.out.println("$$$$$$$$$$$$$$$$$$$$$$$ in TestBean2"); + } + +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean3.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean3.java new file mode 100755 index 00000000000..a41516778bb --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/TestBean3.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jmx.test.fat; + +/** + * + */ +public class TestBean3 extends TestBean { + + public TestBean3() { + super(TestBean3.class.getName()); + + // System.out.println("###################### in TestBean3.ctor"); + } + +} diff --git a/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/package-info.java b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/package-info.java new file mode 100755 index 00000000000..f6a5d5d0910 --- /dev/null +++ b/dev/com.ibm.ws.jmx_fat/test-bundles/test-mbeans/src/com/ibm/ws/jmx/test/fat/package-info.java @@ -0,0 +1,19 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +/** + * @version 1.0 + */ +@TraceOptions(traceGroup = "projectExample", messageBundle = "com.ibm.ws.jmx.test.fat.Messages") +package com.ibm.ws.jmx.test.fat; + +import com.ibm.websphere.ras.annotation.TraceOptions; + diff --git a/dev/com.ibm.ws.kernel.boot_fat/.classpath b/dev/com.ibm.ws.kernel.boot_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/.classpath.gradle b/dev/com.ibm.ws.kernel.boot_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/.gitignore b/dev/com.ibm.ws.kernel.boot_fat/.gitignore new file mode 100644 index 00000000000..9fb7b834a97 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.gitignore @@ -0,0 +1,5 @@ +*.log* +/TestBundleDeactivate.txt +/coverage.ec +/lib +/reports diff --git a/dev/com.ibm.ws.kernel.boot_fat/.project b/dev/com.ibm.ws.kernel.boot_fat/.project new file mode 100755 index 00000000000..86c8544a2b1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.boot_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..845c3083c7d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +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.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..fadbc117581 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=true +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd b/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.kernel.boot_fat/build-test.xml b/dev/com.ibm.ws.kernel.boot_fat/build-test.xml new file mode 100755 index 00000000000..305d7ade58b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/build-test.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/build.gradle b/dev/com.ibm.ws.kernel.boot_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.kernel.boot_fat/delivery.sets b/dev/com.ibm.ws.kernel.boot_fat/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/FATSuite.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/FATSuite.java new file mode 100755 index 00000000000..1bbe7536a7b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/FATSuite.java @@ -0,0 +1,59 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import com.ibm.ws.kernel.boot.commandline.CreateCommandTest; +import com.ibm.ws.kernel.boot.commandline.DumpCommandTest; +import com.ibm.ws.kernel.boot.commandline.PauseResumeCommandTest; +import com.ibm.ws.kernel.boot.commandline.StartCommandTest; +import com.ibm.ws.kernel.boot.commandport.ServerCommandPortTest; +import com.ibm.ws.kernel.boot.internal.commands.LogLevelPropertyTest; +import com.ibm.ws.kernel.boot.internal.commands.PackageCommandTest; +import com.ibm.ws.kernel.provisioning.KernelChangeTest; +import com.ibm.ws.kernel.provisioning.ProvisioningTest; +import com.ibm.wsspi.kernel.embeddable.EmbeddedServerAddProductExtensionMultipleTest; +import com.ibm.wsspi.kernel.embeddable.EmbeddedServerAddProductExtensionTest; +import com.ibm.wsspi.kernel.embeddable.EmbeddedServerTest; + +/** + * Collection of a few fast example tests + */ +@RunWith(Suite.class) +/* + * The classes specified in the @SuiteClasses annotation + * below should only be mainline test cases that complete + * in a combined total of 5 minutes or less. + */ +@SuiteClasses({ + EmbeddedServerTest.class, + EmbeddedServerAddProductExtensionTest.class, + EmbeddedServerAddProductExtensionMultipleTest.class, + ProvisioningTest.class, + KernelChangeTest.class, + ServerStartTest.class, + ServerStartAsServiceTest.class, + ShutdownTest.class, + ServerCommandPortTest.class, + DumpCommandTest.class, + PackageCommandTest.class, + LogLevelPropertyTest.class, + CreateCommandTest.class, + StartCommandTest.class, + ServerClasspathTest.class, + ServerStartJVMOptionsTest.class, + PauseResumeCommandTest.class +}) +public class FATSuite {} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/OnlyRunOnWinRule.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/OnlyRunOnWinRule.java new file mode 100644 index 00000000000..e8c45e8428d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/OnlyRunOnWinRule.java @@ -0,0 +1,41 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.log.Log; + +/** + * Rule to run on Windows. + */ +public class OnlyRunOnWinRule implements TestRule { + + /** This constant is exposed to any test code to use. It is true iff the FAT is running on z/OS. */ + public static final boolean IS_RUNNING_ON_WINDOWS = System.getProperty("os.name").toLowerCase().contains("windows"); + + @Override + public Statement apply(final Statement statement, final Description description) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + if (IS_RUNNING_ON_WINDOWS) { + statement.evaluate(); + } else { + Log.info(description.getTestClass(), description.getMethodName(), "Test class or method is skipped due to run on Windows rule"); + } + } + }; + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerClasspathTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerClasspathTest.java new file mode 100644 index 00000000000..b4381d98d19 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerClasspathTest.java @@ -0,0 +1,84 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertEquals; + +import java.util.Iterator; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import componenttest.custom.junit.runner.OnlyRunInJava7Rule; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Tests what can and cannot be loaded by the server's JVM classpath. + */ +public class ServerClasspathTest { + + private static final String SERVER_NAME = "com.ibm.ws.kernel.boot.classpath.fat"; + + private static final LibertyServer server = LibertyServerFactory.getLibertyServer(SERVER_NAME); + + private static final String[] EXPECTED_PACKAGES = { "com.ibm.ws.kernel", "java.", "javax.", "sun.", + "org.osgi.framework", "com.ibm.crypto", "com.ibm.security", + "com.ibm.misc", "com.ibm.xml", "com.ibm.nio", "com.ibm.jvm", + "org.apache.xerces", "com.ibm.Compiler", "com.ibm.oti", + "org.omg.CORBA", "com.sun", "org.xml.sax", "com.ibm.jit", + "com.ibm.jsse2", "com.ibm.lang.management", "com.ibm.tools.attach", + "com.ibm.virtualization.management", "com.ibm.wsspi.kernel", + "jdk.xml.internal", // Windows, Sun + "jdk.net" // Java 8, Sun 1.7 + }; + + @ClassRule + public static final TestRule java7Rule = new OnlyRunInJava7Rule(); + + @BeforeClass + public static void before() throws Exception { + server.startServer(); + } + + @AfterClass + public static void after() throws Exception { + server.stopServer(); + } + + @Test + public void testJvmAppClasspath() throws Exception { + //TODO: check logs for any packages that are not in the expected packages list + StringBuilder unexpectedPackages = new StringBuilder(); + List pkgsOnCP = server.findStringsInLogs("AppLoader can load: .*", server.getConsoleLogFile()); + Iterator iter = pkgsOnCP.iterator(); + boolean allowed; + while (iter.hasNext()) { + allowed = false; + String pkg = iter.next().substring("AppLoader can load: ".length()); + for (String allowedPkg : EXPECTED_PACKAGES) { + if (pkg.startsWith(allowedPkg)) { + allowed = true; + break; + } + } + if (!allowed) { + unexpectedPackages.append(" " + pkg); + } + } + assertEquals("Found unexpected packages in the server JVM's application classpath", "", unexpectedPackages.toString()); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartAsServiceTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartAsServiceTest.java new file mode 100644 index 00000000000..bd65dd6d56b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartAsServiceTest.java @@ -0,0 +1,140 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.ProtocolException; +import java.net.URL; + +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This test bucket tests the server startup process. + */ +public class ServerStartAsServiceTest { + private static final Class c = ServerStartAsServiceTest.class; + + private static final String SERVER_NAME = "ServerStartAsServiceTest"; + + private static LibertyServer server; + + @ClassRule + public static final TestRule onWinRule = new OnlyRunOnWinRule(); + + @Test + /** + * test Liberty Server to Register, Start, Stop and Unregister as a Windows Service + * + * @throws Exception + */ + public void testWinServiceLifeCycle() throws Exception { + final String METHOD_NAME = "testWinServiceLifeCycle"; + Log.entering(c, METHOD_NAME); + + Log.info(c, METHOD_NAME, "calling LibertyServerFactory.getLibertyServer(SERVER_NAME, ON): " + SERVER_NAME); + server = LibertyServerFactory.getLibertyServer(SERVER_NAME, LibertyServerFactory.WinServiceOption.ON); + + Log.info(c, METHOD_NAME, "calling server.startServer()"); + server.startServer(); + + Log.info(c, METHOD_NAME, "calling server.waitForStringInLog('CWWKF0011I')"); + server.waitForStringInLog("CWWKF0011I"); + + assertTrue("the server should have been started", server.isStarted()); + + Log.info(c, METHOD_NAME, "calling server.stopServer(): " + SERVER_NAME); + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + @Test + /** + * test Liberty Server to Register, Start, Stop and Unregister as a Windows Service + * test snoop can be installed and accessed. + * + * @throws Exception + */ + public void testWinServiceAppAccess() throws Exception { + final String METHOD_NAME = "testWinServiceAppAccess"; + + Log.entering(c, METHOD_NAME); + + Log.info(c, METHOD_NAME, "calling LibertyServerFactory.getLibertyServer(SERVER_NAME, ON): " + SERVER_NAME); + server = LibertyServerFactory.getLibertyServer(SERVER_NAME, LibertyServerFactory.WinServiceOption.ON); + + Log.info(c, METHOD_NAME, "calling server.startServer()"); + server.startServer(); + + Log.info(c, METHOD_NAME, "calling server.waitForStringInLog('CWWKF0011I')"); + server.waitForStringInLog("CWWKF0011I"); + + assertTrue("the server should have been started", server.isStarted()); + + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/snoop"); + Log.info(c, METHOD_NAME, "Calling Snoop Application with URL=" + url.toString()); + HttpURLConnection con = getHttpConnection(url); + BufferedReader br = getConnectionStream(con); + String line = br.readLine(); + assertTrue("The response did not contain the \'Snoop Servlet\'", + line.contains("Snoop Servlet")); + + Log.info(c, METHOD_NAME, "return line: " + line); + + Log.info(c, METHOD_NAME, "calling server.stopServer(): " + SERVER_NAME); + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * This method is used to get a connection stream from an HTTP connection. It + * gives the output from the webpage that it gets from the connection + * + * @param con The connection to the HTTP address + * @return The Output from the webpage + */ + private static BufferedReader getConnectionStream(HttpURLConnection con) throws IOException { + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + return br; + } + + /** + * This method creates a connection to a webpage and then reutrns the connection + * + * @param url The Http Address to connect to + * @return The connection to the http address + */ + private static HttpURLConnection getHttpConnection(URL url) throws IOException, ProtocolException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + return con; + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartJVMOptionsTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartJVMOptionsTest.java new file mode 100644 index 00000000000..2207aa68e5d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartJVMOptionsTest.java @@ -0,0 +1,457 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* WLP Copyright IBM Corp. 2016 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.Enumeration; +import java.util.Properties; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class ServerStartJVMOptionsTest { + private static final Class c = ServerStartJVMOptionsTest.class; + + private static final String SERVER_NAME = "com.ibm.ws.kernel.boot.serverstart.fat"; + static String executionDir; + + private static LibertyServer server; + static File dirs; + static File dirs2; + static File jvmoptionsconfigdefaults; + static File jvmoptionsserverroot; + static File jvmoptionsconfigoverrides; + static File etcjvmoptions; + static File sharedjvmoptions; + static File bootstrapPropFile; + + @BeforeClass + public static void before() { + server = LibertyServerFactory.getLibertyServer(SERVER_NAME); + executionDir = server.getInstallRoot(); + dirs = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "configDropins" + File.separator + "defaults"); + dirs2 = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "configDropins" + File.separator + "overrides"); + jvmoptionsconfigdefaults = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "configDropins" + File.separator + "defaults" + File.separator + "jvm.options"); + jvmoptionsserverroot = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "jvm.options"); + jvmoptionsconfigoverrides = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "configDropins" + File.separator + "overrides" + File.separator + "jvm.options"); + etcjvmoptions = new File(executionDir + File.separator + "etc" + File.separator + "jvm.options"); + sharedjvmoptions = new File(executionDir + File.separator + "usr" + File.separator + "shared" + File.separator + "jvm.options"); + bootstrapPropFile = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME + + File.separator + "bootstrap.properties"); + } + + @AfterClass + public static void after() throws Exception { + if (server.isStarted()) { + server.stopServer(); + } + } + + /** + * This test ensures the server can be started with no jvm.options files or merged.jvm.options file + * + * @throws Exception + */ + @Test + public void testServerStartNoJVMOptions() throws Exception { + final String METHOD_NAME = "testServerStartNoJVMOptions"; + Log.entering(c, METHOD_NAME); + + String command = "bin" + File.separator + "server"; + String[] parms = new String[2]; + parms[0] = "start"; + parms[1] = SERVER_NAME; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + initialize(); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "server start stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "server start stderr = " + po.getStderr()); + + server.waitForStringInLog("CWWKF0011I"); + server.resetStarted(); + + assertTrue("the server should have been started", server.isStarted()); + + server.stopServer(); + } + + /** + * This test ensures the server fails over to etc/jvm.options if none are found + * + * @throws Exception + */ + @Test + public void testServerStartNoJVMOptionsETCFailover() throws Exception { + final String METHOD_NAME = "testServerStartNoJVMOptionsETCFailover"; + Log.entering(c, METHOD_NAME); + + String command = "bin" + File.separator + "server"; + String[] parms = new String[2]; + parms[0] = "start"; + parms[1] = SERVER_NAME; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + initialize(); + + Writer isw = new OutputStreamWriter(new FileOutputStream(etcjvmoptions), "UTF-8"); + BufferedWriter bw = new BufferedWriter(isw); + bw.write("-DTest1=Test1"); + bw.close(); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "server start stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "server start stderr = " + po.getStderr()); + + server.waitForStringInLog("CWWKF0011I"); + server.resetStarted(); + + server.serverDump(); + File[] filesAfterDump = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME).listFiles(); + + File dumpFile = new File(""); + for (File f : filesAfterDump) { + String fileName = f.getName(); + Log.info(c, METHOD_NAME, "Found file: " + fileName); + if (fileName.startsWith(SERVER_NAME + ".dump") && fileName.endsWith(".zip")) { + dumpFile = f; + break; + } + } + + if (dumpFile.getPath().compareTo("") == 0) { + fail("The Dump File was not found"); + } + + ZipFile zipFile = new ZipFile(dumpFile); + + boolean foundTest1 = false; + for (Enumeration en = zipFile.entries(); en.hasMoreElements();) { + ZipEntry entry = en.nextElement(); + String entryName = entry.getName(); + if (entryName.endsWith("JavaRuntimeInformation.txt")) { + InputStream inputstream = zipFile.getInputStream(entry); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream)); + String line; + int i = 0; + while ((line = reader.readLine()) != null) { + Log.info(c, METHOD_NAME, "Run" + i + ": " + line); + if (line.contains("-DTest1=Test1")) { + foundTest1 = true; + break; + } + i++; + } + + reader.close(); + inputstream.close(); + } + } + + zipFile.close(); + dumpFile.delete(); + assertTrue("The jvm option was not found", foundTest1); + + server.stopServer(); + } + + /** + * This test ensures the server can be started with one jvm.options file + * + * @throws Exception + */ + @Test + public void testServerStartOneJVMOption() throws Exception { + final String METHOD_NAME = "testServerStartOneJVMOption"; + Log.entering(c, METHOD_NAME); + + String command = "bin" + File.separator + "server"; + String[] parms = new String[2]; + parms[0] = "start"; + parms[1] = SERVER_NAME; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + initialize(); + + Writer isw = new OutputStreamWriter(new FileOutputStream(jvmoptionsconfigdefaults), "UTF-8"); + BufferedWriter bw = new BufferedWriter(isw); + bw.write("-DTest1=Test1"); + bw.close(); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "server start stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "server start stderr = " + po.getStderr()); + server.waitForStringInLog("CWWKF0011I"); + server.resetStarted(); + + server.serverDump(); + File[] filesAfterDump = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME).listFiles(); + + File dumpFile = new File(""); + for (File f : filesAfterDump) { + String fileName = f.getName(); + Log.info(c, METHOD_NAME, "Found file: " + fileName); + if (fileName.startsWith(SERVER_NAME + ".dump") && fileName.endsWith(".zip")) { + dumpFile = f; + break; + } + } + + if (dumpFile.getPath().compareTo("") == 0) { + fail("The Dump File was not found"); + } + + ZipFile zipFile = new ZipFile(dumpFile); + + boolean foundTest1 = false; + for (Enumeration en = zipFile.entries(); en.hasMoreElements();) { + ZipEntry entry = en.nextElement(); + String entryName = entry.getName(); + if (entryName.endsWith("JavaRuntimeInformation.txt")) { + InputStream inputstream = zipFile.getInputStream(entry); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream)); + String line; + int i = 0; + while ((line = reader.readLine()) != null) { + Log.info(c, METHOD_NAME, "Run" + i + ": " + line); + if (line.contains("-DTest1=Test1")) { + foundTest1 = true; + break; + } + i++; + } + + reader.close(); + inputstream.close(); + } + } + + zipFile.close(); + dumpFile.delete(); + assertTrue("The jvm option was not found", foundTest1); + + server.stopServer(); + } + + /** + * This test ensures the server can be started with all jvm.options files and + * the right options are used at the end + * + * @throws Exception + */ + @Test + @Mode(TestMode.LITE) + public void testServerStartAllJVMOptions() throws Exception { + final String METHOD_NAME = "testServerStartAllJVMOptions"; + Log.entering(c, METHOD_NAME); + + String command = "bin" + File.separator + "server"; + String[] parms = new String[2]; + parms[0] = "start"; + parms[1] = SERVER_NAME; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + initialize(); + + Writer isw = new OutputStreamWriter(new FileOutputStream(jvmoptionsconfigdefaults), "UTF-8"); + BufferedWriter bw = new BufferedWriter(isw); + bw.write("-DTest=Bad Value\n"); + bw.write("-DTest2=Bad Value\n"); + bw.write("-DTest3=Good Value\n"); + bw.write("-Xmx512m\n"); + bw.close(); + Writer isw2 = new OutputStreamWriter(new FileOutputStream(jvmoptionsserverroot), "UTF-8"); + BufferedWriter bw2 = new BufferedWriter(isw2); + bw2.write("-DTest=Good Value\n"); + bw2.write("-DTest4=Bad Value\n"); + bw2.write("-DTest5=Good Value\n"); + bw2.write("-Xmx1024m\n"); + bw2.close(); + Writer isw3 = new OutputStreamWriter(new FileOutputStream(jvmoptionsconfigoverrides), "UTF-8"); + BufferedWriter bw3 = new BufferedWriter(isw3); + bw3.write("-DTest2=Good Value\n"); + bw3.write("-DTest4=Good Value\n"); + bw3.write("-DTest6=Good Value\n"); + bw3.write("-XX:MaxPermSize=512m"); + bw3.close(); + Writer isw4 = new OutputStreamWriter(new FileOutputStream(sharedjvmoptions), "UTF-8"); + BufferedWriter bw4 = new BufferedWriter(isw4); + bw4.write("-DTest2=Bad Value\n"); + bw4.write("-DTest7=Good Value\n"); + bw4.close(); + Writer isw5 = new OutputStreamWriter(new FileOutputStream(etcjvmoptions), "UTF-8"); + BufferedWriter bw5 = new BufferedWriter(isw5); + bw5.write("-DTest8=Bad Value\n"); + bw5.close(); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "server start stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "server start stderr = " + po.getStderr()); + server.waitForStringInLog("CWWKF0011I"); + server.resetStarted(); + + server.serverDump(); + File[] filesAfterDump = new File(executionDir + File.separator + "usr" + File.separator + "servers" + File.separator + SERVER_NAME).listFiles(); + + File dumpFile = new File(""); + for (File f : filesAfterDump) { + String fileName = f.getName(); + Log.info(c, METHOD_NAME, "Found file: " + fileName); + if (fileName.startsWith(SERVER_NAME + ".dump") && fileName.endsWith(".zip")) { + dumpFile = f; + break; + } + } + + if (dumpFile.getPath().compareTo("") == 0) { + fail("The Dump File was not found"); + } + + ZipFile zipFile = new ZipFile(dumpFile); + + boolean[] foundTest = new boolean[8]; + for (int i = 0; i < 8; i++) { + foundTest[i] = false; + } + for (Enumeration en = zipFile.entries(); en.hasMoreElements();) { + ZipEntry entry = en.nextElement(); + String entryName = entry.getName(); + if (entryName.endsWith("JavaHeapInfo.txt")) { + InputStream inputstream = zipFile.getInputStream(entry); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream)); + String line; + int i = 0; + while ((line = reader.readLine()) != null) { + if (line.contains("MaxHeapSizeLimit")) { + String num[] = line.split(":"); + int heapsize = Integer.parseInt(num[1].substring(1)); + assertTrue("JVM Option " + i + " wasn't found", (heapsize == 1073741824)); + } + } + } + if (entryName.endsWith("JavaRuntimeInformation.txt")) { + boolean afterSysProps = false; + InputStream inputstream = zipFile.getInputStream(entry); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream)); + String line; + int i = 0; + while ((line = reader.readLine()) != null) { + Log.info(c, "testJVMOptionsMergingAllOptions", "Run" + i + ": " + line); + if (line.contains("Java System Properties")) { + afterSysProps = true; + } + if (line.contains("-XX:MaxPermSize=512m")) { + foundTest[0] = true; + } + if (afterSysProps) { + if (line.contains("Test3=Good")) { + foundTest[1] = true; + } else if (line.contains("Test=Good Value")) { + foundTest[2] = true; + } else if (line.contains("Test5=Good Value")) { + foundTest[3] = true; + } else if (line.contains("Test2=Good Value")) { + foundTest[4] = true; + } else if (line.contains("Test4=Good Value")) { + foundTest[5] = true; + } else if (line.contains("Test6=Good Value")) { + foundTest[6] = true; + } else if (line.contains("Test7=Good Value")) { + foundTest[7] = true; + } else if (line.contains("Test=Bad Value")) { + fail("Contains Option 'Test=Bad Value' that it shouldn't"); + } else if (line.contains("Test2=Bad Value")) { + fail("Contains Option 'Test2=Bad Value' that it shouldn't"); + } else if (line.contains("Test4=Bad Value")) { + fail("Contains Option 'Test4=Bad Value' that it shouldn't"); + } else if (line.contains("Test2=Bad Value")) { + fail("Contains Option 'Test2=Bad Value' that it shouldn't"); + } else if (line.contains("Test8=Bad Value")) { + fail("Contains Option 'Test8=Bad Value' that it shouldn't"); + } + } + i++; + } + reader.close(); + inputstream.close(); + } + } + + zipFile.close(); + for (int i = 0; i < 8; i++) { + assertTrue("JVM Option " + i + " wasn't found", foundTest[i]); + } + + server.stopServer(); + } + + public void initialize() { + dirs.mkdirs(); + dirs2.mkdirs(); + if (jvmoptionsconfigdefaults.exists()) { + jvmoptionsconfigdefaults.delete(); + } + if (jvmoptionsserverroot.exists()) { + jvmoptionsserverroot.delete(); + } + if (jvmoptionsconfigoverrides.exists()) { + jvmoptionsconfigoverrides.delete(); + } + if (sharedjvmoptions.exists()) { + sharedjvmoptions.delete(); + } + if (etcjvmoptions.exists()) { + etcjvmoptions.delete(); + } + if (bootstrapPropFile.exists()) { + bootstrapPropFile.delete(); + } + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartTest.java new file mode 100755 index 00000000000..7f1e4ea87a9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ServerStartTest.java @@ -0,0 +1,153 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Properties; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This test bucket tests the server startup process. + */ +public class ServerStartTest { + private static final Class c = ServerStartTest.class; + + private static final String SERVER_NAME = "com.ibm.ws.kernel.boot.serverstart.fat"; + private static final String SYMLINK_NAME = "com.ibm.ws.kernel.boot.serverstart.fat.symlink"; + + private static LibertyServer server; + + @Rule + public TestName testName = new TestName(); + + @Before + public void before() { + server = LibertyServerFactory.getLibertyServer(SERVER_NAME); + } + + @After + public void after() throws Exception { + server.stopServer(); + } + + @Test + /** + * This test validates that the server start script functions correctly when the CDPATH environment variable + * is present. + * + * @throws Exception + */ + public void testServerStartWithCDPATH() throws Exception { + final String METHOD_NAME = "testServerStartWithCDPATH"; + Log.entering(c, METHOD_NAME); + + // issuing the command from the Liberty install root while supplying the bin directory as + // part of the command itself causes the server script to cd to the bin directory, which + // is where we noticed problems when CDPATH is set + String executionDir = server.getInstallRoot(); + String command = "bin" + File.separator + "server"; + + String[] parms = new String[2]; + parms[0] = "start"; + parms[1] = SERVER_NAME; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "server start stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "server start stderr = " + po.getStderr()); + + server.waitForStringInLog("CWWKF0011I"); + + // because we didn't start the server using the LibertyServer APIs, we need to have it detect + // its started state so it will stop and save logs properly + server.resetStarted(); + + assertTrue("the server should have been started", server.isStarted()); + + Log.exiting(c, METHOD_NAME); + } + + @Test + /** + * This test validates that the server start functions correctly when the server is referenced + * via a symbolic link (on those systems which support same) + * + * @throws Exception + */ + public void testServerStartViaSymbolicLink() throws Exception + { + String linkCommand = "/bin/ln"; + + // only try this test if the unix ln command exists and can be executed + File ln = new File(linkCommand); + if (ln.exists() && ln.canExecute()) { + // Copy the server directory elsewhere + String originalPath = server.getServerRoot(); + String relocatedPath = server.getServerRoot() + "/../../" + server.getServerName(); + String copyCommand = "cp"; + String[] copyParms = new String[] { "-r", originalPath, relocatedPath }; // Make sure -r works on all these platforms... + ProgramOutput po = server.getMachine().execute(copyCommand, copyParms); + + // Set up the symlink + String symPath = server.getServerRoot() + "/../" + SYMLINK_NAME; + String unlinkCommand = "rm"; + String[] unlinkParms = new String[] { symPath }; + po = server.getMachine().execute(unlinkCommand, unlinkParms); + + String[] linkParms = new String[] { "-s", relocatedPath, symPath }; // Symbolic link relocated copy as + po = server.getMachine().execute(linkCommand, linkParms); + + // Get a handle to the alias.Note that this must use a new entry point to get a handle to an already configured server. + LibertyServer symlink_server = LibertyServerFactory.getExistingLibertyServer(SYMLINK_NAME); + + // Confirm it can start and stop + server.stopServer(); // Pause the original + symlink_server.startServer(); // Start the alias (and confirm) + symlink_server.stopServer(); // stop the alias (and confirm) + server.startServer(); // Resume original (in case following test needs it). + } + + } + + @Test + /** + * This test ensures that the servers starts without error when using the -Xfuture command line + * argument. This argument enforces strict class file verification. One customer ran into + * BundleExceptions due to empty package-info.class files (defect 177872). + */ + public void testServerStartWithDashXFutureCmdArg() throws Exception { + server.copyFileToTempDir("server.xml", "origServer.xml"); + try { + server.setServerConfigurationFile("Xfuture/server.xml"); + server.copyFileToLibertyServerRoot("Xfuture/jvm.options"); + + server.startServer(); + } finally { + server.deleteDirectoryFromLibertyServerRoot("jvm.options"); + server.setServerConfigurationFile("tmp/origServer.xml"); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ShutdownTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ShutdownTest.java new file mode 100755 index 00000000000..3d8e6c97941 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/ShutdownTest.java @@ -0,0 +1,101 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ShutdownTest { + private static final Class c = ShutdownTest.class; + + @Rule + public final TestName testName = new TestName(); + + LibertyServer server; + + @Before + public void before() { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.shutdown.fat"); + } + + @After + public void after() throws Exception { + // We stop the server by other means, so wait for that stop to finish, + // and then call stopServer to save logs, reset log offsets, etc. + server.waitForStringInLog("CWWKE0036I"); + server.stopServer(); + } + + private void runTest(String exitMethodName) throws Exception { + final String m = testName.getMethodName(); + Log.entering(c, m); + try { + server.startServer(m + ".log"); + + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/shutdownfat?exit=" + exitMethodName); + try { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + Log.info(c, m, "HTTP response: " + con.getResponseCode()); + + InputStream in = con.getInputStream(); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + + for (String line; (line = reader.readLine()) != null;) { + Log.info(c, m, "Output: " + line); + } + } finally { + try { + in.close(); + } catch (IOException e) { + Log.error(c, m, e); + } + } + } catch (Throwable t) { + // The server might die before the response can be written. + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw)); + Log.info(ShutdownTest.class, "testSystemExit", "Ignoring " + sw.toString()); + } + + server.waitForStringInLog("CWWKE0084I:.*" + exitMethodName); + } finally { + Log.exiting(c, m); + } + } + + @Test + public void testSystemExit() throws Exception { + runTest("System.exit"); + } + + @Test + public void testRuntimeExit() throws Exception { + runTest("Runtime.exit"); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/CreateCommandTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/CreateCommandTest.java new file mode 100755 index 00000000000..b9b3b1c02cb --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/CreateCommandTest.java @@ -0,0 +1,78 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.commandline; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import componenttest.common.apiservices.Bootstrap; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.utils.LibertyServerUtils; + +/** + * + */ +public class CreateCommandTest { + + private final static double javaLevel = Double.parseDouble(System.getProperty("java.specification.version")); + + private final static String serverName = "com.ibm.ws.kernel.boot.commandline.CreateCommandTest"; + private static Bootstrap bootstrap; + private static Machine machine; + private static String installPath;; + private static String defaultServerPath;; + + @BeforeClass + public static void setup() throws Exception { + bootstrap = Bootstrap.getInstance(); + machine = LibertyServerUtils.createMachine(bootstrap); + installPath = LibertyFileManager.getInstallPath(bootstrap); + defaultServerPath = installPath + "/usr/servers/" + serverName; + } + + @Before + public void cleanupBeforeRun() throws Exception { + // since we are not using the normal LibertyServer class for this server, + // we need to make sure to explicitly clean up. We do this before running + // the test in order to preserve the contents on disk. + if (LibertyFileManager.libertyFileExists(machine, defaultServerPath)) { + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, defaultServerPath); + } + } + + @Test + public void testIsServerEnvCreated() throws Exception { + + ProgramOutput po = LibertyServerUtils.executeLibertyCmd(bootstrap, "server", "create", serverName); + assertEquals("Unexpected return code from server create command", 0, po.getReturnCode()); + + // check that server directory was created + assertTrue("Expected server directory to exist at " + defaultServerPath + ", but does not", LibertyFileManager.libertyFileExists(machine, defaultServerPath)); + + // check that server.xml exists + String serverXmlPath = defaultServerPath + "/server.xml"; + assertTrue("Expected server.xml file to exist at " + serverXmlPath + ", but does not", LibertyFileManager.libertyFileExists(machine, serverXmlPath)); + + // if we are running in a JVM that is version 1.8 or higher, we also need to check for the server.env file + if (javaLevel >= 1.8) { + String serverEnvPath = defaultServerPath + "/server.env"; + assertTrue("Expected server.env file to exist at " + serverEnvPath + ", but does not", LibertyFileManager.libertyFileExists(machine, serverEnvPath)); + } + + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/DumpCommandTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/DumpCommandTest.java new file mode 100755 index 00000000000..c4c15ea5c1f --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/DumpCommandTest.java @@ -0,0 +1,154 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.commandline; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; + +import java.io.File; +import java.util.Properties; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class DumpCommandTest { + private static final Class c = DumpCommandTest.class; + + @Rule + public final TestName testName = new TestName(); + + private static LibertyServer server; + private static File serverRoot; + private static boolean isIBM_JVM = false; + + @BeforeClass + public static void before() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.shutdown.fat"); + Log.info(c, "before", "starting server"); + server.startServer("DumpCommandTest.log"); + serverRoot = new File(server.getServerRoot()); + + String javaHome = server.getMachineJavaJDK(); + Properties env = new Properties(); + env.setProperty("JAVA_HOME", javaHome); + String javaBinDir = javaHome + "/bin"; + ProgramOutput javaVersionOutput = server.getMachine().execute(javaBinDir + "/java", new String[] { "-version" }, javaBinDir, env); + String stdout = javaVersionOutput.getStdout(); + String stderr = javaVersionOutput.getStderr(); + Log.info(c, "before", "java -version stdout: " + stdout); + Log.info(c, "before", "java -version stderr: " + stderr); + assertEquals("Unexpected return code from java -version", 0, javaVersionOutput.getReturnCode()); + + if ((stdout != null && stdout.contains("IBM")) || (stderr != null && stderr.contains("IBM"))) { + isIBM_JVM = true; + } + } + + @AfterClass + public static void after() throws Exception { + // We stop the server by other means, but call stopServer in order to + // save logs, reset log offsets, etc. + server.stopServer(); + } + + /** + * Tests the command line tool: server javadump <serverName> + * Test will pass if the command executes successfully and (if using an + * IBM JVM) creates a file, "javacore*.txt", in the server root dir. + * Non-IBM JDKs do not produce javacores - and the javadump command + * does not usually return successfully on these platforms, so this test + * only runs on IBM JDKs. + */ + @Test + public void testJavadump() throws Exception { + assumeTrue(isIBM_JVM); + File[] filesBeforeDump = serverRoot.listFiles(); + Log.info(c, "testJavadump", "javadump"); + ProgramOutput output = server.javadumpThreads(); + assertEquals("Unexpected output code running javadump", 0, output.getReturnCode()); + + assertNotNull("Did not see expected CWWKE0068I in logs", server.waitForStringInLog("CWWKE0068I.*javacore")); + + File[] filesAfterDump = serverRoot.listFiles(); + assertTrue("Did not find expected additional files in serverRoot: " + serverRoot.getAbsolutePath(), + filesBeforeDump.length < filesAfterDump.length); + boolean foundJavacoreFile = false; + for (File f : filesAfterDump) { + String fileName = f.getName(); + Log.info(c, "testJavadump", "Found file: " + fileName); + if (fileName.startsWith("javacore") && fileName.endsWith(".txt")) { + foundJavacoreFile = true; + break; + } + } + assertTrue("Expected javacore*.txt file not found in serverRoot: " + serverRoot.getAbsolutePath(), foundJavacoreFile); + + Log.info(c, "testJavadump", "exit success"); + } + + /** + * Tests the command line tool: server dump <serverName> --include=heap,system,thread + * Test will pass if the command executes successfully and creates a file, + * "dump.<serverName>.dump*.zip", in the server root dir. Non-IBM JDKs do not produce + * artifacts like javacores, heap dumps, system cores in the same way as IBM JDKs - and the + * dump command does not usually return successfully on these platforms, so this test + * only runs on IBM JDKs. + */ + @Test + public void testDump() throws Exception { + assumeTrue(isIBM_JVM); + File[] filesBeforeDump = serverRoot.listFiles(); + Log.info(c, "testDump", "dump"); + ProgramOutput output = server.serverDump("heap,system,thread"); + + assertEquals("Unexpected output code running dump", 0, output.getReturnCode()); + + assertNotNull("Did not find expected CWWKE0068I message for heap dump in logs", server.waitForStringInLog("CWWKE0068I.*phd")); //heap dump + if (server.getMachine().getOperatingSystem() == OperatingSystem.ZOS) { + assertNotNull("Did not find expected CWWKE0092I message for java system dump on zos in logs", server.waitForStringInLog("CWWKE0092I")); + } else { + assertNotNull("Did not find expected CWWKE0068I message for system core in logs", server.waitForStringInLog("CWWKE0068I.*dmp")); //system core + } + assertNotNull("Did not find expected CWWKE0068I message for javacore in logs", server.waitForStringInLog("CWWKE0068I.*javacore")); //javacore + + File[] filesAfterDump = serverRoot.listFiles(); + assertTrue("Did not find expected additional files in serverRoot: " + serverRoot.getAbsolutePath(), + filesBeforeDump.length < filesAfterDump.length); + String serverName = server.getServerName(); + boolean foundDumpZip = false; + for (File f : filesAfterDump) { + String fileName = f.getName(); + Log.info(c, "testDump", "Found file: " + fileName); + if (fileName.startsWith(serverName + ".dump") && fileName.endsWith(".zip")) { + foundDumpZip = true; + break; + } + } + assertTrue("Expected .dump*.zip file not found in serverRoot: " + serverRoot.getAbsolutePath(), foundDumpZip); + + Log.info(c, "testDump", "exit success"); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/PauseResumeCommandTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/PauseResumeCommandTest.java new file mode 100644 index 00000000000..91b4572bc10 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/PauseResumeCommandTest.java @@ -0,0 +1,158 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.commandline; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class PauseResumeCommandTest { + + private static final Class c = PauseResumeCommandTest.class; + + private static final String PAUSE_RESUME_SERVER_NAME = "com.ibm.ws.kernel.boot.pause.resume.fat"; + + private static final LibertyServer pauseResumeServer = LibertyServerFactory.getLibertyServer(PAUSE_RESUME_SERVER_NAME); + + @Before + public void setup() throws Exception { + pauseResumeServer.startServer(); + } + + @After + public void teardown() throws Exception { + pauseResumeServer.stopServer("CWWKE093*"); + } + + /** + * Tests the case where the "server pause" command is issued and no + * pauseable components exist + * + * @throws Exception + */ + @Test + public void testPauseNoPauseableComponents() throws Exception { + final String METHOD_NAME = "testPauseNoPauseableComponents"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("pause", null).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0933W", 10000)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the case where the "server resume" command is issued and no + * pauseable components exist + * + * @throws Exception + */ + @Test + public void testResumeNoPauseableComponents() throws Exception { + final String METHOD_NAME = "testResumeNoPauseableComponents"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("resume", null).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0934W", 10000)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the case where the "server pause" command is issued with an empty target list. + * + * @throws Exception + */ + @Test + public void testPauseEmptyTargetList() throws Exception { + final String METHOD_NAME = "testPauseEmptyTargetList"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("pause", new String[] { "--target=" }).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0931W", 10000)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the case where the "server resume" command is issued with an empty target list. + * + * @throws Exception + */ + @Test + public void testResumeEmptyTargetList() throws Exception { + final String METHOD_NAME = "testResumeEmptyTargetList"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("resume", new String[] { "--target=" }).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0932W", 10000)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the case where the "server resume" command is issued with an invalid target. + * + * @throws Exception + */ + @Test + public void testPauseInvalidTarget() throws Exception { + final String METHOD_NAME = "testPauseInvalidTarget"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("pause", new String[] { "--target=InvalidTarget" }).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0935W", + 10000)); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the case where the "server resume" command is issued with an empty target list. + * + * @throws Exception + */ + @Test + public void testResumeInvalidTarget() throws Exception { + final String METHOD_NAME = "testResumeInvalidTarget"; + Log.entering(c, METHOD_NAME); + + String output = pauseResumeServer.executeServerScript("resume", new String[] { "--target=InvalidTarget" }).getStdout(); + + assertTrue(output.contains("failed")); + assertNotNull(pauseResumeServer.waitForStringInLog("CWWKE0936W", + 10000)); + + Log.exiting(c, METHOD_NAME); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/StartCommandTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/StartCommandTest.java new file mode 100755 index 00000000000..5875ce63537 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandline/StartCommandTest.java @@ -0,0 +1,90 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.commandline; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import componenttest.common.apiservices.Bootstrap; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.utils.LibertyServerUtils; + +/** + * + */ +public class StartCommandTest { + + private final static double javaLevel = Double.parseDouble(System.getProperty("java.specification.version")); + + private final static String defaultServerName = "defaultServer"; + private static Bootstrap bootstrap; + private static Machine machine; + private static String installPath; + private static String defaultServerPath; + + @BeforeClass + public static void setup() throws Exception { + bootstrap = Bootstrap.getInstance(); + machine = LibertyServerUtils.createMachine(bootstrap); + installPath = LibertyFileManager.getInstallPath(bootstrap); + defaultServerPath = installPath + "/usr/servers/" + defaultServerName; + } + + @Before + public void cleanupBeforeRun() throws Exception { + // since we are not using the normal LibertyServer class for this server, + // we need to make sure to explicitly clean up. We do this before running + // the test in order to preserve the contents on disk. + + if (LibertyFileManager.libertyFileExists(machine, defaultServerPath)) { + LibertyFileManager.deleteLibertyDirectoryAndContents(machine, defaultServerPath); + } + } + + /** + * Tests the case where the "server run" command is issued and defaultServer + * does not exist. In this case, defaultServer is created on the fly. + * + * @throws Exception + */ + @Test + public void testIsServerEnvCreatedForImplicitServerCreate() throws Exception { + + ProgramOutput po = LibertyServerUtils.executeLibertyCmd(bootstrap, "server", "start"); + assertEquals("Unexpected return code from server start command", 0, po.getReturnCode()); + + try { + // check that server directory was created + assertTrue("Expected server directory to exist at " + defaultServerPath + ", but does not", LibertyFileManager.libertyFileExists(machine, defaultServerPath)); + + // check that server.xml exists + String serverXmlPath = defaultServerPath + "/server.xml"; + assertTrue("Expected server.xml file to exist at " + serverXmlPath + ", but does not", LibertyFileManager.libertyFileExists(machine, serverXmlPath)); + + // if we are running in a JVM that is version 1.8 or higher, we also need to check for the server.env file + if (javaLevel >= 1.8) { + String serverEnvPath = defaultServerPath + "/server.env"; + assertTrue("Expected server.env file to exist at " + serverEnvPath + ", but does not", LibertyFileManager.libertyFileExists(machine, serverEnvPath)); + } + } finally { + po = LibertyServerUtils.executeLibertyCmd(bootstrap, "server", "stop"); + assertEquals("Unexpected return code from server stop command", 0, po.getReturnCode()); + } + + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandport/ServerCommandPortTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandport/ServerCommandPortTest.java new file mode 100755 index 00000000000..45d791dcc4d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/commandport/ServerCommandPortTest.java @@ -0,0 +1,243 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.commandport; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.InputStreamReader; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +/** + * This test bucket validates the functionality of the server command port, the port that is used by the server script + * to communicate with a running server, if required. + */ +public class ServerCommandPortTest { + private static final String COMMAND_PORT_DISABLED_SERVER_NAME = "com.ibm.ws.kernel.boot.commandport.disabled.fat"; + private static final String COMMAND_PORT_ENABLED_SERVER_NAME = "com.ibm.ws.kernel.boot.commandport.enabled.fat"; + + private static final LibertyServer commandPortDisabledServer = LibertyServerFactory.getLibertyServer(COMMAND_PORT_DISABLED_SERVER_NAME); + private static final LibertyServer commandPortEnabledServer = LibertyServerFactory.getLibertyServer(COMMAND_PORT_ENABLED_SERVER_NAME); + + private static final boolean isMac = System.getProperty("os.name", "unknown").toLowerCase().indexOf("mac os") >= 0; + + @Rule + public TestName testName = new TestName(); + + @Test + /** + * This test validates the functionality of a server with the command port disabled. The server script has + * only limited ability to administer a server with the command port disabled. + * + * @throws Exception + */ + public void testServerCommandPortDisabled() throws Exception { + LibertyServer server = commandPortDisabledServer; + + // server should start, but with a warning message that we can't actually tell if it completed starting + // because the command port is disabled + // + // NOTE: don't use "server.startServer()" because this causes the LibertyServer to remember that it is + // started and it will try to stop it during test cleanup, failing due to command port disablement + String output = server.executeServerScript("start", null).getStdout(); + + try { + // there are two messages for starting a server, one that contains a process ID and one that does not; + // either message indicates success of the start command for this purpose + assertTrue(output.contains("CWWKE0088W") || output.contains("CWWKE0087W")); + server.waitForStringInLog("CWWKF0011I"); + + // save the PID to validate the server status command - note that on Windows, the PID is not returned + // as part of the start message, so we can't always perform this verification + int serverPid = getServerPid(output); + + // server status should work as usual, since the command port is not needed for it + output = server.executeServerScript("status", null).getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " is running")); + + if (serverPid > 0) { + assertTrue(output.contains("with process ID " + serverPid)); + } + + // ensure that the command port in the .sCommand file is -1 + assertEquals(-1, getCommandPort(server)); + + // generating a java dump should produce an error saying that the dump can't be taken due to command + // port disablement + output = server.executeServerScript("javadump", null).getStdout(); + assertTrue(output.contains("CWWKE0091E")); + + // generating a server dump should produce a warning saying that the dump was taken, but that some + // information is missing + output = server.executeServerScript("dump", null).getStdout(); + assertTrue(output.contains("CWWKE0090W")); + validateDumpFile(output, server, COMMAND_PORT_DISABLED_SERVER_NAME); + + // stopping the server should produce an error + output = server.executeServerScript("stop", null).getStdout(); + assertTrue(output.contains("CWWKE0089E")); + } finally { + Log.info(ServerCommandPortTest.class, "testServerCommandPortDisabled", + "Stop the server via a servlet since the command port is disabled."); + try { + // make sure the shutdown app is available before using it to shutdown the server + server.validateAppLoaded("shutdownfat"); + + HttpUtils.findStringInUrl(server, "/shutdownfat", "exit="); + } catch (Throwable t) { + Log.error(ServerCommandPortTest.class, "testServerCommandPortDisabled", t); + } + server.waitForStringInLog("CWWKE0036I"); + + // make sure logs are collected (not stopping the normal way...no command port) + server.postStopServerArchive(); + } + } + + @Test + /** + * This test validates the functionality of a server with the command port enabled. + * + * @throws Exception + */ + public void testServerCommandPortEnabled() throws Exception { + LibertyServer server = commandPortEnabledServer; + + String output = server.startServer().getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " started")); + + // save the PID to validate the server status command - note that on Windows, the PID is not returned + // as part of the start message, so we can't always perform this verification + int serverPid = getServerPid(output); + + // validate server status command + output = server.executeServerScript("status", null).getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " is running")); + + if (serverPid > 0) { + assertTrue(output.contains("with process ID " + serverPid)); + } + + // ensure that the command port in the .sCommand file is greater than 0 + assertTrue(getCommandPort(server) > 0); + + // validate server javadump command on all platforms except mac, because javadump + // is unreliable on hotspot jvms + if (!isMac) { + output = server.executeServerScript("javadump", null).getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " dump complete in")); + validateDumpFile(output, server, COMMAND_PORT_ENABLED_SERVER_NAME); + } + + // validate server dump command + output = server.executeServerScript("dump", null).getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " dump complete in")); + validateDumpFile(output, server, COMMAND_PORT_ENABLED_SERVER_NAME); + + // validate server stop command + output = server.stopServer().getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " stopped.")); + + // make sure server really stopped + output = server.executeServerScript("status", null).getStdout(); + assertTrue(output.contains("Server " + server.getServerName() + " is not running.")); + } + + /** + * Validates the existence of a dump file. The dump file name is parsed from the input parameter, + * which is the output of the server script command that requested the dump. + * + * @param outputMessage the output of the server script command that requested the dump + */ + private void validateDumpFile(String outputMessage, LibertyServer server, final String serverName) throws Exception { + String dumpFileName = null; + + // The format of the dump complete message is: + // Server dump complete in . + // The filename comes after "in" and has a period attached. + boolean foundServerName = false; + String[] words = outputMessage.split("\\s+"); + for (int i = 0; i < words.length; i++) { + // we are checking for the message header here to avoid a Mac JDK bug + // that prints a message that includes the word "in" but then causes a + // StringIndexOutOfBoundsException below. This check could be removed + // when the Mac bug is fixed, but it doesn't hurt to leave it in. + // See defects 124026 and 123011 for more details. + if (i > 0 && words[i - 1].equals("Server") && words[i].equals(serverName)) { + foundServerName = true; + } else if (words[i].equals("in") && foundServerName && i < (words.length - 1)) { + dumpFileName = words[i + 1]; + + int serverRootLength = server.getServerRoot().length(); + int periodIndex = dumpFileName.length() - 1; + + // strip the server root off the front and the period off the end + dumpFileName = dumpFileName.substring(serverRootLength, periodIndex); + break; + } + } + + // verify that the server dump file exists and that *something* is inside it + RemoteFile dumpFile = server.getFileFromLibertyServerRoot(dumpFileName); + assertTrue(dumpFile.exists()); + assertTrue(dumpFile.length() > 0); + } + + /** + * Parses and returns the server PID from the output of the server start command. + * + * @param outputMessage the output of the server start command + * @return the server's PID, or -1 if the PID cannot be parsed from the command output + */ + private int getServerPid(String outputMessage) throws Exception { + // The format of the server started message is: + // Server started with process ID . + // The PID comes after "ID" and has a period or comma attached. + String[] words = outputMessage.split("\\s+"); + for (int i = 0; i < words.length; i++) { + if (words[i].equals("ID")) { + String pidString = words[i + 1]; + pidString = pidString.substring(0, pidString.length() - 2); // strip trailing period + return Integer.parseInt(pidString); + } + } + return -1; + } + + /** + * Gets the current command port for the specified server. Note that this is + * NOT something that is visible to the customer. This is a test of our own + * internals added as a secondary verification that command port enablement + * and disablement works. + * + * @param server the server to get the command port for + * @return the server's command port + */ + private int getCommandPort(LibertyServer server) throws Exception { + RemoteFile commandFile = server.getFileFromLibertyServerRoot("workarea/.sCommand"); + BufferedReader reader = new BufferedReader(new InputStreamReader(commandFile.openForReading())); + String line = reader.readLine(); + reader.close(); + return Integer.parseInt(line.split(":")[1]); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/LogLevelPropertyTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/LogLevelPropertyTest.java new file mode 100755 index 00000000000..71982771499 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/LogLevelPropertyTest.java @@ -0,0 +1,122 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.commands; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.util.Locale; +import java.util.Map; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class LogLevelPropertyTest { + + private static LibertyServer server; + private static boolean isMac; + private static boolean isZos; + + @BeforeClass + public static void before() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.bootstrap.output.fat"); + + String osName = System.getProperty("os.name", "unknown").toLowerCase(Locale.ROOT); + + Map options = server.getJvmOptionsAsMap(); + String maxPermSize = "-XX:MaxPermSize"; + if (options.containsKey(maxPermSize)) { + options.remove(maxPermSize); + } + + // Temporary debug for 130858. + isZos = osName.contains("z/os"); + if (isZos) { + String option = "-Xtrace:output=shared_classes.trc,maximal={j9shr}"; + Log.info(LogLevelPropertyTest.class, "before", "Adding " + option + " for z/OS"); + options.put(option, null); + + } + + server.setJvmOptions(options); + + server.startServer(); + + isMac = osName.indexOf("mac os") >= 0; + } + + @Test + public void testLogLevelPropertyDisabled() throws Exception { + try { + if (isMac) { + // There might (with Java7 on some versions of the OS) be garbage in console.log that is + // printed by the JVM (we have no control over it). It looks something like this: + // objc[25086]: Class JavaLaunchHelper is implemented in both /.../jre/bin/java and /.../jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. + // only test for the empty console log if that message isn't present + if (server.waitForStringInLog("objc.*", 0, server.getConsoleLogFile()) == null) { + assertEquals("Console log file was not empty.", 0, server.getConsoleLogFile().length()); + } + } else if (server.isJavaVersion8() && server.isOracleJVM()) { + // On Oracle JDK 8, the JVM will complain about the MaxPermSize option + if (server.waitForStringInLog(".*support was removed in 8.0", 0, server.getConsoleLogFile()) == null) { + assertEquals("Console log file was not empty.", 0, server.getConsoleLogFile().length()); + } + } else { + assertEquals("Console log file was not empty.", 0, server.getConsoleLogFile().length()); + } + } finally { + // Temporary debug for 130858. + if (isZos) { + final Class c = LogLevelPropertyTest.class; + final String m = "testLogLevelPropertyDisabled"; + + Machine machine = server.getMachine(); + ProgramOutput output = machine.execute("ls", + new String[] { + "-l", + new File(server.getUserDir(), "servers/.classCache").getAbsolutePath(), + new File(server.getUserDir(), "servers/.classCache/javasharedresources").getAbsolutePath() }); + Log.info(c, m, "ls -l diagnostic return code: " + output.getReturnCode()); + Log.info(c, m, "ls -l diagnostic stdout: " + output.getStdout()); + Log.info(c, m, "ls -l diagnostic stderr: " + output.getStderr()); + + output = machine.execute("ipcs"); + Log.info(c, m, "icps diagnostic return code: " + output.getReturnCode()); + Log.info(c, m, "icps diagnostic stdout: " + output.getStdout()); + Log.info(c, m, "icps diagnostic stderr: " + output.getStderr()); + + output = machine.execute(new File(server.getMachineJavaJDK(), "../bin/jar").getAbsolutePath(), + new String[] { + "cfM", + // Weird extension to avoid filtering. + new File(server.getServerRoot(), "scControlFiles.zip.diag").getAbsolutePath(), + new File(server.getUserDir(), "servers/.classCache").getAbsolutePath() + }); + Log.info(c, m, "jar cf diagnostic return code: " + output.getReturnCode()); + Log.info(c, m, "jar cf diagnostic stdout: " + output.getStdout()); + Log.info(c, m, "jar cf diagnostic stderr: " + output.getStderr()); + } + } + } + + @AfterClass + public static void after() throws Exception { + server.stopServer(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/PackageCommandTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/PackageCommandTest.java new file mode 100755 index 00000000000..077146d6e79 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/boot/internal/commands/PackageCommandTest.java @@ -0,0 +1,171 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.commands; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; + +import java.io.FileNotFoundException; +import java.util.Enumeration; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.jar.Manifest; + +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class PackageCommandTest { + + /** + * The package command requires that the lib/extract directory exists, as this directory + * contains a required manifest, self extractable classes, etc. If this directory does + * not exist, then the command should print this message: + *
+ * CWWKE0922E: The package command cannot complete because the installation is missing the lib/extract directory. + *
+ * This test verifies that this error message is printed. + *
+ * Note: This test assumes that the lib/extract directory is already missing. As of today, the + * FAT environment's installation of WLP does not include this directory. If we end up creating that + * directory in the FAT environment, then we'll need to find another way to run this test - as we + * probably don't want to delete a directory in the FAT environment's installation. + * + * @throws Exception + */ + @Test + public void testCorrectErrorMessageWhenLibExtractDirIsMissing() throws Exception { + // Pick any server, doesn't matter. + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.bootstrap.fat"); + // Only run the test if the lib/extract directory does not exist + try { + server.getFileFromLibertyInstallRoot("lib/extract"); + assumeTrue(false); // the directory exists, so we skip this test. + } catch (FileNotFoundException ex) { + //expected - the directory does not exist - so proceed. + } + + String stdout = server.executeServerScript("package", new String[] { "--include=minify" }).getStdout(); + + assertTrue("Did not find expected failure message, CWWKE0922E", stdout.contains("CWWKE0922E")); + } + + /** + * Packages --include=minify,runnable jar and verifies correct content. + * This test is not run if: + * 1) platform is z/OS (jar archive not supported) + * 2) wlp/lib/extract directory does not exist + * + * @throws Exception + */ + @Test + public void testCreateRunnableJar() throws Exception { + // Pick any server, doesn't matter. + String serverName = "com.ibm.ws.kernel.bootstrap.fat"; + String jarFileName = serverName + ".jar"; + String mainClass = "wlp.lib.extract.SelfExtractRun"; + + // Doesn't work on z/OS (because you can't package into a jar on z/OS) + assumeTrue(!System.getProperty("os.name").equals("z/OS")); + + LibertyServer server = LibertyServerFactory.getLibertyServer(serverName); + + // Only run the test if the lib/extract directory exists + try { + server.getFileFromLibertyInstallRoot("lib/extract"); + + String stdout = server.executeServerScript("package", new String[] { "--archive=" + jarFileName, "--include=runnable" }).getStdout(); + + assertTrue("Could not package server " + serverName, stdout.contains("Server " + serverName + " package complete")); + + JarFile jarFile = new JarFile(server.getFileFromLibertyServerRoot(jarFileName).getAbsolutePath()); + + // Check the manifest for headers that should be in there. + Manifest mf = jarFile.getManifest(); + assertNotNull("There should be a manifest in the jar file", mf); + + // make sure it'a a runnable jar + assertEquals(mainClass, mf.getMainAttributes().getValue("Main-Class")); + + // Check that the self-extract and the server's entries are in the jar + Enumeration entries = jarFile.entries(); + assertTrue(entries.hasMoreElements()); + + boolean foundSelfExtractRun = false; + while (entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + foundSelfExtractRun |= entry.getName().startsWith("wlp/lib/extract/SelfExtractRun.class"); + } + + assertTrue(foundSelfExtractRun); + + } catch (FileNotFoundException ex) { + assumeTrue(false); // the directory does not exist, so we skip this test. + } + } + + /** + * Make sure that when packaging a jar archive using --include=usr, + * the resulting jar files does NOT contain the self-extract files. + */ + @Test + public void testPackageJarArchiveWithIncludeEqualsUsr() throws Exception { + + // NOTE: This test won't work cuz the necessary MANIFEST files and + // self-extract files (wlp/lib/extract/*) aren't present in our test environment. + assumeTrue(false); + + // Doesn't work on z/OS (cuz you can't package into a jar on z/OS) + assumeTrue(!System.getProperty("os.name").equals("z/OS")); + + // Pick any server, doesn't matter. + LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.bootstrap.fat"); + + String jarFileName = "package.usr.jar"; + + String stdout = server.executeServerScript("package", + new String[] { "--archive=" + jarFileName, + "--include=usr" }).getStdout(); + + JarFile jarFile = new JarFile(server.getFileFromLibertyServerRoot(jarFileName).getAbsolutePath()); + + // Check the manifest for headers that should be in there. + Manifest mf = jarFile.getManifest(); + assertNotNull("There should be a manifest in the jar file", mf); + + assertTrue(mf.getMainAttributes().containsKey("Applies-To")); + assertEquals("com.ibm.websphere.appserver", mf.getMainAttributes().getValue("Applies-To")); + assertEquals("false", mf.getMainAttributes().getValue("Extract-Installer")); + + // Check that the self-extract and the server's entries are in the jar + Enumeration entries = jarFile.entries(); + assertTrue(entries.hasMoreElements()); + + boolean foundServerEntry = false; + boolean foundSelfExtractEntry = false; + while (entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + foundServerEntry |= entry.getName().startsWith("wlp/usr/servers/com.ibm.ws.kernel.bootstrap.fat"); + foundSelfExtractEntry |= entry.getName().startsWith("wlp/lib/extract"); + } + + assertTrue(foundServerEntry); + assertTrue(foundSelfExtractEntry); + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/KernelChangeTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/KernelChangeTest.java new file mode 100755 index 00000000000..3d5e1681e01 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/KernelChangeTest.java @@ -0,0 +1,80 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.provisioning; + +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class KernelChangeTest { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.bootstrap.fat"); + + @Rule + public TestName testName = new TestName(); + + @After + public void tearDown() throws Exception { + server.stopServer(); + } + + @Test + public void testKernelChangeRestart() throws Exception { + // Start the server (wait for server started message) + server.startServer("part1.console.log"); + + // Make sure no error messages in console.log + List output = server.findStringsInLogs("ERROR.*", server.getConsoleLogFile()); + assertTrue("We should not see error messages in the log. output=" + output, output.isEmpty()); + + // Stop the server (WARM) + server.stopServer(false); + + // Save logs, switch bootstrap.properties files to enable hpel + server.renameLibertyServerRootFile("logs/messages.log", "logs/part1.messages.log"); + server.renameLibertyServerRootFile("logs/trace.log", "logs/part1.trace.log"); + server.renameLibertyServerRootFile("bootstrap.properties", "bootstrap.properties.orig"); + server.renameLibertyServerRootFile("bootstrap.properties.hpel", "bootstrap.properties"); + + // Start the server with HPEL (WARM) + server.startServer("part2.console.log", false, false); + + // Make sure no error messages in console.log + output = server.findStringsInLogs("ERROR.*", server.getConsoleLogFile()); + assertTrue("We should not see error messages in the log. output=" + output, output.isEmpty()); + + // Stop the server (WARM) + server.stopServer(false); + + // Save logs, switch back to disable hpel again + server.renameLibertyServerRootFile("bootstrap.properties", "bootstrap.properties.hpel"); + server.renameLibertyServerRootFile("bootstrap.properties.orig", "bootstrap.properties"); + + // Start the server WITHOUT HPEL again + server.startServer("part3.console.log", false, false); + + // Make sure no error messages in console.log + output = server.findStringsInLogs("ERROR.*", server.getConsoleLogFile()); + assertTrue("We should not see error messages in the log. output=" + output, output.isEmpty()); + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/ProvisioningTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/ProvisioningTest.java new file mode 100755 index 00000000000..75d8307fbc9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/ws/kernel/provisioning/ProvisioningTest.java @@ -0,0 +1,700 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.provisioning; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ProvisioningTest { + + private static final Class c = ProvisioningTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.provisioning.fat"); + + private static final String BUNDLE_NAME = "ProvisioningTestBundle"; + private static final String INTERIM_FIX_BUNDLE_NAME = "ProvisioningInterimFixesTestBundle"; + private static final String FEATURE_MF = "provisioningTest-1.0.mf"; + private static final String FIX_DATA = "workarea/platform/fix.data"; + private static final String V100 = "1.0.0"; + private static final String V101 = "1.0.1"; + private static final String V102 = "1.0.2"; + private static final String V1099 = "1.0.99"; + private static final String V10100 = "1.0.100"; + private static final String V101APAR1 = "1.0.1.201202020001-APAR0001"; + private static final String V101APAR2 = "1.0.1.201203030001-APAR0002"; + private static final String V101TEST = "1.0.1.201204040001-TestAPAR0001"; + private static final String V102APAR1 = "1.0.2.201201010001-APAR0001"; + + private static final String INTERIM_FIX_FEATURE = "provisioningInterimFixTest-1.0.mf"; + private static final String INTERIM_FIXES_FEATURE = "provisioningInterimFixesTest-1.0.mf"; + + private static String getBundleAndVersionName(String bundleVersion) { + return BUNDLE_NAME + "_" + bundleVersion; + } + + private static String getJarName(String bundleVersion) { + return BUNDLE_NAME + "_" + bundleVersion + ".jar"; + } + + private static String getRegularExpression(String bundleVersion) { + // see com.ibm.ws.kernel.provisioning.Activator.start method. + return "com.ibm.ws.kernel.provisioning.Activator.start bundle name = \\[" + BUNDLE_NAME + "\\], bundle version = \\[" + bundleVersion + "\\]"; + } + + private static void deleteTestBundleJars() throws Exception { + final String METHOD_NAME = "deleteTestBundleJars"; + + List filenames; + filenames = server.listLibertyInstallRoot("lib", BUNDLE_NAME); + Log.info(c, METHOD_NAME, "found " + filenames.size() + " bundle jars to delete."); + for (String filename : filenames) { + server.deleteFileFromLibertyInstallRoot("lib/" + filename); + } + filenames = server.listLibertyInstallRoot("lib", BUNDLE_NAME); + Log.info(c, METHOD_NAME, "found " + filenames.size() + " bundle jars after delete."); + + filenames = server.listLibertyInstallRoot("lib", INTERIM_FIX_BUNDLE_NAME); + Log.info(c, METHOD_NAME, "found " + filenames.size() + " bundle jars to delete."); + for (String filename : filenames) { + server.deleteFileFromLibertyInstallRoot("lib/" + filename); + } + filenames = server.listLibertyInstallRoot("lib", INTERIM_FIX_BUNDLE_NAME); + Log.info(c, METHOD_NAME, "found " + filenames.size() + " bundle jars after delete."); + } + + /* + * Delete any test bundle jars from the server's lib directory. There should be none + * present as they are removed after each test, but just in case there was abnormal + * termination of a test run we check before running the first test. We also add the + * feature that we're testing to the servers feature dir. + */ + @BeforeClass + public static void classSetUp() throws Exception { + final String METHOD_NAME = "classSetUp"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) { + server.stopServer(); + } + deleteTestBundleJars(); + server.copyFileToLibertyInstallRoot("lib/features", FEATURE_MF); + server.copyFileToLibertyInstallRoot("lib/features", INTERIM_FIX_FEATURE); + server.copyFileToLibertyInstallRoot("lib/features", INTERIM_FIXES_FEATURE); + server.saveServerConfiguration(); + + Log.exiting(c, METHOD_NAME); + } + + /* + * The test feature manifest file is copied into the server's lib/features directory by + * the test framework. After each test method we remove the corresponding bundle jar + * files, so the next test can install the bundle jars it needs without those from + * previous test methods interfering. This method deletes the feature manifest file after + * the last test so the final state of the server is that both the test feature manifest + * and the test bundle jars are removed (i.e. no artifacts from this test class remain in + * the server). + */ + @AfterClass + public static void classTearDown() throws Exception { + final String METHOD_NAME = "classTearDown"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) { + server.stopServer(); + } + if (server.fileExistsInLibertyInstallRoot("lib/features/" + FEATURE_MF)) { + Log.info(c, METHOD_NAME, "lib/features/" + FEATURE_MF + " will be deleted."); + server.deleteFileFromLibertyInstallRoot("lib/features/" + FEATURE_MF); + } + + if (server.fileExistsInLibertyInstallRoot("lib/features/" + INTERIM_FIX_FEATURE)) { + Log.info(c, METHOD_NAME, "lib/features/" + INTERIM_FIX_FEATURE + " will be deleted."); + server.deleteFileFromLibertyInstallRoot("lib/features/" + INTERIM_FIX_FEATURE); + } + + if (server.fileExistsInLibertyInstallRoot("lib/features/" + INTERIM_FIXES_FEATURE)) { + Log.info(c, METHOD_NAME, "lib/features/" + INTERIM_FIXES_FEATURE + " will be deleted."); + server.deleteFileFromLibertyInstallRoot("lib/features/" + INTERIM_FIXES_FEATURE); + } + + Log.exiting(c, METHOD_NAME); + } + + @After + public void tearDown() throws Exception { + final String METHOD_NAME = "tearDown"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) { + server.stopServer(); + } + + server.restoreServerConfiguration(); + + deleteTestBundleJars(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when a number of interim fixes are installed, and displayed in the logs, that the output + * doesn't contain duplicate APAR entries. + */ + @Test + public void testSingleInterimFixOutput() throws Exception { + final String METHOD_NAME = "testSingleInterimFixOutput"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle4_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle4_1.0.0.20130101.jar"); + server.setServerConfigurationFile("singleInterimFixServer.xml"); + server.startServer(); + + String msgId = "CWWKF0015I"; + String interimFixesMsg = server.waitForStringInLog(msgId); + assertNotNull("There should be CWWKF0015I messages in the log", interimFixesMsg); + + assertTrue("APAR0007 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains("APAR0007")); + int APAR0007Pos = interimFixesMsg.indexOf("APAR0007"); + assertTrue("There are duplicated APAR0007 entries in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.indexOf("APAR0007", APAR0007Pos + 1) == -1); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when a number of interim fixes are installed, and displayed in the logs, that the output + * doesn't contain duplicate APAR entries. + */ + @Test + public void testInterimFixesOutput() throws Exception { + final String METHOD_NAME = "testInterimFixesOutput"; + + Log.entering(c, METHOD_NAME); + + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle1_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle1_1.0.0.20130101.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle2_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle2_1.0.0.20130101.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle3_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle3_1.0.0.20130101.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle4_1.0.0.jar"); + server.copyFileToLibertyInstallRoot("lib", "ProvisioningInterimFixesTestBundle4_1.0.0.20130101.jar"); + server.setServerConfigurationFile("interimFixesServer.xml"); + server.startServer(); + + String msgId = "CWWKF0015I"; + String interimFixesMsg = server.waitForStringInLog(msgId); + assertNotNull("There should be CWWKF0015I messages in the log", interimFixesMsg); + + assertTrue("APAR0005 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains("APAR0005")); + int APAR0005Pos = interimFixesMsg.indexOf("APAR0005"); + assertTrue("There are duplicated APAR0005 entries in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.indexOf("APAR0005", APAR0005Pos + 1) == -1); + + assertTrue("APAR0006 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains("APAR0006")); + int APAR0006Pos = interimFixesMsg.indexOf("APAR0006"); + assertTrue("There are duplicated APAR0006 entries in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.indexOf("APAR0006", APAR0006Pos + 1) == -1); + + assertTrue("APAR0007 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains("APAR0007")); + int APAR0007Pos = interimFixesMsg.indexOf("APAR0007"); + assertTrue("There are duplicated APAR0007 entries in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.indexOf("APAR0007", APAR0007Pos + 1) == -1); + + assertTrue("APAR0008 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains("APAR0008")); + int APAR0008Pos = interimFixesMsg.indexOf("APAR0008"); + assertTrue("There are duplicated APAR0008 entries in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.indexOf("APAR0008", APAR0008Pos + 1) == -1); + + // Now ensure that one of the APAR numbers that are prefixed with a space in the manifest header isn't also in the list. + assertFalse("APAR0008 is not listed as in the InterimFixes list: " + interimFixesMsg, interimFixesMsg.contains(" APAR0008")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that the runtime can load a feature bundle. + */ + @Test + public void testBundleIsInstalled() throws Exception { + final String METHOD_NAME = "testBundleIsInstalled"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V100)); + server.startServer(); + + regex = getRegularExpression(V100); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V100) + " should have been started.", found); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that the runtime always loads the latest version of the bundle. In the test we have 2 bundles + * a different versions, and check that the newer one is loaded. We then stop the server, add another bundle, and + * ensure that this newest one is installed correctly. + */ + @Test + public void testLatestBundleVersionIsInstalled() throws Exception { + final String METHOD_NAME = "testLatestBundleVersionIsInstalled"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V100)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.startServer(); + + regex = getRegularExpression(V100); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V100) + " should not have been started.", !found); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should have been started.", found); + + server.stopServer(); + server.copyFileToLibertyInstallRoot("lib", getJarName(V102)); + server.startServer(); + + regex = getRegularExpression(V102); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V102) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when an ifix that doesn't match any existing fixpack bundles is added to + * the server runtime dir, the ifix bundle will be ignored. + */ + @Test + public void testInvalidIFixIsIgnored1() throws Exception { + final String METHOD_NAME = "testInvalidIFixIsIgnored1"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V100)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.startServer(); + + regex = getRegularExpression(V101APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR1) + " should not have been started.", !found); + + regex = getRegularExpression(V100); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V100) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when an ifix that doesn't match any existing fixpack bundles is added to + * the server runtime dir, the ifix bundle will be ignored, but if another valid ifix bundle is + * present, that that bundle is installed. + */ + @Test + public void testInvalidIFixIsIgnored2() throws Exception { + final String METHOD_NAME = "testInvalidIFixIsIgnored2"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V102APAR1)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should not have been started.", !found); + + regex = getRegularExpression(V102APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V102APAR1) + " should not have been started.", !found); + + regex = getRegularExpression(V101APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR1) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when an ifix that matches an existing fixpack bundle is added to + * the server runtime dir, the ifix bundle will be installed. + */ + @Test + public void testValidIFixIsInstalled1() throws Exception { + final String METHOD_NAME = "testValidIFixIsInstalled1"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should not have been started.", !found); + + regex = getRegularExpression(V101APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR1) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when an ifix that matches an existing fixpack bundle is added to + * the server runtime dir, the ifix bundle will be installed. + */ + @Test + public void testValidIFixIsInstalled2() throws Exception { + final String METHOD_NAME = "testValidIFixIsInstalled2"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should have been started.", found); + + server.stopServer(); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should not have been started.", !found); + + regex = getRegularExpression(V101APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR1) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test is testing that when an ifix is installed and the server is warm started, the ifix + * will be installed. + */ + @Test + public void testValidIFixIsInstalledWarmStart() throws Exception { + final String METHOD_NAME = "testValidIFixIsInstalledWarmStart"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should have been started.", found); + + server.stopServer(); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.startServer(false); + + // for V8.5, warm-start does not result in an update. + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that a bundle for a newer release isn't installed into the runtime. + * New releases have a micro version which are incremental factors of 100. + */ + @Test + public void testNextReleaseBundleIsIgnored() throws Exception { + final String METHOD_NAME = "testNextReleaseBundleIsIgnored"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V1099)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V10100)); + server.startServer(); + + regex = getRegularExpression(V10100); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V10100) + " should not have been started.", !found); + + regex = getRegularExpression(V1099); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V1099) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when a bundle has manifest headers of IBM-Test-Fixes and IBM-Interim-Fixes + * the contents are output to the server logs. + */ + @Test + public void testAPARManifestHeadersAreLogged() throws Exception { + final String METHOD_NAME = "testAPARManifestHeadersAreLogged"; + + Log.entering(c, METHOD_NAME); + + final String V101APAR1_IFIX_HEADER = ": APAR0001"; + final String V101TEST_TFIX_HEADER = ": TestAPAR0001"; + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.startServer(); + + assertTrue(FIX_DATA + " file missing.", server.fileExistsInLibertyServerRoot(FIX_DATA)); + + found = !server.findStringsInFileInLibertyServerRoot(".*" + V101APAR1_IFIX_HEADER + ".*", FIX_DATA).isEmpty(); + assertTrue(V101APAR1 + " should have corresponding text \"" + V101APAR1_IFIX_HEADER + "\" in " + FIX_DATA, found); + + server.stopServer(); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101TEST)); + server.startServer(); + + assertTrue(FIX_DATA + " file missing.", server.fileExistsInLibertyServerRoot(FIX_DATA)); + + regex = ".*" + V101APAR1_IFIX_HEADER + ".*"; + found = !server.findStringsInFileInLibertyServerRoot(regex, FIX_DATA).isEmpty(); + assertTrue(V101APAR1 + " should not have corresponding text \"" + V101APAR1_IFIX_HEADER + "\" in " + FIX_DATA, !found); + + regex = ".*" + V101TEST_TFIX_HEADER + ".*"; + found = !server.findStringsInFileInLibertyServerRoot(regex, FIX_DATA).isEmpty(); + assertTrue(V101TEST + " should have corresponding text \"" + V101TEST_TFIX_HEADER + "\" in " + FIX_DATA, found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * TestDescription: + * This test ensures that when a new ifix is installed, it is installed rather than any older versions. + */ + @Test + public void testSupercedingIFixIsInstalled() throws Exception { + final String METHOD_NAME = "testSupercedingIFixIsInstalled"; + + Log.entering(c, METHOD_NAME); + + String regex; + boolean found; + + server.copyFileToLibertyInstallRoot("lib", getJarName(V101)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR1)); + server.copyFileToLibertyInstallRoot("lib", getJarName(V101APAR2)); + server.startServer(); + + regex = getRegularExpression(V101); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101) + " should not have been started.", !found); + + regex = getRegularExpression(V101APAR1); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR1) + " should not have been started.", !found); + + regex = getRegularExpression(V101APAR2); + found = !server.findStringsInLogsAndTrace(regex).isEmpty(); + assertTrue(getBundleAndVersionName(V101APAR2) + " should have been started.", found); + + server.stopServer(); + + Log.exiting(c, METHOD_NAME); + } + + private static final LibertyServer fpServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.provisioning.fat.fingerprint"); + private final String fingerprintFileName = "service.fingerprint"; + private final String fingerprintLocation = "lib/versions"; + private final String fingerprintFileRelativePath = fingerprintLocation + "/" + fingerprintFileName; + private final String fingerprintFileAbsPath = fpServer.getInstallRoot() + fingerprintFileRelativePath; + private final String fingerprintFileAbsPathOld = fingerprintFileAbsPath + ".old"; + + private void mockApplyFix() throws Exception { + //backup the existing service fingerprint + LibertyFileManager.renameLibertyFile(fpServer.getMachine(), fingerprintFileAbsPath, fingerprintFileAbsPathOld); + //copy a mock fingerprint file + fpServer.copyFileToLibertyInstallRoot(fingerprintLocation, "service.fingerprint"); + } + + private void mockRemoveFix() throws Exception { + //remove the mock fingerprint file + fpServer.deleteFileFromLibertyInstallRoot(fingerprintFileRelativePath); + //restore the original service fingerprint + LibertyFileManager.renameLibertyFile(fpServer.getMachine(), fingerprintFileAbsPathOld, fingerprintFileAbsPath); + } + + @Rule + public TestName name = new TestName(); + + private void validateCleanStartWithFixAfterNStarts(int n) throws Exception { + try { + for (int i = 1; i <= n; i++) { + //perform a clean start the first time + fpServer.startServer(name.getMethodName() + "_prestart" + i + "_console.log", (i == 1) ? true : false); + //stop the server and apply the mock service + fpServer.stopServer(); + } + try { + mockApplyFix(); + //copy a marker file into the work area so we can see if it gets cleaned + fpServer.copyFileToLibertyServerRoot("workarea", "marker"); + //specify that we don't want a clean start from the test framework + //because we want it to happen automatically + fpServer.startServer(name.getMethodName() + "_console.log", false); + boolean markerExists = fpServer.fileExistsInLibertyServerRoot("workarea/marker"); + assertFalse("The workarea marker file existed when it should not have, the server did not automatically clean start when the server fingerprint changed after the server had been started " + + n + " times", + markerExists); + } finally { + mockRemoveFix(); + } + } finally { + //now stop and collect the logs + fpServer.stopServer(); + } + } + + /** + * APAR 117401: prove that the server gets clean started when service is applied + * For one previous server start + * + * @throws Exception + */ + @Test + public void testFixCausesCleanOnePreviousStart() throws Exception { + validateCleanStartWithFixAfterNStarts(1); + } + + /** + * APAR 117401: prove that the server gets clean started when service is applied + * For multiple previous server starts + * + * @throws Exception + */ + @Test + public void testFixCausesCleanMultiplePreviousStarts() throws Exception { + validateCleanStartWithFixAfterNStarts(3); + } + + /** + * APAR 117401: validate that the start is warm (not clean) when no service has been applied + * + * @throws Exception + */ + @Test + public void testServerDoesNotCleanStartIfNoFix() throws Exception { + try { + //initially clean start + fpServer.startServer(name.getMethodName() + "_clean_console.log", true); + //stop and collect logs + fpServer.stopServer(false); + //copy a marker file into the work area so we can see if it gets cleaned + fpServer.copyFileToLibertyServerRoot("workarea", "marker"); + //warm start the server + fpServer.startServer(name.getMethodName() + "_warm_console.log", false); + //assert the marker file is still there + boolean markerExists = fpServer.fileExistsInLibertyServerRoot("workarea/marker"); + assertTrue("The workarea marker file did not exist when it should have, the server clean started even though there was no fingerprint change", markerExists); + } finally { + //now stop and collect the logs + fpServer.stopServer(); + } + } + + /** + * Make sure that a server restart causes the server state directory to clear. + * + * @throws Exception + */ + @Test + public void testCleanStateDir() throws Exception { + try { + fpServer.copyFileToLibertyServerRoot("logs/state/", "marker"); + fpServer.startServer(); + assertFalse("The server marker should have been deleted from the state dir on server startup", fpServer.fileExistsInLibertyServerRoot("logs/state/marker")); + } finally { + fpServer.stopServer(); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionMultipleTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionMultipleTest.java new file mode 100755 index 00000000000..f595552f237 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionMultipleTest.java @@ -0,0 +1,203 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.wsspi.kernel.embeddable; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import junit.framework.AssertionFailedError; + +public class EmbeddedServerAddProductExtensionMultipleTest { + + static final Class c = EmbeddedServerAddProductExtensionMultipleTest.class; + + static LibertyServer ls = null; + static Object driver = null; + + static File wsServerBundle = null; + static File testServerClasses = null; + + static Class driverClazz = null; + + public String testName; + + static String serverName = "com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat"; + public static File outputAutoFVTDirectory; + + @Rule + public TestRule testInvoker = new TestRule() { + @Override + public Statement apply(final Statement stmt, final Description desc) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + try { + testName = desc.getMethodName(); + embeddedServerTestHelper(testName); + stmt.evaluate(); + } finally { + testName = null; + } + } + }; + } + }; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + final String METHOD_NAME = "setUpBeforeClass"; + + // Save this off for the tearDown method to manually copy logs from /NonDefaultUser + // folder to /autoFVT/output/servers/ folder. + outputAutoFVTDirectory = new File("output/servers", serverName); + Log.info(c, METHOD_NAME, "outputAutoFVTDirectory: " + outputAutoFVTDirectory.getAbsolutePath()); + + // Find the necessary bundles in our install image + ls = LibertyServerFactory.getLibertyServer("com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat"); + testServerClasses = new File("build/classes"); + + wsServerBundle = new File(ls.getInstallRoot() + "/bin/tools/ws-server.jar"); + + String userDir = ls.getUserDir(); + String outputDir = userDir + "/servers"; + + Log.info(c, METHOD_NAME, "wsServerBundle: " + wsServerBundle.getAbsolutePath()); + Log.info(c, METHOD_NAME, "testServerClasses: " + testServerClasses.getAbsolutePath()); + + URLClassLoader classloader = new URLClassLoader(new URL[] { wsServerBundle.toURI().toURL(), + testServerClasses.toURI().toURL() }) { + // Borrowed from the bvt tests + @Override + protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + Class result = null; + + if (name == null || name.length() == 0) + return null; + + result = findLoadedClass(name); + + if (result == null && name != null) { + try { + // Try to load the class from the child classpath first... + result = findClass(name); + } catch (ClassNotFoundException cnfe) { + result = super.loadClass(name, resolve); + } + } + + return result; + } + }; + + driverClazz = classloader.loadClass("com.ibm.wsspi.kernel.embeddable.EmbeddedServerDriver"); + Constructor dCTOR = driverClazz.getConstructor(String.class, String.class, String.class); + driver = dCTOR.newInstance(serverName, userDir, outputDir); + } + + @AfterClass + public static void tearDown() throws Throwable { + final String METHOD_NAME = "tearDown"; + + // Manually copying server logs since they are in a non-default location + // and build script copy does not pick them up. + outputAutoFVTDirectory.mkdirs(); + Log.info(c, METHOD_NAME, "Copying directory from " + + ls.getUserDir() + "/servers/" + serverName + " to " + + outputAutoFVTDirectory.getAbsolutePath()); + + File srcDir = new File(ls.getUserDir() + "/servers/" + serverName); + copyDirectory(srcDir, outputAutoFVTDirectory.getAbsoluteFile()); + } + + @Test + public void testAddProductExtensionMultiple() throws Throwable {} + + private static void embeddedServerTestHelper(final String REMOTE_METHOD_NAME) throws Throwable { + final String METHOD_NAME = "embeddedServerTestHelper"; + Log.info(c, METHOD_NAME, "Preparing to run: " + REMOTE_METHOD_NAME); + + Method testMethod = driverClazz.getDeclaredMethod(REMOTE_METHOD_NAME); + + Method initMethod = driverClazz.getDeclaredMethod("init", new Class[] { String.class }); + + Method tearDownMethod = driverClazz.getDeclaredMethod("tearDown"); + + Method getFailuresMethod = driverClazz.getDeclaredMethod("getFailures"); + + try { + + initMethod.invoke(driver, new Object[] { REMOTE_METHOD_NAME }); + testMethod.invoke(driver); + tearDownMethod.invoke(driver); + + List failures = (List) getFailuresMethod.invoke(driver); + for (AssertionFailedError fail : failures) + Log.info(driverClazz, REMOTE_METHOD_NAME, fail.getMessage()); + + if (!failures.isEmpty()) + //add string buffer here to show failures in detail + assertTrue("Failures found " + failures, false); + } catch (InvocationTargetException t) { + throw t.getCause(); + } + } + + public static void copyDirectory(File source, File target) throws IOException { + if (source.isDirectory()) { + if (!target.exists()) { + target.mkdir(); + } + + String[] children = source.list(); + for (int i = 0; i < children.length; i++) { + copyDirectory(new File(source, children[i]), + new File(target, children[i])); + } + } else { + InputStream in = new FileInputStream(source); + OutputStream out = new FileOutputStream(target); + + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + in.close(); + out.close(); + } + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionTest.java new file mode 100755 index 00000000000..3566074f5fb --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerAddProductExtensionTest.java @@ -0,0 +1,203 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.wsspi.kernel.embeddable; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import junit.framework.AssertionFailedError; + +public class EmbeddedServerAddProductExtensionTest { + + static final Class c = EmbeddedServerAddProductExtensionTest.class; + + static LibertyServer ls = null; + static Object driver = null; + + static File wsServerBundle = null; + static File testServerClasses = null; + + static Class driverClazz = null; + + public String testName; + + static String serverName = "com.ibm.wsspi.kernel.embeddable.add.product.extension.fat"; + public static File outputAutoFVTDirectory; + + @Rule + public TestRule testInvoker = new TestRule() { + @Override + public Statement apply(final Statement stmt, final Description desc) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + try { + testName = desc.getMethodName(); + embeddedServerTestHelper(testName); + stmt.evaluate(); + } finally { + testName = null; + } + } + }; + } + }; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + final String METHOD_NAME = "setUpBeforeClass"; + + // Save this off for the tearDown method to manually copy logs from /NonDefaultUser + // folder to /autoFVT/output/servers/ folder. + outputAutoFVTDirectory = new File("output/servers", serverName); + Log.info(c, METHOD_NAME, "outputAutoFVTDirectory: " + outputAutoFVTDirectory.getAbsolutePath()); + + // Find the necessary bundles in our install image + ls = LibertyServerFactory.getLibertyServer("com.ibm.wsspi.kernel.embeddable.add.product.extension.fat"); + testServerClasses = new File("build/classes"); + + wsServerBundle = new File(ls.getInstallRoot() + "/bin/tools/ws-server.jar"); + + String userDir = ls.getUserDir(); + String outputDir = userDir + "/servers"; + + Log.info(c, METHOD_NAME, "wsServerBundle: " + wsServerBundle.getAbsolutePath()); + Log.info(c, METHOD_NAME, "testServerClasses: " + testServerClasses.getAbsolutePath()); + + URLClassLoader classloader = new URLClassLoader(new URL[] { wsServerBundle.toURI().toURL(), + testServerClasses.toURI().toURL() }) { + // Borrowed from the bvt tests + @Override + protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + Class result = null; + + if (name == null || name.length() == 0) + return null; + + result = findLoadedClass(name); + + if (result == null && name != null) { + try { + // Try to load the class from the child classpath first... + result = findClass(name); + } catch (ClassNotFoundException cnfe) { + result = super.loadClass(name, resolve); + } + } + + return result; + } + }; + + driverClazz = classloader.loadClass("com.ibm.wsspi.kernel.embeddable.EmbeddedServerDriver"); + Constructor dCTOR = driverClazz.getConstructor(String.class, String.class, String.class); + driver = dCTOR.newInstance(serverName, userDir, outputDir); + } + + @AfterClass + public static void tearDown() throws Throwable { + final String METHOD_NAME = "tearDown"; + + // Manually copying server logs since they are in a non-default location + // and build script copy does not pick them up. + outputAutoFVTDirectory.mkdirs(); + Log.info(c, METHOD_NAME, "Copying directory from " + + ls.getUserDir() + "/servers/" + serverName + " to " + + outputAutoFVTDirectory.getAbsolutePath()); + + File srcDir = new File(ls.getUserDir() + "/servers/" + serverName); + copyDirectory(srcDir, outputAutoFVTDirectory.getAbsoluteFile()); + } + + @Test + public void testAddProductExtension() throws Throwable {} + + private static void embeddedServerTestHelper(final String REMOTE_METHOD_NAME) throws Throwable { + final String METHOD_NAME = "embeddedServerTestHelper"; + Log.info(c, METHOD_NAME, "Preparing to run: " + REMOTE_METHOD_NAME); + + Method testMethod = driverClazz.getDeclaredMethod(REMOTE_METHOD_NAME); + + Method initMethod = driverClazz.getDeclaredMethod("init", new Class[] { String.class }); + + Method tearDownMethod = driverClazz.getDeclaredMethod("tearDown"); + + Method getFailuresMethod = driverClazz.getDeclaredMethod("getFailures"); + + try { + + initMethod.invoke(driver, new Object[] { REMOTE_METHOD_NAME }); + testMethod.invoke(driver); + tearDownMethod.invoke(driver); + + List failures = (List) getFailuresMethod.invoke(driver); + for (AssertionFailedError fail : failures) + Log.info(driverClazz, REMOTE_METHOD_NAME, fail.getMessage()); + + if (!failures.isEmpty()) + //add string buffer here to show failures in detail + assertTrue("Failures found " + failures, false); + } catch (InvocationTargetException t) { + throw t.getCause(); + } + } + + public static void copyDirectory(File source, File target) throws IOException { + if (source.isDirectory()) { + if (!target.exists()) { + target.mkdir(); + } + + String[] children = source.list(); + for (int i = 0; i < children.length; i++) { + copyDirectory(new File(source, children[i]), + new File(target, children[i])); + } + } else { + InputStream in = new FileInputStream(source); + OutputStream out = new FileOutputStream(target); + + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + in.close(); + out.close(); + } + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerDriver.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerDriver.java new file mode 100755 index 00000000000..c5eff7df837 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerDriver.java @@ -0,0 +1,609 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013, 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.wsspi.kernel.embeddable; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.PrintStream; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.Scanner; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.kernel.boot.ReturnCode; +import com.ibm.ws.kernel.boot.cmdline.Utils; +import com.ibm.wsspi.kernel.embeddable.Server.Result; + +import junit.framework.Assert; +import junit.framework.AssertionFailedError; + +public class EmbeddedServerDriver implements ServerEventListener { + + private final Class c = EmbeddedServerDriver.class; + private String CURRENT_METHOD_NAME = null; + + private CountDownLatch startingEventOccurred; + private CountDownLatch startedEventOccurred; + private CountDownLatch stoppedEventOccurred; + private CountDownLatch failedEventOccurred; + + private String serverName = null; + private String userDir = null; + private String outputDir = null; + + private ServerBuilder sb = null; + private Server server = null; + private Result result = null; + private Properties props = null; + private Properties props2 = null; + private Properties props3 = null; + + private List failures = null; + + public EmbeddedServerDriver(String serverName, String userDir, String outputDir) throws UnsupportedEncodingException { + this.serverName = serverName; + this.userDir = userDir; + this.outputDir = outputDir; + this.props = new Properties(); + this.props.setProperty("com.ibm.websphere.productId", "com.ibm.cicsts"); + this.props.setProperty("com.ibm.websphere.productInstall", "wlp/usr/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest"); + this.props2 = new Properties(); + this.props2.setProperty("com.ibm.websphere.productId", "com.ibm.cicstsb"); + this.props2.setProperty("com.ibm.websphere.productInstall", "wlp/usr/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb"); + this.props3 = new Properties(); + this.props3.setProperty("com.ibm.websphere.productId", "com.ibm.cicsts"); + this.props3.setProperty("com.ibm.websphere.productInstall", "wlp/usr/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest"); + init("EmbeddedServerDriver"); + } + + public void init(String CURRENT_METHOD_NAME) throws UnsupportedEncodingException { + this.CURRENT_METHOD_NAME = CURRENT_METHOD_NAME; + + Log.info(c, "init", "Setting up for " + this.CURRENT_METHOD_NAME); + + startingEventOccurred = new CountDownLatch(1); + startedEventOccurred = new CountDownLatch(1); + stoppedEventOccurred = new CountDownLatch(1); + failedEventOccurred = new CountDownLatch(1); + + failures = new ArrayList(); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + System.setOut(new PrintStream(baos, true, "UTF-8")); + + sb = new ServerBuilder(); + if (CURRENT_METHOD_NAME.equals("testAddProductExtension")) { + Log.info(c, "init", "current method name is testAddProductExtension "); + server = sb.setName(serverName).setOutputDir(new File(outputDir)).setUserDir(new File(userDir)).addProductExtension("productA", + props).setServerEventListener(this).build(); + } else if (CURRENT_METHOD_NAME.equals("testAddProductExtensionMultiple")) { + Log.info(c, "init", "current method name is testAddProductExtensionMultiple "); + server = sb.setName(serverName).setOutputDir(new File(outputDir)).setUserDir(new File(userDir)).addProductExtension("productA", + props3).addProductExtension("productB", + props2).setServerEventListener(this).build(); + + } else { + server = sb.setName(serverName).setOutputDir(new File(outputDir)).setUserDir(new File(userDir)).setServerEventListener(this).build(); + } + + String serverConsoleOutput = new String(baos.toByteArray(), "UTF-8"); + Log.info(c, "init", "consoleOutput = " + serverConsoleOutput); + + result = null; + checkServerRunning(false); // server should be stopped + } + + public void tearDown() { + Log.info(c, "init", "Cleaning up after " + this.CURRENT_METHOD_NAME); + + if (server != null) { + Future stopFuture = server.stop(); + stopFuture.cancel(true); + } + + startingEventOccurred = null; + startedEventOccurred = null; + stoppedEventOccurred = null; + failedEventOccurred = null; + } + + public void testStoppingAStoppedServer() { + + // Stop a stopped server + Future stopFuture = server.stop(); + try { + result = stopFuture.get(); + dumpResult("Stopping a stopped server", result); + Assert.assertFalse("Stopping a stopped server should not be successful", result.successful()); + Assert.assertEquals("Should have a redundant operation returned", ReturnCode.REDUNDANT_ACTION_STATUS.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Stop operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Stop operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(false); // server should be stopped + } + + public void testStartingAStoppedServer() { + PrintStream originalSysOut = System.out; + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + System.setOut(new PrintStream(baos, true, "UTF-8")); + coldStartServer(); + verifyServerEvent("\"STARTING\" ServerEvent should have fired", startingEventOccurred); + verifyServerEvent("\"STARTED\" ServerEvent should have fired", startedEventOccurred); + + String serverConsoleOutput = new String(baos.toByteArray(), "UTF-8"); + Log.info(c, "testStartingAStoppedServer", "consoleOutput = " + serverConsoleOutput); + try { + Assert.assertTrue("No indication that application started", serverConsoleOutput.contains("CWWKZ0001I: Application simpleApp started")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for app started message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + // PI20344: Verify that Utils.java is using the correct user dir + String utilsUserDirAbsolutePath = Utils.getUserDir().getAbsolutePath().replace('\\', '/'); + String userDirAbsolutePath = userDir.replace('\\', '/'); + Log.info(c, "testStartingAStoppedServer", "UserDirAbsolutePath=[" + userDirAbsolutePath + "] utilsUserDirAbsolutePath=[" + utilsUserDirAbsolutePath + "]"); + Assert.assertTrue("Utils.userDir() should be using the java property with any luck at all.", userDirAbsolutePath.equals(utilsUserDirAbsolutePath)); + + stopRunningServer(); + } catch (UnsupportedEncodingException ex) { + } finally { + System.setOut(originalSysOut); + } + } + + public void testAddProductExtension() { + PrintStream originalSysOut = System.out; + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + System.setOut(new PrintStream(baos, true, "UTF-8")); + coldStartServer(); + verifyServerEvent("\"STARTING\" ServerEvent should have fired", startingEventOccurred); + verifyServerEvent("\"STARTED\" ServerEvent should have fired", startedEventOccurred); + + String serverConsoleOutput = new String(baos.toByteArray(), "UTF-8"); + Log.info(c, "testAddProductExtension", "consoleOutput = " + serverConsoleOutput); + try { + Assert.assertTrue("No indication that application started", serverConsoleOutput.contains("CWWKZ0001I: Application simpleApp started")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for app started message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + try { + //[AUDIT ] CWWKF0012I: The server installed the following features: [jsp-2.2, productA:prodtest-1.0, timedexit-1.0, servlet-3.0]. + Assert.assertTrue("No indication that the product extension feature productA:prodtest-1.0 was installed", + isProductExtensionInstalled(serverConsoleOutput, "productA:prodtest-1.0")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for the product extension feature was installed message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + try { + // Check that the server logs contain the CWWKE0108I message + String messageToFind = "CWWKE0108I"; + boolean messageFound = false; + Log.info(c, CURRENT_METHOD_NAME, "SCANNING: " + outputDir + "/" + serverName + "/logs/message.log"); + File logFile = new File(outputDir + "/" + serverName + "/logs/messages.log"); + Scanner logScanner = new Scanner(logFile); + while (logScanner.hasNextLine() && messageFound == false) { + String line = logScanner.nextLine(); + Log.info(c, CURRENT_METHOD_NAME, line); + if (line.contains(messageToFind)) { + messageFound = true; + } + } + logScanner.close(); + Assert.assertTrue(messageFound); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for product extension was added message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + stopRunningServer(); + } catch (UnsupportedEncodingException ex) { + } finally { + System.setOut(originalSysOut); + } + } + + /** + * Determine if the input product extension exists in the input string. + * + * @param inputString string to search. + * @param productExtension product extension to search for. + * @return true if input product extension is found in the input string. + */ + private boolean isProductExtensionInstalled(String inputString, String productExtension) { + if ((productExtension == null) || (inputString == null)) { + return false; + } + int msgIndex = inputString.indexOf("CWWKF0012I: The server installed the following features:"); + if (msgIndex == -1) { + return false; + } + + String msgString = inputString.substring(msgIndex); + int leftBracketIndex = msgString.indexOf("["); + int rightBracketIndex = msgString.indexOf("]"); + if ((leftBracketIndex == -1) || + (rightBracketIndex == -1) || + (rightBracketIndex < leftBracketIndex)) { + return false; + } + + String features = msgString.substring(leftBracketIndex, rightBracketIndex); + Log.info(c, "isProductExtensionInstalled", features); + if (features.indexOf(productExtension) == -1) { + return false; + } + return true; + } + + public void testAddProductExtensionMultiple() { + PrintStream originalSysOut = System.out; + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + System.setOut(new PrintStream(baos, true, "UTF-8")); + coldStartServer(); + verifyServerEvent("\"STARTING\" ServerEvent should have fired", startingEventOccurred); + verifyServerEvent("\"STARTED\" ServerEvent should have fired", startedEventOccurred); + + String serverConsoleOutput = new String(baos.toByteArray(), "UTF-8"); + Log.info(c, "testAddProductExtensionMultiple", "consoleOutput = " + serverConsoleOutput); + try { + Assert.assertTrue("No indication that application started", serverConsoleOutput.contains("CWWKZ0001I: Application simpleApp started")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for app started message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + // [AUDIT ] CWWKF0012I: The server installed the following features: [jsp-2.2, productA:prodtest-1.0, productB:prodtestb-1.0, timedexit-1.0, servlet-3.0]. + try { + Assert.assertTrue("No indication that the product extension feature productA:prodtest-1.0 was installed", + isProductExtensionInstalled(serverConsoleOutput, "productA:prodtest-1.0")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for the product extension feature was installed message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + try { + Assert.assertTrue("No indication that the product extension feature productB:prodtestb-1.0 was installed", + isProductExtensionInstalled(serverConsoleOutput, "productB:prodtestb-1.0")); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for the product extension feature was installed message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + try { + // Check that the server logs contain the CWWKE0108I message + String messageToFind = "CWWKE0108I"; + boolean messageFound = false; + Log.info(c, CURRENT_METHOD_NAME, "SCANNING: " + outputDir + "/" + serverName + "/logs/message.log"); + File logFile = new File(outputDir + "/" + serverName + "/logs/messages.log"); + Scanner logScanner = new Scanner(logFile); + while (logScanner.hasNextLine() && messageFound == false) { + String line = logScanner.nextLine(); + Log.info(c, CURRENT_METHOD_NAME, line); + if (line.contains(messageToFind)) { + messageFound = true; + } + } + logScanner.close(); + Assert.assertTrue(messageFound); + } catch (Throwable t) { + failures.add(new AssertionFailedError("Exception occurred while searching for product extension was added message in logs - " + t)); + Log.error(c, CURRENT_METHOD_NAME, t); + } + + stopRunningServer(); + } catch (UnsupportedEncodingException ex) { + } finally { + System.setOut(originalSysOut); + } + } + + public void testStartingAStartedServer() { + warmStartServer(); + + verifyServerEvent("\"STARTING\" ServerEvent should have fired", startingEventOccurred); + verifyServerEvent("\"STARTED\" ServerEvent should have fired", startedEventOccurred); + + // Start the started server + Future startFuture2 = server.start(); + try { + result = startFuture2.get(); + dumpResult("Starting a started server", result); + Assert.assertFalse("Starting a started server should not be successful", result.successful()); + Assert.assertEquals("Should have a redundant operation returned", ReturnCode.REDUNDANT_ACTION_STATUS.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(true); // server should be started + stopRunningServer(); + } + + public void testStoppingAStartedServer() { + warmStartServer(); + verifyServerEvent("\"STARTING\" ServerEvent should have fired", startingEventOccurred); + verifyServerEvent("\"STARTED\" ServerEvent should have fired", startedEventOccurred); + stopRunningServer(); + } + + public void testBadArgument() { + Future startFuture = server.start(new String[] { "--nOnSeNsE" }); + + try { + // check for failed event: should fire w/o requiring interaction w/ future.get + verifyServerEvent("\"FAILED\" ServerEvent should have fired", failedEventOccurred); + + result = startFuture.get(); + dumpResult("Starting a server", result); + Assert.assertFalse("Result of start attempt with bad args should fail", result.successful()); + Assert.assertEquals("Should have an BAD_ARGUMENT return code", ReturnCode.BAD_ARGUMENT.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(false); // server should not be started + } + + public void testLaunchException() { + Future startFuture = server.start("--create"); // server already created in init(), double create should fail + + try { + result = startFuture.get(); + dumpResult("Starting an embedded server with \"--create\", which is a bad thing to do", result); + Assert.assertFalse("Result of LaunchException should be failure", result.successful()); + Assert.assertEquals("Should have a BAD_ARGUMENT return code", ReturnCode.BAD_ARGUMENT.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(false); // server should not be started + } + + public void testLocationException() { + + String bogusName = "bOgUsSeRvErNaMe"; + server = sb.setName(bogusName).setOutputDir(new File(outputDir)).setUserDir(new File(userDir)).setServerEventListener(this).build(); + + (new File(outputDir + "/" + bogusName, "server.xml")).delete(); // delete the server from the hfs, so start() throws a LocationException + + Future startFuture = server.start(); + + try { + // check for failed event: should fire w/o requiring interaction w/ future.get + verifyServerEvent("\"FAILED\" ServerEvent should have fired", failedEventOccurred); + + result = startFuture.get(); + dumpResult("Starting a server with a bogus name", result); + Assert.assertFalse("Result of LocationException should be failure", result.successful()); + Assert.assertEquals("Should have a LOCATION_EXCEPTION return code", ReturnCode.LOCATION_EXCEPTION.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(false); // server should not be started + } + + public void testServerUnknownStatus() { + //TODO: This is not called by the test framework + // because I don't know how to guarantee an InterruptedException + // without jMock, which seems pointless in a FAT scenario like this + + Future startFuture = server.start(new String[] { "--clean" }); + + try { + result = startFuture.get(); + dumpResult("Force an InterruptException while starting a server", result); + Assert.assertFalse("Result of InterruptedException should be failure", result.successful()); + Assert.assertEquals("Should have a SERVER_UNKNOWN_STATUS return code", ReturnCode.SERVER_UNKNOWN_STATUS.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(true); // server should be started + + } + + public void testErrorServerStart() { + //TODO: This is not called by the test framework + // because I don't know how to force waitForStarted() to return false + // without jMock, which seems pointless in a FAT scenario like this + + } + + public List getFailures() { + return failures; + } + + private void verifyServerEvent(String msg, CountDownLatch event) { + boolean pass = false; + + try { + event.await(5, TimeUnit.SECONDS); + pass = true; + } catch (InterruptedException e) { + pass = false; + } + + try { + Assert.assertTrue(msg, pass); + } catch (AssertionFailedError e) { + failures.add(new AssertionFailedError(e.toString())); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + } + + private void warmStartServer() { + Future startFuture = server.start(); + + try { + result = startFuture.get(); + dumpResult("Starting a server", result); + Assert.assertTrue("Result of start attempt should be successful", result.successful()); + Assert.assertEquals("Should have an OK return code", ReturnCode.OK.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(true); // server should be started + } + + private void coldStartServer() { + Future startFuture = server.start(new String[] { "--clean" }); + + try { + result = startFuture.get(); + dumpResult("Starting a server", result); + Assert.assertTrue("Result of first start attempt should be successful", result.successful()); + Assert.assertEquals("Should have an OK return code", ReturnCode.OK.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Start operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + startFuture.cancel(true); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Start operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(true); // server should be started + } + + private void stopRunningServer() { + Future stopFuture = server.stop(); + try { + result = stopFuture.get(); + dumpResult("Stopping a started server", result); + Assert.assertTrue("Stopping a running server should be successful", result.successful()); + Assert.assertEquals("Should have an OK return code", ReturnCode.OK.getValue(), result.getReturnCode()); + } catch (AssertionFailedError e) { + failures.add(e); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (InterruptedException e) { + failures.add(new AssertionFailedError("Stop operation did not complete normally: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } catch (ExecutionException e) { + failures.add(new AssertionFailedError("Stop operation could not be queued: " + e)); + Log.error(c, CURRENT_METHOD_NAME, e); + } + + checkServerRunning(false); // server should be stopped + + verifyServerEvent("\"STOPPED\" ServerEvent should have fired", stoppedEventOccurred); + } + + private void checkServerRunning(boolean expectRunning) { + try { + if (expectRunning) { + Assert.assertTrue("Server should be running", server.isRunning()); + } else { + Assert.assertFalse("Server should not be running", server.isRunning()); + } + } catch (AssertionFailedError e) { + failures.add(e); + } + } + + private void dumpResult(String msg, Result result) { + Log.info(c, "dumpResult", msg + " -- Result: success=" + result.successful() + ", rc=" + result.getReturnCode() + ", ex=" + result.getException()); + } + + @Override + public void serverEvent(ServerEvent serverEvent) { + String event = serverEvent.toString(); + Log.info(c, "serverEvent", "NEW SERVER EVENT FIRED: " + event); + + switch (serverEvent.getType()) { + case STARTING: + startingEventOccurred.countDown(); + break; + case STARTED: + startedEventOccurred.countDown(); + break; + case STOPPED: + stoppedEventOccurred.countDown(); + break; + case FAILED: + failedEventOccurred.countDown(); + break; + default: + break; + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerTest.java b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerTest.java new file mode 100755 index 00000000000..2f5089bda93 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/fat/src/com/ibm/wsspi/kernel/embeddable/EmbeddedServerTest.java @@ -0,0 +1,265 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.wsspi.kernel.embeddable; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.channels.FileChannel; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import junit.framework.AssertionFailedError; + +public class EmbeddedServerTest { + + static final Class c = EmbeddedServerTest.class; + + static LibertyServer ls = null; + static Object driver = null; + + static File wsServerBundle = null; + static File testServerClasses = null; + + static Class driverClazz = null; + + public String testName; + + static String serverName = "com.ibm.wsspi.kernel.embeddable.fat"; + public static File outputAutoFVTDirectory; + + @Rule + public TestRule testInvoker = new TestRule() { + @Override + public Statement apply(final Statement stmt, final Description desc) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + try { + testName = desc.getMethodName(); + embeddedServerTestHelper(testName); + stmt.evaluate(); + } finally { + testName = null; + } + } + }; + } + }; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + final String METHOD_NAME = "setUpBeforeClass"; + + // Save this off for the tearDown method to manually copy logs from /NonDefaultUser + // folder to /autoFVT/output/servers/ folder. + outputAutoFVTDirectory = new File("output/servers", serverName); + Log.info(c, METHOD_NAME, "outputAutoFVTDirectory: " + outputAutoFVTDirectory.getAbsolutePath()); + + // Find the necessary bundles in our install image + ls = LibertyServerFactory.getLibertyServer("com.ibm.wsspi.kernel.embeddable.fat"); + + testServerClasses = new File("build/classes"); + + wsServerBundle = new File(ls.getInstallRoot() + "/bin/tools/ws-server.jar"); + + // PI20344: Use non default directories. + String userDir = ls.getUserDir() + "/../NonDefaultUser"; // originally ls.getUserDir() + String outputDir = userDir + "/servers"; // originally ls.getServerRoot(); + + // PI20344: Additional setup needed when using non default directories. + // Copy the server directory to my output directory + // Also need the test.properties file + File destDir = new File(outputDir, serverName); + File srcDir = new File(ls.getServerRoot()); + destDir.mkdirs(); + copyDirectory(srcDir, destDir); + + File dest_TestPorts = new File(destDir, "/../testports.properties"); + File src_TestPorts = new File(srcDir, "/../testports.properties"); + copyFile(src_TestPorts, dest_TestPorts); + // END PI20344 + + Log.info(c, METHOD_NAME, "wsServerBundle: " + wsServerBundle.getAbsolutePath()); + Log.info(c, METHOD_NAME, "testServerClasses: " + testServerClasses.getAbsolutePath()); + + URLClassLoader classloader = new URLClassLoader(new URL[] { wsServerBundle.toURI().toURL(), + testServerClasses.toURI().toURL() }) { + // Borrowed from the bvt tests + @Override + protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + Class result = null; + + if (name == null || name.length() == 0) + return null; + + result = findLoadedClass(name); + + if (result == null && name != null) { + try { + // Try to load the class from the child classpath first... + result = findClass(name); + } catch (ClassNotFoundException cnfe) { + result = super.loadClass(name, resolve); + } + } + + return result; + } + }; + + driverClazz = classloader.loadClass("com.ibm.wsspi.kernel.embeddable.EmbeddedServerDriver"); + Constructor dCTOR = driverClazz.getConstructor(String.class, String.class, String.class); + driver = dCTOR.newInstance(serverName, userDir, outputDir); + } + + @AfterClass + public static void tearDown() throws Throwable { + final String METHOD_NAME = "tearDown"; + + // Manually copying server logs since they are in a non-default location + // and build script copy does not pick them up. + outputAutoFVTDirectory.mkdirs(); + Log.info(c, METHOD_NAME, "Copying directory from " + + ls.getUserDir() + "/../NonDefaultUser" + " to " + + outputAutoFVTDirectory.getAbsolutePath()); + + File srcDir = new File(ls.getUserDir() + "/../NonDefaultUser"); + copyDirectory(srcDir, outputAutoFVTDirectory.getAbsoluteFile()); + } + + @Test + public void testStoppingAStoppedServer() throws Throwable {} + + @Test + public void testStartingAStoppedServer() throws Throwable {} + + @Test + public void testStartingAStartedServer() throws Throwable {} + + @Test + public void testStoppingAStartedServer() throws Throwable {} + + @Test + public void testBadArgument() throws Throwable {} + + @Test + public void testLaunchException() throws Throwable {} + + //@Test + //public void testLocationException() throws Throwable {} + + private static void embeddedServerTestHelper(final String REMOTE_METHOD_NAME) throws Throwable { + final String METHOD_NAME = "testEmbeddedServer"; + Log.info(c, METHOD_NAME, "Preparing to run: " + REMOTE_METHOD_NAME); + + Method testMethod = driverClazz.getDeclaredMethod(REMOTE_METHOD_NAME); + + Method initMethod = driverClazz.getDeclaredMethod("init", new Class[] { String.class }); + + Method tearDownMethod = driverClazz.getDeclaredMethod("tearDown"); + + Method getFailuresMethod = driverClazz.getDeclaredMethod("getFailures"); + + try { + + initMethod.invoke(driver, new Object[] { REMOTE_METHOD_NAME }); + testMethod.invoke(driver); + tearDownMethod.invoke(driver); + + List failures = (List) getFailuresMethod.invoke(driver); + for (AssertionFailedError fail : failures) + Log.info(driverClazz, REMOTE_METHOD_NAME, fail.getMessage()); + + if (!failures.isEmpty()) + //add string buffer here to show failures in detail + assertTrue("Failures found " + failures, false); + } catch (InvocationTargetException t) { + throw t.getCause(); + } + } + + private static void copyFile(File fromFile, File toFile) throws IOException { + // Open the source file + FileInputStream fis = new FileInputStream(fromFile); + try { + // Open the destination file + File destDir = toFile.getParentFile(); + if (!destDir.exists() && !destDir.mkdirs()) { + throw new IOException("Failed to create path: " + destDir.getAbsolutePath()); + } + + System.out.println("Copying file from: " + fromFile.getAbsolutePath()); + System.out.println("Copying file to: " + toFile.getAbsolutePath()); + + FileOutputStream fos = new FileOutputStream(toFile); + + // Perform the transfer using nio channels; this is simpler, and usually + // faster, than copying the file a chunk at a time + try { + FileChannel inChan = fis.getChannel(); + FileChannel outChan = fos.getChannel(); + inChan.transferTo(0, inChan.size(), outChan); + } finally { + fos.close(); + } + } finally { + fis.close(); + } + } + + public static void copyDirectory(File source, File target) throws IOException { + if (source.isDirectory()) { + if (!target.exists()) { + target.mkdir(); + } + + String[] children = source.list(); + for (int i = 0; i < children.length; i++) { + copyDirectory(new File(source, children[i]), + new File(target, children[i])); + } + } else { + InputStream in = new FileInputStream(source); + OutputStream out = new FileOutputStream(target); + + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + in.close(); + out.close(); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/applications/SharedLooseEAR.ear.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/applications/SharedLooseEAR.ear.xml new file mode 100755 index 00000000000..cc417f09a57 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/applications/SharedLooseEAR.ear.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.20130101.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.20130101.jar new file mode 100755 index 00000000000..ea1069f0f19 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.20130101.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.jar new file mode 100755 index 00000000000..ed70dc5c577 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle1_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.20130101.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.20130101.jar new file mode 100755 index 00000000000..20306fa9e7c Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.20130101.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.jar new file mode 100755 index 00000000000..8decf44057c Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle2_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.20130101.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.20130101.jar new file mode 100755 index 00000000000..b1cc8684eff Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.20130101.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.jar new file mode 100755 index 00000000000..ec2429663d3 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle3_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.20130101.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.20130101.jar new file mode 100755 index 00000000000..21e8d5ec4ed Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.20130101.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.jar new file mode 100755 index 00000000000..189cbd8f06c Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningInterimFixesTestBundle4_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.0.jar new file mode 100755 index 00000000000..7969a205850 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201202020001-APAR0001.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201202020001-APAR0001.jar new file mode 100755 index 00000000000..b6281ee5842 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201202020001-APAR0001.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201203030001-APAR0002.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201203030001-APAR0002.jar new file mode 100755 index 00000000000..06f522ad2cf Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201203030001-APAR0002.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201204040001-TestAPAR0001.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201204040001-TestAPAR0001.jar new file mode 100755 index 00000000000..4d11853da92 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.201204040001-TestAPAR0001.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.jar new file mode 100755 index 00000000000..a06da8765a3 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.100.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.100.jar new file mode 100755 index 00000000000..b4bebbab419 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.100.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.201201010001-APAR0001.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.201201010001-APAR0001.jar new file mode 100755 index 00000000000..c19e1e1bcb9 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.201201010001-APAR0001.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.jar new file mode 100755 index 00000000000..c532b85b784 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.2.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.99.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.99.jar new file mode 100755 index 00000000000..0895ca97ce1 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/files/ProvisioningTestBundle_1.0.99.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/jvm.options b/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/jvm.options new file mode 100755 index 00000000000..112fc720a05 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/jvm.options @@ -0,0 +1 @@ +-Xfuture \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/server.xml new file mode 100755 index 00000000000..b644e5a23d5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/Xfuture/server.xml @@ -0,0 +1,11 @@ + + + + + + webProfile-6.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/interimFixesServer.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/files/interimFixesServer.xml new file mode 100755 index 00000000000..12fde62f6aa --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/interimFixesServer.xml @@ -0,0 +1,12 @@ + + + + + + jsp-2.2 + provisioningInterimFixesTest-1.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/marker b/dev/com.ibm.ws.kernel.boot_fat/publish/files/marker new file mode 100755 index 00000000000..74fd67bb1d0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/marker @@ -0,0 +1 @@ +A marker file to put in the workarea in the fingerprint clean tests. \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixTest-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixTest-1.0.mf new file mode 100755 index 00000000000..ebf1245cd20 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1.0 +Subsystem-SymbolicName: provisioningInterimFixTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ProvisioningInterimFixesTestBundle4; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixesTest-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixesTest-1.0.mf new file mode 100755 index 00000000000..ecf49f7ebd6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningInterimFixesTest-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1.0 +Subsystem-SymbolicName: provisioningInterimFixesTest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ProvisioningInterimFixesTestBundle1; version="[1,1.0.100)", + ProvisioningInterimFixesTestBundle2; version="[1,1.0.100)", + ProvisioningInterimFixesTestBundle3; version="[1,1.0.100)", + ProvisioningInterimFixesTestBundle4; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningTest-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningTest-1.0.mf new file mode 100755 index 00000000000..9f6781da6bc --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/provisioningTest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: provisioningTest-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: ProvisioningTestBundle; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/service.fingerprint b/dev/com.ibm.ws.kernel.boot_fat/publish/files/service.fingerprint new file mode 100755 index 00000000000..1fc7a99648a --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/service.fingerprint @@ -0,0 +1 @@ +A test fingerprint file for mocking the service.fingerprint - in response to APAR 117401 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/singleInterimFixServer.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/files/singleInterimFixServer.xml new file mode 100755 index 00000000000..3139c91691e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/singleInterimFixServer.xml @@ -0,0 +1,12 @@ + + + + + + jsp-2.2 + provisioningInterimFixTest-1.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestAbsolute.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestAbsolute.properties new file mode 100755 index 00000000000..bc4bf180ed4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestAbsolute.properties @@ -0,0 +1 @@ +com.ibm.websphere.productInstall= \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestRelative.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestRelative.properties new file mode 100755 index 00000000000..2f12f144323 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/extensions/templateTestRelative.properties @@ -0,0 +1 @@ +com.ibm.websphere.productInstall=wlpExt (&+) diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/clients/template2/client.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/clients/template2/client.xml new file mode 100755 index 00000000000..a07161e7dde --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/clients/template2/client.xml @@ -0,0 +1,7 @@ + + + + javaeeClient-7.0 + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/servers/templateTest/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/servers/templateTest/server.xml new file mode 100755 index 00000000000..4f3c32e2ec9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/files/test_template_option/templates/servers/templateTest/server.xml @@ -0,0 +1,14 @@ + + + + + jsp-2.2 + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/earContent/META-INF/application.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/earContent/META-INF/application.xml new file mode 100755 index 00000000000..3c8c2abda26 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/earContent/META-INF/application.xml @@ -0,0 +1,16 @@ + + + TestMyEAR + + + TestWeb1.war + TestMyWeb1 + + + + + TestWeb0.war + TestMyWeb0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testUtil/classes/META-INF/MANIFEST.MF b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testUtil/classes/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..254272e1c07 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testUtil/classes/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/META-INF/MANIFEST.MF b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..59499bce4a2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/index.jsp b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/index.jsp new file mode 100755 index 00000000000..7c276b94a38 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb0/WebContent/index.jsp @@ -0,0 +1,12 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + +Welcome + + + Hi, this is web0. + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/META-INF/MANIFEST.MF b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..59499bce4a2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/index.jsp b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/index.jsp new file mode 100755 index 00000000000..7c276b94a38 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/testWeb1/WebContent/index.jsp @@ -0,0 +1,12 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + +Welcome + + + Hi, this is web0. + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/utils/classes/META-INF/MANIFEST.MF b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/utils/classes/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..254272e1c07 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/resources/looseConfig/utils/classes/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/bootstrap.properties new file mode 100644 index 00000000000..4f1ae5a2e10 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/dropins/snoop.war b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/dropins/snoop.war new file mode 100644 index 00000000000..eff33454efa Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/dropins/snoop.war differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/server.xml new file mode 100644 index 00000000000..1d8a79716f1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/ServerStartAsServiceTest/server.xml @@ -0,0 +1,12 @@ + + + + jsp-2.2 + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/Apps Loose Web.war.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/Apps Loose Web.war.xml new file mode 100755 index 00000000000..5c1bcb1587e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/Apps Loose Web.war.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-InvalidRelPaths.war.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-InvalidRelPaths.war.xml new file mode 100755 index 00000000000..41d0c37d096 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-InvalidRelPaths.war.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-RelPaths.war.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-RelPaths.war.xml new file mode 100755 index 00000000000..dee07e12b8f --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-RelPaths.war.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-Signed.war.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-Signed.war.xml new file mode 100755 index 00000000000..bcbd83212b8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb-Signed.war.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + arbitrary text between tags should not cause package command to fail + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb.war.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb.war.xml new file mode 100755 index 00000000000..5c1bcb1587e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/apps/AppsLooseWeb.war.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/bootstrap.properties new file mode 100755 index 00000000000..8de793643ea --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/bootstrap.properties @@ -0,0 +1,5 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:bootstrap=all=enabled +com.ibm.ws.logging.trace.max.files=30 + +# com.ibm.ws.kernel.boot.env.bvt needs testports.properties for HTTP +#bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/dropins/DropinsLooseWeb.ear.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/dropins/DropinsLooseWeb.ear.xml new file mode 100755 index 00000000000..4522aedfe5a --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/dropins/DropinsLooseWeb.ear.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/server.xml new file mode 100755 index 00000000000..8b22ca755eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.bvt/server.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/.gitignore b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/bootstrap.properties new file mode 100644 index 00000000000..6fe952051a3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/bootstrap.properties @@ -0,0 +1,5 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:bootstrap=all=enabled +com.ibm.ws.logging.trace.max.files=1 +com.ibm.ws.logging.console.log.level=INFO + +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/server.xml new file mode 100644 index 00000000000..98604eaa3fe --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.classpath.fat/server.xml @@ -0,0 +1,9 @@ + + + + + ejbLite-3.2 + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/.gitignore b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/.gitignore new file mode 100644 index 00000000000..f3f483d82c0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/.gitignore @@ -0,0 +1 @@ +/dropins diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/bootstrap.properties new file mode 100755 index 00000000000..831b15d60ef --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/bootstrap.properties @@ -0,0 +1,2 @@ +command.port=-1 +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/server.xml new file mode 100755 index 00000000000..94fb81cd155 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.disabled.fat/server.xml @@ -0,0 +1,6 @@ + + + servlet-3.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.enabled.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.enabled.fat/server.xml new file mode 100755 index 00000000000..dd543055eaf --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.commandport.enabled.fat/server.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/bootstrap.properties new file mode 100755 index 00000000000..fe859a24711 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/server.xml new file mode 100755 index 00000000000..a0f06d9e4b9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.env.bvt/server.xml @@ -0,0 +1,11 @@ + + + + + + + httpservice-2.2 + fileinstall-1.0 + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.pause.resume.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.pause.resume.fat/server.xml new file mode 100755 index 00000000000..dd543055eaf --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.pause.resume.fat/server.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.serverstart.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.serverstart.fat/server.xml new file mode 100755 index 00000000000..dd543055eaf --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.boot.serverstart.fat/server.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties new file mode 100755 index 00000000000..14294e57943 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties @@ -0,0 +1,5 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:bootstrap=all=enabled +com.ibm.ws.logging.trace.max.files=30 +com.ibm.ws.logging.console.log.level=INFO + +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties.hpel b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties.hpel new file mode 100755 index 00000000000..c5ee4367a12 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/bootstrap.properties.hpel @@ -0,0 +1,7 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:bootstrap=all=enabled +com.ibm.ws.logging.trace.max.files=30 +com.ibm.ws.logging.console.log.level=INFO + +websphere.log.provider=binaryLogging-1.0 + +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/server.xml new file mode 100755 index 00000000000..8c7a1920c7f --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.fat/server.xml @@ -0,0 +1,4 @@ + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/bootstrap.properties new file mode 100755 index 00000000000..308b99268d4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.console.log.level=OFF +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/server.xml new file mode 100755 index 00000000000..4163d65d362 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.bootstrap.output.fat/server.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/server.xml new file mode 100755 index 00000000000..7b298238aa6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat.fingerprint/server.xml @@ -0,0 +1,9 @@ + + + + + + jsp-2.2 + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/server.xml new file mode 100755 index 00000000000..13f01736f3d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.provisioning.fat/server.xml @@ -0,0 +1,12 @@ + + + + + + jsp-2.2 + provisioningTest-1.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/.gitignore b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/.gitignore new file mode 100644 index 00000000000..f3f483d82c0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/.gitignore @@ -0,0 +1 @@ +/dropins diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/bootstrap.properties new file mode 100755 index 00000000000..7ff78ec74f8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled:bootstrap=all=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/server.xml new file mode 100755 index 00000000000..0d3471bf0d8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.ws.kernel.shutdown.fat/server.xml @@ -0,0 +1,7 @@ + + + servlet-3.0 + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/bootstrap.properties new file mode 100755 index 00000000000..2e3faa500d3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/dropins/simpleApp.war/index.jsp b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/dropins/simpleApp.war/index.jsp new file mode 100755 index 00000000000..bdb6c10537e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/dropins/simpleApp.war/index.jsp @@ -0,0 +1,3 @@ + +
Hi, my name is <%=request.getParameter("name")%>
+ \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar new file mode 100755 index 00000000000..85a6fa4f6ad Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/features/prodtest-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/features/prodtest-1.0.mf new file mode 100755 index 00000000000..21b5ef9153b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/producttest/lib/features/prodtest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/server.xml new file mode 100755 index 00000000000..e1ebec9e880 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.fat/server.xml @@ -0,0 +1,12 @@ + + + + + + jsp-2.2 + productA:prodtest-1.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/bootstrap.properties new file mode 100755 index 00000000000..2e3faa500d3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/dropins/simpleApp.war/index.jsp b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/dropins/simpleApp.war/index.jsp new file mode 100755 index 00000000000..bdb6c10537e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/dropins/simpleApp.war/index.jsp @@ -0,0 +1,3 @@ + +
Hi, my name is <%=request.getParameter("name")%>
+ \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar new file mode 100755 index 00000000000..85a6fa4f6ad Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/com.ibm.ws.prodtest.internal_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/features/prodtest-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/features/prodtest-1.0.mf new file mode 100755 index 00000000000..21b5ef9153b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttest/lib/features/prodtest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/com.ibm.ws.prodtest.internal_1.0.jar b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/com.ibm.ws.prodtest.internal_1.0.jar new file mode 100755 index 00000000000..85a6fa4f6ad Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/com.ibm.ws.prodtest.internal_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/features/prodtestb-1.0.mf b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/features/prodtestb-1.0.mf new file mode 100755 index 00000000000..38d76226d87 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/producttestb/lib/features/prodtestb-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtestb-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/server.xml new file mode 100755 index 00000000000..fe1e35f2d5e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.add.product.extension.multiple.fat/server.xml @@ -0,0 +1,13 @@ + + + + + + jsp-2.2 + productA:prodtest-1.0 + productB:prodtestb-1.0 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/bootstrap.properties new file mode 100755 index 00000000000..2e3faa500d3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/dropins/simpleApp.war/index.jsp b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/dropins/simpleApp.war/index.jsp new file mode 100755 index 00000000000..bdb6c10537e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/dropins/simpleApp.war/index.jsp @@ -0,0 +1,3 @@ + +
Hi, my name is <%=request.getParameter("name")%>
+ \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/server.xml new file mode 100755 index 00000000000..72b547c216c --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/com.ibm.wsspi.kernel.embeddable.fat/server.xml @@ -0,0 +1,11 @@ + + + + + + jsp-2.2 + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/bootstrap.properties new file mode 100755 index 00000000000..fe859a24711 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.logging.trace.specification=*=info=enabled +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/server.xml b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/server.xml new file mode 100755 index 00000000000..8b22ca755eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/publish/servers/embed_me/server.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_fat/test-applications/checkJvmAppClasspath/src/com/ibm/ws/kernel/boot/app/classpath/CheckJvmAppClasspathPackagesBean.java b/dev/com.ibm.ws.kernel.boot_fat/test-applications/checkJvmAppClasspath/src/com/ibm/ws/kernel/boot/app/classpath/CheckJvmAppClasspathPackagesBean.java new file mode 100644 index 00000000000..8c81c5d791a --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/test-applications/checkJvmAppClasspath/src/com/ibm/ws/kernel/boot/app/classpath/CheckJvmAppClasspathPackagesBean.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.app.classpath; + +import java.lang.reflect.Method; + +import javax.annotation.PostConstruct; +import javax.ejb.LocalBean; +import javax.ejb.Singleton; +import javax.ejb.Startup; + +@Startup +@Singleton +@LocalBean +public class CheckJvmAppClasspathPackagesBean { + + private static ClassLoader JVM_APP_LOADER = ClassLoader.getSystemClassLoader(); + + @PostConstruct + public void printJvmAppClasspathPackages() { + Method m; + try { + m = ClassLoader.class.getDeclaredMethod("getPackages"); + m.setAccessible(true); + Package[] pkgs = (Package[]) m.invoke(JVM_APP_LOADER); + for (Package p : pkgs) { + System.out.println("AppLoader can load: " + p.getName()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/.gitignore b/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/.gitignore new file mode 100644 index 00000000000..e47e1b33a74 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/.gitignore @@ -0,0 +1 @@ +/resources diff --git a/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/src/com/ibm/ws/kernel/boot/fat/ShutdownTestServlet.java b/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/src/com/ibm/ws/kernel/boot/fat/ShutdownTestServlet.java new file mode 100755 index 00000000000..85a52828141 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_fat/test-applications/shutdownfat/src/com/ibm/ws/kernel/boot/fat/ShutdownTestServlet.java @@ -0,0 +1,46 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.fat; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet("/*") +@SuppressWarnings("serial") +public class ShutdownTestServlet extends HttpServlet { + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + final String exitMethodName = request.getParameter("exit"); + response.getWriter().println("exit=" + exitMethodName); + + // WebContainer "helpfully" blocks app stop until all servlets have + // finished their requests. That only makes the FAT take longer, so use + // a secondary thread. + new Thread() { + @Override + public void run() { + if ("Runtime.exit".equals(exitMethodName)) { + System.out.println(this + ": calling Runtime.exit"); + Runtime.getRuntime().exit(0); + } else { + System.out.println(this + ": calling Shutdown.exit"); + System.exit(0); + } + } + }.start(); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/.classpath b/dev/com.ibm.ws.kernel.boot_test/.classpath new file mode 100644 index 00000000000..bd880329225 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_test/.classpath.gradle b/dev/com.ibm.ws.kernel.boot_test/.classpath.gradle new file mode 100644 index 00000000000..bd880329225 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_test/.gitignore b/dev/com.ibm.ws.kernel.boot_test/.gitignore new file mode 100644 index 00000000000..9fb7b834a97 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.gitignore @@ -0,0 +1,5 @@ +*.log* +/TestBundleDeactivate.txt +/coverage.ec +/lib +/reports diff --git a/dev/com.ibm.ws.kernel.boot_test/.project b/dev/com.ibm.ws.kernel.boot_test/.project new file mode 100755 index 00000000000..fd207f3e333 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.boot_test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..845c3083c7d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +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.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..fadbc117581 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=true +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.boot_test/bnd.bnd b/dev/com.ibm.ws.kernel.boot_test/bnd.bnd new file mode 100755 index 00000000000..5b9fdb80859 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/bnd.bnd @@ -0,0 +1,21 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.kernel.boot;version=latest diff --git a/dev/com.ibm.ws.kernel.boot_test/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.boot_test/bnd.bnd.gradle new file mode 100755 index 00000000000..5b9fdb80859 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/bnd.bnd.gradle @@ -0,0 +1,21 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.kernel.boot;version=latest diff --git a/dev/com.ibm.ws.kernel.boot_test/build-unittest.xml b/dev/com.ibm.ws.kernel.boot_test/build-unittest.xml new file mode 100755 index 00000000000..86cb5c63ace --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/build-unittest.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + Project classpath: ${pcp} + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.kernel.boot_test/build.gradle b/dev/com.ibm.ws.kernel.boot_test/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.kernel.boot_test/delivery.sets b/dev/com.ibm.ws.kernel.boot_test/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.boot_test/launch.bnd b/dev/com.ibm.ws.kernel.boot_test/launch.bnd new file mode 100755 index 00000000000..36e984b875c --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/launch.bnd @@ -0,0 +1,9 @@ +-nouses=true +bVersion=1.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + +Bundle-Name: WebSphere kernel bootstrap launcher +Bundle-SymbolicName: launch +Bundle-Version: ${bVersion} +WebSphere-DefaultKernel: test-kernel-1.0 +WebSphere-DefaultLogProvider: test-logging-1.0 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/Factory.empty b/dev/com.ibm.ws.kernel.boot_test/resources/Factory.empty new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/packages.list b/dev/com.ibm.ws.kernel.boot_test/resources/packages.list new file mode 100755 index 00000000000..73141766e79 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/packages.list @@ -0,0 +1 @@ +not.right.property.name=value \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/bootstrap.properties b/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/bootstrap.properties new file mode 100755 index 00000000000..a9e01451363 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/bootstrap.properties @@ -0,0 +1,15 @@ +# port for the OSGi console +osgi.console=5678 + +# +# OSGi caching +# Equinox will cache information about a running server to speed up +# class resolution when the server is restarted. Alpine and Equinox +# will take steps to ensure that this data is refreshed if bundles in +# the lib directory are updated, but if you are getting a lot of +# messages about missing bundle constraints, and you know the bundle +# in question is well formed, starting with a clean slate may fix +# things up. Uncomment the following ("osgi.clean=true") to force +# equinox to clear cached information before installing or starting +# any bundles. +# osgi.clean=true diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/server.cfg b/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/server.cfg new file mode 100755 index 00000000000..6ffbd599b68 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/serverDefaults/server.cfg @@ -0,0 +1,21 @@ +############################################## +# Default Alpine Configuration +# +# Format: +# group:key value +# or +# group{ +# #a series of +# key value +# } +# where can be: =, -=, +=, >=, or <= +# value can be: +# - String +# - String Array: values enclosed by [] and delimited by , +# - Map of Strings: set of "key=value" value pairs enclosed by {} and delimited by , +# See "Config Parser and Config File Format" document for more details. +############################################## + +com.ibm.ws.kernel.feature:featuresets+=[webcontainer, http, ssl] + +Applications:scanning.enabled=true diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.6.0.properties b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.6.0.properties new file mode 100755 index 00000000000..055dbd0f1b8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.6.0.properties @@ -0,0 +1,3 @@ +# An empty list for testing + +org.osgi.framework.system.packages=1.6.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.7.0.properties b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.7.0.properties new file mode 100755 index 00000000000..e0d682403da --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.7.0.properties @@ -0,0 +1,3 @@ +# An empty list for testing + +org.osgi.framework.system.packages=1.7.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.8.0.properties b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.8.0.properties new file mode 100755 index 00000000000..73fc4869b66 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/resources/system-packages_1.8.0.properties @@ -0,0 +1,3 @@ +# An empty list for testing + +org.osgi.framework.system.packages=1.8.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/simple.bnd b/dev/com.ibm.ws.kernel.boot_test/simple.bnd new file mode 100755 index 00000000000..7f4d4db1b7d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/simple.bnd @@ -0,0 +1,13 @@ +-nouses=true +-resourceonly=true +bVersion=1.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} + +#include the real property file resources +Include-Resource: \ + @${unittest.kernel.boot.jar.name}!/OSGI-OPT/websphere/*.properties diff --git a/dev/com.ibm.ws.kernel.boot_test/simple2.bnd b/dev/com.ibm.ws.kernel.boot_test/simple2.bnd new file mode 100755 index 00000000000..96bf0d4a1a9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/simple2.bnd @@ -0,0 +1,21 @@ +-nouses=true +-resourceonly=true +bVersion=2.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} +WebSphere-DefaultKernel: test-kernel-2.0 + +# For each exported package, create (in that package) a package-info.java +# file, and place an @version javadoc tag in package-level javadoc. +# Append ";provide:=true" if this bundle also provides an implementation +# for the exported API. +Export-Package: com.ibm.ws.kernel.launch.service;provide:=true + +#Include dummy resources for system-packages +Include-Resource: \ + OSGI-OPT/websphere=resources diff --git a/dev/com.ibm.ws.kernel.boot_test/simple3.bnd b/dev/com.ibm.ws.kernel.boot_test/simple3.bnd new file mode 100755 index 00000000000..93cf8514f67 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/simple3.bnd @@ -0,0 +1,13 @@ +-nouses=true +-resourceonly=true +bVersion=3.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} +WebSphere-DefaultKernel: test-kernel-2.0 + +## It is important that the pacakges.list file does not actually exist in the generated bundle.. +# because this is testing missing system packages so we don't include them here! diff --git a/dev/com.ibm.ws.kernel.boot_test/simple4.bnd b/dev/com.ibm.ws.kernel.boot_test/simple4.bnd new file mode 100755 index 00000000000..d182b3af5e7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/simple4.bnd @@ -0,0 +1,13 @@ +-nouses=true +-resourceonly=true +bVersion=4.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} +WebSphere-DefaultKernel: test-kernel-2.0 + +#mock up a 1.6.0 package list from the package.list with a bad property +Include-Resource: OSGI-OPT/websphere/system-packages_1.6.0.properties=resources/packages.list diff --git a/dev/com.ibm.ws.kernel.boot_test/simple5.bnd b/dev/com.ibm.ws.kernel.boot_test/simple5.bnd new file mode 100755 index 00000000000..90506590396 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/simple5.bnd @@ -0,0 +1,13 @@ +-nouses=true +-resourceonly=true +bVersion=5.0 +-output ${bnd.target}/${Bundle-SymbolicName}_${bVersion}.jar + +Bundle-Name: simple bundle +Bundle-SymbolicName: simple +Bundle-Version: ${bVersion} +Bundle-Description: simple, version ${bVersion} + +#Include dummy resources for system-packages +Include-Resource: \ + OSGI-OPT/websphere=resources \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/BootstrapConfigTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/BootstrapConfigTest.java new file mode 100755 index 00000000000..50c96f777ee --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/BootstrapConfigTest.java @@ -0,0 +1,782 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * Change activity: + * + * Issue Date Name Description + * ----------- ----------- --------- ------------------------------------ + * Initial version + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.Field; +import java.security.PrivilegedExceptionAction; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.xml.parsers.DocumentBuilderFactory; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assume; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import test.common.SharedOutputManager; +import test.shared.Constants; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.internal.BootstrapConstants; +import com.ibm.ws.kernel.boot.internal.BootstrapConstants.VerifyServer; + +/** + * + */ +public class BootstrapConfigTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + static final File defaultServer = new File(Constants.TEST_TMP_ROOT, "defaultServer"); + + @Rule + public TestName testName = new TestName(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() { + TestUtils.cleanTempFiles(); + } + + @AfterClass + public static void tearDownAfterClass() { + TestUtils.cleanTempFiles(); + } + + Map initProps = new HashMap(); + BootstrapConfig bc = new TestBootstrapConfig(initProps); + + @Before + public void setUp() { + Constants.TEST_TMP_ROOT_FILE.mkdirs(); + + // Create server/workarea directories... + defaultServer.mkdirs(); + } + + @After + public void tearDown() throws Exception { + initProps.clear(); + TestUtils.cleanTempFiles(); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#mergeProperties(java.util.Map, java.net.URL, java.lang.String)} . + */ + @Test + public void testMergeProperties() { + + try { + File f1 = new File(Constants.TEST_PLATFORM_DIR + "include.properties"); + + // Test system property value override: compare with testProcessIncludes, + // which just looks for original value un-influenced by system properties + System.setProperty("override", "systemProperty"); + bc.mergeProperties(initProps, null, f1.toURI().toString()); + assertEquals("System property value should win", "systemProperty", bc.get("override")); + assertEquals("Peer file should be found", "found", bc.get("peer")); + assertEquals("Relative file should be found", "found", bc.get("relative")); + } finally { + System.clearProperty("override"); + } + } + + @Test + public void testMergePropertiesBadURL() { + Map map = new HashMap(); + + try { + bc.mergeProperties(map, null, "unknown:junk"); + fail("Expected location exception was not thrown"); + } catch (LocationException e) { + System.out.println(BootstrapConstants.messages.getString("error.badLocation")); + System.out.println(e.getTranslatedMessage()); + + // unable to resolve locations + assertTrue(outputMgr.checkForStandardOut("CWWKE0004E")); + // malformed URI for bootstrap properties + assertTrue(outputMgr.checkForStandardOut("CWWKE0008E")); + } + } + + @Test + public void testMergePropertiesBadFile() { + Map map = new HashMap(); + + try { + bc.mergeProperties(map, null, new File(Constants.TEST_PLATFORM_DIR + "notexist").toURI().toString()); + } catch (LocationException ex) { + assertTrue(ex.getTranslatedMessage().contains("CWWKE0014E")); + } + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#addMissingProperties(java.util.Properties, java.util.Map)} . + */ + @Test + public void testAddMissingProperties() { + final String key1 = "existingKey", value1 = "existingValue", key2 = "newKey", value2 = "newValue", value3 = "replaceValue"; + + initProps.put(key1, value1); + + Properties source = new Properties(); + // add replacement value; should be ignored + source.setProperty(key1, value3); + source.setProperty(key2, value2); + + bc.addMissingProperties(source, initProps); + + assertEquals("Original value should be preserved", value1, initProps.get(key1)); + assertEquals("New key should be set", value2, initProps.get(key2)); + + // Should not blow up w/ null/empty source or target + bc.addMissingProperties(null, initProps); + source.clear(); + bc.addMissingProperties(source, initProps); + bc.addMissingProperties(source, null); + + // Should not blow up w/ zero-length key + source.setProperty("", "blah"); + bc.addMissingProperties(source, initProps); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#processIncludes(java.util.Map, java.net.URL, java.lang.String)} . Most valid paths are tested via + * mergeProperties + */ + @Test + public void testProcessIncludes() { + bc.processIncludes(initProps, null, null); + + File f1 = new File(Constants.TEST_PLATFORM_DIR + "include.properties"); + String fname = f1.toURI().toString(); + bc.processIncludes(initProps, null, fname + " "); + // Compare with testMergeProperties + assertEquals("Original value should be present", "original", bc.get("override")); + assertEquals("Peer file should be found", "found", bc.get("peer")); + assertEquals("Relative file should be found", "found", bc.get("relative")); + + bc.processIncludes(initProps, null, fname + " ,\t" + fname); + } + + /** + * Expect an IllegalArgumentException when null is passed to configure Test + * method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#configure(java.util.Map)}. + */ + @Test(expected = IllegalArgumentException.class) + public void testConfigureNull() { + TestBootstrapConfig bc = new TestBootstrapConfig(); + + // configure(map) + bc.configure(null); + } + + /** + * Expect a LocationException when an unresolvable file is used as install dir + * + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#configure(java.util.Map)}. + * + * @throws IOException + */ + @Test(expected = com.ibm.ws.kernel.boot.LocationException.class) + public void testConfigureBadLocation() throws IOException { + String fName = "InstallDirAsFile"; + File file = new File(Constants.TEST_TMP_ROOT, fName); + file.createNewFile(); + file.deleteOnExit(); + + TestBootstrapConfig bc = new TestBootstrapConfig(); + bc.findLocations(testName.getMethodName(), file.getAbsolutePath(), null, null, null); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#configure(java.util.Map)}. + */ + @Test + public void testFindLocations() throws Exception { + File test1 = new File(Constants.TEST_TMP_ROOT, "test1"); + + try { + + bc = new TestBootstrapConfig(); + bc.findLocations(null, null, null, null, null); + + bc.printLocations(false); // print locations: no formatting + assertTrue("Bootstrap lib dir should be a directory (not a jar)", bc.bootstrapLib.isDirectory()); + + checkDirs("A", bc); + assertEquals("A: Default server name", BootstrapConstants.DEFAULT_SERVER_NAME, bc.getProcessName()); + assertEquals("A: installRoot should be parent of bootstrap lib", bc.installRoot, bc.bootstrapLib.getParentFile()); + assertEquals("A: userRoot should be child of installRoot", bc.installRoot, bc.userRoot.getParentFile()); + assertEquals("A: processesRoot should be a child of the userRoot", bc.userRoot, bc.processesRoot.getParentFile()); + assertEquals("A: configDir should be a child of the processesRoot", bc.processesRoot, bc.configDir.getParentFile()); + assertSame("A: outputRoot should be same as processesRoot", bc.processesRoot, bc.outputRoot); + assertSame("A: outputDir should be same as configDir", bc.configDir, bc.outputDir); + + bc = new TestBootstrapConfig(); + bc.findLocations(testName.getMethodName(), test1.getAbsolutePath(), null, null, null); + + checkDirs("B", bc); + assertEquals("B: userRoot should match userDir parameter", test1.getCanonicalFile(), bc.userRoot.getCanonicalFile()); + assertEquals("B: processesRoot should be a child of the userRoot", bc.userRoot, bc.processesRoot.getParentFile()); + assertEquals("B: configDir should be a child of the processesRoot", bc.processesRoot, bc.configDir.getParentFile()); + assertEquals("B: getServerFile(null) should return configDir", bc.configDir, bc.getConfigFile(null)); + + assertSame("B: outputRoot should be same as processesRoot", bc.processesRoot, bc.outputRoot); + assertSame("B: outputDir should be same as configDir", bc.configDir, bc.outputDir); + assertEquals("B: getServerOutputFile(null) should return outputDir", bc.outputDir, bc.getOutputFile(null)); + + // Now test for the output dir split: we now have two trees... (one shorter + // than the other.. ) + bc = new TestBootstrapConfig(); + bc.findLocations(testName.getMethodName(), null, test1.getAbsolutePath(), null, null); + + checkDirs("C", bc); + assertEquals("C: userRoot should be child of installRoot", bc.installRoot, bc.userRoot.getParentFile()); + assertEquals("C: processesRoot should be a child of the userRoot", bc.userRoot, bc.processesRoot.getParentFile()); + assertEquals("C: configDir should be a child of the processesRoot", bc.processesRoot, bc.configDir.getParentFile()); + assertEquals("C: getServerFile(null) should return configDir", bc.configDir, bc.getConfigFile(null)); + + assertEquals("C: outputRoot should match outputDir parameter", test1.getCanonicalFile(), bc.outputRoot.getCanonicalFile()); + assertEquals("C: outputDir should be a child of the outputRoot", bc.outputRoot, bc.outputDir.getParentFile()); + assertEquals("C: getServerOutputFile(null) should return outputDir", bc.outputDir, bc.getOutputFile(null)); + + assertEquals("C: getLogDiretory() should be a child of outputDir", bc.getOutputFile("logs"), bc.getLogDirectory()); + + // Now test for a separate log directory + bc = new TestBootstrapConfig(); + bc.findLocations(testName.getMethodName(), null, null, test1.getAbsolutePath(), null); + + checkDirs("D", bc); + assertEquals("D: userRoot should be child of installRoot", bc.installRoot, bc.userRoot.getParentFile()); + assertEquals("D: processesRoot should be a child of the userRoot", bc.userRoot, bc.processesRoot.getParentFile()); + assertEquals("D: configDir should be a child of the processesRoot", bc.processesRoot, bc.configDir.getParentFile()); + assertEquals("D: getServerFile(null) should return configDir", bc.configDir, bc.getConfigFile(null)); + + assertSame("D: outputRoot should be same as processesRoot", bc.processesRoot, bc.outputRoot); + assertSame("D: outputDir should be same as configDir", bc.configDir, bc.outputDir); + assertEquals("D: getServerOutputFile(null) should return outputDir", bc.outputDir, bc.getOutputFile(null)); + + assertEquals("D: getLogDiretory() should match logDir parameter", test1.getCanonicalFile(), bc.getLogDirectory().getCanonicalFile()); + + initProps.clear(); + + // Make sure system properties are ignored + System.setProperty(BootstrapConstants.LOC_PROPERTY_INSTANCE_DIR, test1.getAbsolutePath()); + bc = new TestBootstrapConfig(); + // configure(map, userDir, outputDir, logDir) + bc.findLocations(testName.getMethodName(), null, null, null, null); + + // This set should be identical to the conditions used in A (i.e. the defaults, + // as null is passed in as a parameters) + checkDirs("E", bc); + assertEquals("E: userRoot should be child of installRoot", bc.installRoot, bc.userRoot.getParentFile()); + assertEquals("E: processesRoot should be a child of the userRoot", bc.userRoot, bc.processesRoot.getParentFile()); + assertEquals("E: configDir should be a child of the processesRoot", bc.processesRoot, bc.configDir.getParentFile()); + assertSame("E: outputRoot should be same as processesRoot", bc.processesRoot, bc.outputRoot); + assertSame("E: outputDir should be same as configDir", bc.configDir, bc.outputDir); + + } finally { + TestUtils.cleanTempFiles(test1); + System.clearProperty(BootstrapConstants.LOC_PROPERTY_INSTANCE_DIR); + System.clearProperty(BootstrapConstants.LOC_PROPERTY_INSTALL_DIR); + } + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.BootstrapConfig#setSystemProperties()}. + */ + @Test + public void testSetSystemProperty() { + final String key1 = "existingKey", value1 = "existingValue", key2 = "newKey", value2 = "newValue", nonExistentKey = "nonExistentKey"; + + String javaSecurityProp = "websphere.java.security"; + + bc.setSystemProperties(); + assertNull("System property test value did not return null as expected.", System.getProperty(key1)); + assertNull("System property test value did not return null as expected.", System.getProperty(key2)); + assertNull("Non existent system property did not return null as expected.", System.getProperty(nonExistentKey)); + assertNull("Websphere Java security property did not return null as expected.", System.getProperty(javaSecurityProp)); + + initProps.put(key1, value1); + initProps.put(key2, value2); + bc.setSystemProperties(); + assertEquals("System property test value did not equal expected value.", value1, System.getProperty(key1)); + assertEquals("System property test value did not equal expected value.", value2, System.getProperty(key2)); + assertNull("Non existent system property did not return null as expected.", System.getProperty(nonExistentKey)); + assertNull("System property " + javaSecurityProp + " did not return null as expected.", System.getProperty(javaSecurityProp)); + + initProps.put(javaSecurityProp, "true"); + bc.setSystemProperties(); + assertEquals("System property test value did not equal expected value.", value1, System.getProperty(key1)); + assertEquals("System property test value did not equal expected value.", value2, System.getProperty(key2)); + assertNull("Non existent system property did not return null as expected.", System.getProperty(nonExistentKey)); + assertNull("System property " + javaSecurityProp + " did not return null as expected.", System.getProperty(javaSecurityProp)); + } + + /** + * Prepare a server directory and BootstrapConfig for verification. + */ + private BootstrapConfig prepareServer(String serverName) { + File usrDir = new File(Constants.TEST_TMP_ROOT); + File serverDir = new File(usrDir, "servers" + File.separatorChar + serverName); + TestUtils.cleanTempFiles(serverDir); + bc = new BootstrapConfig(); + bc.findLocations(serverName, Constants.TEST_TMP_ROOT, null, null, null); + return bc; + } + + private static final String[] SERVER_NAMES = new String[] { "defaultServer", "newServer" }; + + private BootstrapConfig prepareDefaultServer() { + return prepareServer("defaultServer"); + } + + private BootstrapConfig prepareNewServer() { + return prepareServer("newServer"); + } + + /** + * The type of templates that can be used when creating a server. + */ + private enum ServerTemplateType { + /** Liberty templates (wlp/templates/servers/defaultServer/) */ + LIBERTY, + /** --template=test (files created by {@link #runTemplateTest}) */ + TEST, + /** Kernel template (boot JAR, used when no other templates found) */ + KERNEL, + } + + /** + * Prepare bootstrap statics to allow templates to be found, and then run + * the specified action. + */ + private void withMockTemplatesDirectory(ServerTemplateType templateType, PrivilegedExceptionAction action) throws Exception { + File installDir; + switch (templateType) { + case TEST: + installDir = new File(Constants.TEST_TMP_ROOT_FILE, "install"); + break; + case LIBERTY: + installDir = new File(Constants.BOOTSTRAP_PUBLISH_DIR); + break; + default: + throw new IllegalArgumentException(String.valueOf(templateType)); + } + + TestUtils.setKernelUtilsBootstrapLibDir(new File(installDir, "lib")); + try { + if (templateType == ServerTemplateType.TEST) { + File templateDir = new File(installDir, "templates/servers/test"); + assertTrue("created " + templateDir, templateDir.mkdirs()); + PrintWriter pw = new PrintWriter(new File(templateDir, "server.xml"), "UTF-8"); + pw.println(""); + pw.close(); + } + + action.run(); + } finally { + TestUtils.setKernelUtilsBootstrapLibDir(null); + } + } + + /** + * Analyze server.xml to determine which server template was used. + */ + private ServerTemplateType getServerTemplateType(File serverConfig) throws Exception { + Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new FileInputStream(serverConfig)); + Element element = doc.getDocumentElement(); + assertEquals("server", element.getNodeName()); + + if ("test".equals(element.getAttribute("description"))) { + // A test server.xml create by runTemplateTest above. + return ServerTemplateType.TEST; + } + + if (element.getElementsByTagName("featureManager").getLength() > 0) { + // /com.ibm.ws.kernel.boot/publish/servers/defaultServer/server.xml + // aka wlp/templates/servers/defaultServer/server.xml. + return ServerTemplateType.LIBERTY; + } + + // Otherwise, assume it was the "kernel default" server.xml, which + // (currently?) has no features enabled. + // /com.ibm.ws.kernel.boot/resources/OSGI-OPT/websphere/server/server.xml + // aka wlp/lib/com.ibm.ws.kernel_*.jar!/OSGI-OPT/websphere/server/server.xml + return ServerTemplateType.KERNEL; + } + + /** + * VerifyServer.EXISTS with a missing server = SERVER_NOT_EXIST_STATUS + */ + @Test + public void testVerifyServerExistsError() { + for (String serverName : SERVER_NAMES) { + try { + prepareServer(serverName).verifyProcess(VerifyServer.EXISTS, null); + } catch (LaunchException e) { + assertEquals(ReturnCode.SERVER_NOT_EXIST_STATUS, e.getReturnCode()); + } + } + } + + /** + * VerifyServer.EXISTS after creating should succeed. + */ + @Test + public void testVerifyServerExists() throws Exception { + for (String serverName : SERVER_NAMES) { + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, null); + bc.verifyProcess(VerifyServer.EXISTS, null); + } + } + + /** + * VerifyServer.CREATE should use the default kernel template when creating. + */ + @Test + public void testVerifyServerCreate() throws Exception { + for (String serverName : SERVER_NAMES) { + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, null); + assertEquals(ServerTemplateType.KERNEL, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + } + + /** + * VerifyServer.CREATE should use wlp/templates if present when creating. + */ + @Test + public void testVerifyServerCreateKernelTemplate() throws Exception { + withMockTemplatesDirectory(ServerTemplateType.LIBERTY, new PrivilegedExceptionAction() { + @Override + public Void run() throws Exception { + for (String serverName : SERVER_NAMES) { + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, null); + assertEquals(ServerTemplateType.LIBERTY, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + return null; + } + }); + } + + /** + * VerifyServer.CREATE with invalid --template = LAUNCH_EXCEPTION + error.fileNotFound. + */ + @Test + public void testVerifyServerCreateWithInvalidTemplate() throws Exception { + try { + String[] args = new String[] { "--template=invalid" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + prepareDefaultServer().verifyProcess(VerifyServer.CREATE, new LaunchArguments(cmdArgs, null)); + } catch (LaunchException e) { + assertEquals(ReturnCode.LAUNCH_EXCEPTION, e.getReturnCode()); + assertTrue(e.getTranslatedMessage(), e.getTranslatedMessage().startsWith("CWWKE0054E:")); + } + } + + /** + * VerifyServer.CREATE with --template should use that template. + */ + @Test + public void testVerifyServerCreateWithTemplate() throws Exception { + withMockTemplatesDirectory(ServerTemplateType.TEST, new PrivilegedExceptionAction() { + @Override + public Void run() throws Exception { + for (String serverName : SERVER_NAMES) { + String[] args = new String[] { "--template=test" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, new LaunchArguments(cmdArgs, null)); + assertEquals(ServerTemplateType.TEST, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + return null; + } + }); + } + + /** + * VerifyServer.CREATE after creating a server = REDUNDANT_ACTION_STATUS. + */ + @Test + public void testVerifyServerCreateAlreadyExists() { + for (String serverName : SERVER_NAMES) { + try { + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, null); + bc.verifyProcess(VerifyServer.CREATE, null); + } catch (LaunchException e) { + assertEquals(ReturnCode.REDUNDANT_ACTION_STATUS, e.getReturnCode()); + } + } + } + + /** + * VerifyServer.CREATE_DEFAULT should use the default kernel template when + * creating defaultServer. + */ + @Test + public void testVerifyServerCreateDefaultKernelTemplate() throws Exception { + prepareDefaultServer().verifyProcess(VerifyServer.CREATE_DEFAULT, null); + assertEquals(ServerTemplateType.KERNEL, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + + /** + * VerifyServer.CREATE_DEFAULT should use wlp/templates if present when + * creating defaultServer. + */ + @Test + public void testVerifyServerCreateDefaultLibertyTemplate() throws Exception { + withMockTemplatesDirectory(ServerTemplateType.LIBERTY, new PrivilegedExceptionAction() { + @Override + public Void run() throws Exception { + prepareDefaultServer().verifyProcess(VerifyServer.CREATE_DEFAULT, null); + assertEquals(ServerTemplateType.LIBERTY, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + return null; + } + }); + } + + /** + * VerifyServer.CREATE_DEFAULT should ignore --template when creating + * defaultServer. + */ + @Test + public void testVerifyServerCreateDefaultWithTemplate() throws Exception { + // This will fail if CREATE_DEFAULT erroneously checks --template. + String[] args = new String[] { "--template=invalid" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + prepareDefaultServer().verifyProcess(VerifyServer.CREATE_DEFAULT, new LaunchArguments(cmdArgs, null)); + assertEquals(ServerTemplateType.KERNEL, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + + /** + * VerifyServer.CREATE_DEFAULT should ignore --template when creating + * defaultServer, even if an empty directory already exists. + */ + @Test + public void testVerifyServerCreateDefaultForEmptyDirWithTemplate() throws Exception { + assertTrue("created server directory", prepareDefaultServer().getConfigFile(null).mkdirs()); + // This will fail if CREATE_DEFAULT erroneously checks --template. + String[] args = new String[] { "--template=invalid" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + bc.verifyProcess(VerifyServer.CREATE_DEFAULT, new LaunchArguments(cmdArgs, null)); + assertEquals(ServerTemplateType.KERNEL, getServerTemplateType(bc.getConfigFile(BootstrapConstants.SERVER_XML))); + } + + /** + * VerifyServer.CREATE_DEFAULT is like EXISTS for non-defaultServer: + * non-existent server = SERVER_NOT_EXIST_STATUS + */ + @Test + public void testVerifyServerCreateDefaultError() { + try { + prepareNewServer().verifyProcess(VerifyServer.CREATE_DEFAULT, null); + } catch (LaunchException e) { + assertEquals(ReturnCode.SERVER_NOT_EXIST_STATUS, e.getReturnCode()); + } + } + + /** + * VerifyServer.CREATE_DEFAULT is a no-op for an existing server. + */ + @Test + public void testVerifyServerCreateDefaultAlreadyExists() { + for (String serverName : SERVER_NAMES) { + prepareServer(serverName).verifyProcess(VerifyServer.CREATE, null); + bc.verifyProcess(VerifyServer.CREATE_DEFAULT, null); + } + } + + /** + * VerifyServer.SKIP (or null) is a no-op regardless of whether or not + * the server exists. + */ + @Test + public void testVerifyServerSkip() throws Exception { + for (String serverName : SERVER_NAMES) { + prepareServer(serverName).verifyProcess(null, null); + bc.verifyProcess(VerifyServer.SKIP, null); + + // Create the server and try again. + bc.verifyProcess(VerifyServer.CREATE, null); + bc.verifyProcess(null, null); + bc.verifyProcess(VerifyServer.SKIP, null); + } + } + + @Test + public void testNewServer() throws Exception { + File commonFile = new File(Constants.TEST_TMP_ROOT); + File newServerDir = new File(commonFile, "servers/newServer"); + + try { + TestUtils.cleanTempFiles(newServerDir); + + // Find the new server (includes mapping to canonical name, etc.) + bc = new BootstrapConfig(); + bc.findLocations("newServer", Constants.TEST_TMP_ROOT, null, null, null); + System.out.println(newServerDir.toURI().toString()); + + // Invoke configure with property indicating that the server should be created + bc.verifyProcess(VerifyServer.CREATE, null); + + assertTrue("I: new server should have been created", newServerDir.exists() && newServerDir.isDirectory()); + assertEquals("I: intended server should be created", newServerDir.getCanonicalFile(), bc.configDir.getCanonicalFile()); + + File sFile = new File(bc.configDir, "server.xml"); + assertTrue("I: new server should have server.xml file created", sFile.exists() && sFile.isFile()); + } finally { + TestUtils.cleanTempFiles(newServerDir.getParentFile()); // servers dir + } + } + + @Test + public void testServerNameCaseSensitivity() { + + File serversDir = new File(Constants.TEST_TMP_ROOT_FILE, "servers"); + File newServerDir = new File(serversDir, "newServer"); + File newserverDir = new File(serversDir, "newserver"); + + try { + TestUtils.cleanTempFiles(newServerDir); + TestUtils.cleanTempFiles(newserverDir); + + // Create a server named "newServer" + + // find locations first + bc = new BootstrapConfig(); + bc.findLocations("newServer", Constants.TEST_TMP_ROOT, null, null, null); + + // configure / create the server + initProps.clear(); + bc.verifyProcess(VerifyServer.CREATE, null); + + // This test cannot proceed unless the file system is case-insensitive. + Assume.assumeTrue(newserverDir.exists()); + + // Configure a server named "newserver". + bc = new BootstrapConfig(); + bc.findLocations("newserver", Constants.TEST_TMP_ROOT, null, null, null); + bc.verifyProcess(VerifyServer.CREATE_DEFAULT, null); + + initProps.clear(); + bc.configure(initProps); + + // Verify that the server is named "newServer". + assertEquals("newServer", bc.getProcessName()); + assertEquals("newServer", bc.getConfigFile(null).getName()); + assertEquals("newServer", bc.getOutputFile(null).getName()); + + // Verify that no framework property contains "newserver" since + // these are all set as system properties. + for (Map.Entry entry : bc.getFrameworkProperties().entrySet()) { + assertFalse("framework property " + entry.getKey() + '=' + entry.getValue(), + entry.getValue().contains("newserver")); + } + } finally { + TestUtils.cleanTempFiles(serversDir); + } + } + + @Test + public void testSetServerName() { + bc.setProcessName("abcdefghijklmnopqrstuvwxyz"); + bc.setProcessName("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + bc.setProcessName("12345567890"); + bc.setProcessName("_-.+"); + bc.setProcessName("+-._"); + } + + @Test(expected = LocationException.class) + public void testSetServerDirBad1() { + bc.setProcessName("bad!"); + } + + @Test(expected = LocationException.class) + public void testSetServerDirBad2() { + bc.setProcessName("bad "); + } + + @Test(expected = LocationException.class) + public void testSetServerDirBad3() { + bc.setProcessName("bad\b"); + } + + @Test(expected = LocationException.class) + public void testSetServerDirBad4() { + bc.setProcessName(".bad"); + } + + @Test(expected = LocationException.class) + public void testSetServerDirBad5() { + bc.setProcessName("-bad"); + } + + public void checkDirs(String m, BootstrapConfig bc) throws IllegalArgumentException, IllegalAccessException { + // make sure all dirs are set.. use reflection so that we catch if we + // missed + // one.. + Field fields[] = BootstrapConfig.class.getDeclaredFields(); + for (Field f : fields) { + if (f.getType().equals(File.class)) { + f.setAccessible(true); + String name = f.getName(); + File file = (File) f.get(bc); + assertNotNull(m + ": File location should be set for " + name, file); + System.out.printf("%18s %s\n", name, file.getAbsolutePath()); + } + } + + // sanity check the calculated directories + assertEquals(bc.outputDir, bc.workarea.getParentFile()); + } + + protected class TestBootstrapConfig extends BootstrapConfig { + TestBootstrapConfig() {} + + TestBootstrapConfig(Map initProps) { + super.initProps = initProps; + } + + @Override + protected void verifyProcess(VerifyServer verify, LaunchArguments args) throws LaunchException {} + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LaunchArgumentsTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LaunchArgumentsTest.java new file mode 100755 index 00000000000..6aa4e292713 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LaunchArgumentsTest.java @@ -0,0 +1,318 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.internal.BootstrapConstants; +import com.ibm.ws.kernel.boot.internal.BootstrapConstants.VerifyServer; + +/** + * + */ +public class LaunchArgumentsTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() { + TestUtils.cleanTempFiles(); + } + + @AfterClass + public static void tearDownAfterClass() { + TestUtils.cleanTempFiles(); + } + + @Test + public void testProcessBatchFileArgs() { + Launcher launcher = new Launcher(); + assertEquals(Arrays.asList(), + launcher.processBatchFileArgs(makeList())); + assertEquals(Arrays.asList("defaultServer"), + launcher.processBatchFileArgs(makeList("defaultServer"))); + assertEquals(Arrays.asList("--batch-file"), + launcher.processBatchFileArgs(makeList("--batch-file"))); + assertEquals(Arrays.asList("--batch-file=--stop"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop"))); + + assertEquals(Arrays.asList("defaultServer"), + launcher.processBatchFileArgs(makeList("--batch-file", "run"))); + assertEquals(Arrays.asList("defaultServer"), + launcher.processBatchFileArgs(makeList("--batch-file", "run", "defaultServer"))); + assertEquals(Arrays.asList("myServer"), + launcher.processBatchFileArgs(makeList("--batch-file", "run", "myServer"))); + assertEquals(Arrays.asList("defaultServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file", "run", "--option"))); + assertEquals(Arrays.asList("defaultServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file", "run", "defaultServer", "--option"))); + assertEquals(Arrays.asList("myServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file", "run", "myServer", "--option"))); + + assertEquals(Arrays.asList("--stop"), + launcher.processBatchFileArgs(makeList("--stop"))); + assertEquals(Arrays.asList("--stop", "defaultServer"), + launcher.processBatchFileArgs(makeList("--stop", "defaultServer"))); + assertEquals(Arrays.asList("--stop", "myServer"), + launcher.processBatchFileArgs(makeList("--stop", "myServer"))); + assertEquals(Arrays.asList("--stop", "--option"), + launcher.processBatchFileArgs(makeList("--stop", "--option"))); + assertEquals(Arrays.asList("--stop", "defaultServer", "--option"), + launcher.processBatchFileArgs(makeList("--stop", "defaultServer", "--option"))); + assertEquals(Arrays.asList("--stop", "myServer", "--option"), + launcher.processBatchFileArgs(makeList("--stop", "myServer", "--option"))); + + assertEquals(Arrays.asList("--stop", "defaultServer"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop"))); + assertEquals(Arrays.asList("--stop", "defaultServer"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop", "defaultServer"))); + assertEquals(Arrays.asList("--stop", "myServer"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop", "myServer"))); + assertEquals(Arrays.asList("--stop", "defaultServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop", "--option"))); + assertEquals(Arrays.asList("--stop", "defaultServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop", "defaultServer", "--option"))); + assertEquals(Arrays.asList("--stop", "myServer", "--option"), + launcher.processBatchFileArgs(makeList("--batch-file=--stop", "stop", "myServer", "--option"))); + } + + /** + * Make sure the command line --clean will override the system property + * value for clean + */ + @Test + public void testParameterClean() { + String[] args = new String[] { "--clean" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + + System.setProperty(BootstrapConstants.INITPROP_OSGI_CLEAN, "none"); + + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("InitProps should contain the value to enable a clean start", + BootstrapConstants.OSGI_CLEAN_VALUE, initProps.get(BootstrapConstants.INITPROP_OSGI_CLEAN)); + assertNull("The system property value should be removed, as overridden by command line", + System.getProperty(BootstrapConstants.OSGI_CLEAN_VALUE)); + assertEquals("VerifyServer should be CREATE_DEFAULT for default start action", + VerifyServer.CREATE_DEFAULT, rc.getVerifyServer()); + } + + /** + * Make sure the command line --autoAcceptSigner will override the system property + * value for SSL auto-accept-signer-certificate. + */ + @Test + public void testParameterAutoAcceptSigner() { + String[] args = new String[] { "--autoAcceptSigner" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + + System.setProperty(BootstrapConstants.AUTO_ACCEPT_SIGNER, "false"); + + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps, true); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("InitProps should contain the value to enable a clean start", + "true", initProps.get(BootstrapConstants.AUTO_ACCEPT_SIGNER)); + assertEquals("VerifyServer should be CREATE_DEFAULT for default start action", + VerifyServer.CREATE_DEFAULT, rc.getVerifyServer()); + } + + @Test + public void testParameterEmpty() { + String[] args = new String[] {}; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be CREATE_DEFAULT for default start action", + VerifyServer.CREATE_DEFAULT, rc.getVerifyServer()); + + assertEquals("We should be ok!", ReturnCode.OK, rc); + } + + /** + */ + @Test + public void testParameterCreate() { + String[] args = new String[] { "--create" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be CREATE for create action", + VerifyServer.CREATE, rc.getVerifyServer()); + assertEquals("We should be set for a create operation", ReturnCode.CREATE_ACTION, rc); + } + + /** + */ + @Test + public void testParameterStop() { + String[] args = new String[] { "--stop" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be EXISTS for stop action", + VerifyServer.EXISTS, rc.getVerifyServer()); + + assertSame("Stop command should return stop action return code", ReturnCode.STOP_ACTION, rc); + } + + /** + */ + @Test + public void testParameterStatus() { + String[] args = new String[] { "--status" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be EXISTS for status action", + VerifyServer.EXISTS, rc.getVerifyServer()); + + assertSame("status command should return status action return code", ReturnCode.STATUS_ACTION, rc); + } + + /** + */ + @Test + public void testParameterStatusStart() { + String[] args = new String[] { "--status:start" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be SKIP for status:start action", + VerifyServer.SKIP, rc.getVerifyServer()); + + assertSame("status:start command should return start status action return code", ReturnCode.START_STATUS_ACTION, rc); + } + + /** + */ + @Test + public void testParameterServerName() { + String[] args = new String[] { "name1", "name2" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + + assertSame("status should be ok after double name", ReturnCode.OK, launchArgs.getRc()); + assertTrue("should see a warning about second name", outputMgr.checkForStandardOut("CWWKE0027W")); + } + + @Test + public void testParameterVersion() { + String[] args = new String[] { "--version" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be SKIP for version action", + VerifyServer.SKIP, rc.getVerifyServer()); + + assertEquals("ReturnCode should select version action", ReturnCode.VERSION_ACTION, rc); + } + + @Test + public void testParameterHelp() { + String[] args = new String[] { "--help" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + ReturnCode rc = launchArgs.getRc(); + + assertEquals("VerifyServer should be SKIP for help action", + VerifyServer.SKIP, rc.getVerifyServer()); + + assertEquals("ReturnCode should select help action", ReturnCode.HELP_ACTION, rc); + } + + @Test + public void testParameterHelpArgs() { + String[] args = new String[] { "--script=bin/server", "--help" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + + assertEquals("ReturnCode should select help action", ReturnCode.HELP_ACTION, launchArgs.getRc()); + assertEquals("original argument should be present as an option", "--help", launchArgs.getOption("arg")); + assertEquals("script should be set as an option", "bin/server", launchArgs.getOption("script")); + + args = new String[] { "--help:usage" }; + cmdArgs = new ArrayList(Arrays.asList(args)); + launchArgs = new LaunchArguments(cmdArgs, initProps); + + assertEquals("ReturnCode should select help action", ReturnCode.HELP_ACTION, launchArgs.getRc()); + assertEquals("original argument should be present as an option", "--help:usage", launchArgs.getOption("arg")); + assertNull("script should not be set as an option", launchArgs.getOption("script")); + } + + /** + */ + @Test + public void testParameterUnknownBad() { + String args[] = new String[] { "--garbage" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + + assertSame("status should be BAD_ARGUMENT after garbage argument", ReturnCode.BAD_ARGUMENT, launchArgs.getRc()); + assertTrue("should see a error about bad argument", outputMgr.checkForStandardOut("CWWKE0013E")); + } + + @Test + public void testParameterUnknownSingleDash() { + String args[] = new String[] { "-garbage" }; + List cmdArgs = new ArrayList(Arrays.asList(args)); + Map initProps = new HashMap(); + LaunchArguments launchArgs = new LaunchArguments(cmdArgs, initProps); + + assertSame("status should be BAD_ARGUMENT after garbage argument", ReturnCode.BAD_ARGUMENT, launchArgs.getRc()); + assertTrue("should see a error about bad argument", outputMgr.checkForStandardOut("CWWKE0013E")); + } + + private List makeList(String... args) { + return new ArrayList(Arrays.asList(args)); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LauncherTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LauncherTest.java new file mode 100755 index 00000000000..20ec2b8c602 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/LauncherTest.java @@ -0,0 +1,205 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2009, 2013 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.PrintStream; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import com.ibm.ws.kernel.boot.internal.BootstrapConstants; +import com.ibm.ws.kernel.boot.internal.FileUtils; + +import test.common.SharedOutputManager; +import test.shared.Constants; +import test.shared.TestUtils; + +public class LauncherTest { + static final File defaultServer = new File(Constants.TEST_TMP_ROOT, "usr/servers/defaultServer"); + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() { + TestUtils.cleanTempFiles(); + } + + @AfterClass + public static void tearDownAfterClass() { + TestUtils.cleanTempFiles(); + } + + TestLauncher tlauncher = new TestLauncher(); + BootstrapConfig config = new BootstrapConfig(); + + // Grab streams set by SharedOutputManager + PrintStream outputMgrOut; + PrintStream outputMgrErr; + + @Before + public void setUp() { + outputMgr.resetStreams(); + Set keys = System.getProperties().stringPropertyNames(); + for (String key : keys) { + // Restrict the system properties we pick up and pass to the + // framework for launch + if (key.contains("osgi") || key.contains("was") || key.contains("equinox")) + System.clearProperty(key); + } + + outputMgrOut = System.out; + outputMgrErr = System.err; + + // Create server/workarea directories... + defaultServer.mkdir(); + } + + @After + public void tearDown() { + tlauncher.fakeEnv.clear(); + FileUtils.recursiveClean(defaultServer); + } + + @Test + public void testHardCodedMainClass() throws Exception { + File bootJar = TestUtils.findBuiltKernelBundle(); + URLClassLoader loader = new URLClassLoader(new URL[] { bootJar.toURI().toURL() }, null); + // Our main class is not API/SPI, but we do hard code it in several + // places, so we use this test to ensure they're all updated. + // - /com.ibm.ws.kernel.boot/build.xml + // - wlp/bin/tools/ws-server.jar!/META-INF/MANIFEST.MF Main-Class + // - wlp/lib/ws-launch.jar!/META-INF/MANIFEST.MF Main-Class + // - /com.ibm.zos.native/server_launcher.c + // - CMVC NATV/ws/code/os400.native/src/script/qwlpstrsvr.cpp + loader.loadClass("com.ibm.ws.kernel.boot.cmdline.EnvCheck"); + } + + @Test + public void testParameterVersion() throws Exception { + String[] args = new String[] { "--version" }; + + // This needs to crack open a manifest for a jar, so feed it a jar... + TestUtils.setKernelUtilsBootstrapJar(TestUtils.findBuiltKernelBundle()); + TestUtils.setKernelUtilsBootstrapLibDir(Constants.TEST_DIST_DIR_FILE); + TestUtils.setUtilsInstallDir(Constants.TEST_DATA_FILE); + + try { + int rc = tlauncher.createPlatform(args); + assertEquals(ReturnCode.OK.val, rc); + assertTrue(outputMgr.checkForStandardOut("WebSphere Application Server")); // config-root + // message + } finally { + TestUtils.setKernelUtilsBootstrapJar(null); + TestUtils.setKernelUtilsBootstrapLibDir(null); + TestUtils.setUtilsInstallDir(null); + } + } + + @Test + public void testParameterHelp() { + String[] args = new String[] { "--help" }; + + int rc = tlauncher.createPlatform(args); + assertEquals(ReturnCode.OK.val, rc); + assertTrue("ws-server.jar should be displayed for java -jar help", outputMgr.checkForStandardOut("ws-server.jar")); + + // More detailed testing of help is done in LauncherVerificationTest BVT + // because script vs. not-script is determined by an env variable.. + } + + /** + */ + @Test + public void testParameterUnknownBad() { + String args[] = new String[] { "--garbage" }; + + int rc = tlauncher.createPlatform(args); + assertTrue(outputMgr.checkForStandardOut("CWWKE0013E")); + assertEquals(ReturnCode.BAD_ARGUMENT.val, rc); + } + + /** + * When launched with --version, we still read the initial configuration + * and environment variables: use that to verify that we *are* reading + * the environment variables so we don't have to deal with launchPlatform. + */ + @Test + public void testFindLocationsEnv() { + final String m = "testFindLocationsEnv"; + + try { + File log_dir = TestUtils.createTempDirectory("log_dir"); + File x_log_dir = TestUtils.createTempDirectory("x_log_dir"); + BootstrapConfig bootProps = new BootstrapConfig(); + + // add a fake environment variable for the private/calculated temp dir X_LOG_DIR + tlauncher.fakeEnv.put(BootstrapConstants.ENV_X_LOG_DIR, x_log_dir.getCanonicalPath()); + + tlauncher.findLocations(bootProps, "defaultServer"); + assertEquals("The logDirectory value should be value of X_LOG_DIR", + x_log_dir.getCanonicalPath(), + bootProps.getLogDirectory().getCanonicalPath()); + + // add a fake environment variable for the LOG_DIR. This value should be ignored because X_LOG_DIR exists. + tlauncher.fakeEnv.put(BootstrapConstants.ENV_LOG_DIR, log_dir.getCanonicalPath()); + tlauncher.findLocations(bootProps, "defaultServer"); + assertEquals("The logDirectory value should be value of X_LOG_DIR", + x_log_dir.getCanonicalPath(), + bootProps.getLogDirectory().getCanonicalPath()); + + // clear out the value of X_LOG_DIR. Now the logDirectory should use LOG_DIR + tlauncher.fakeEnv.remove(BootstrapConstants.ENV_X_LOG_DIR); + tlauncher.findLocations(bootProps, "defaultServer"); + assertEquals("The logDirectory value should be value of LOG_DIR", + log_dir.getCanonicalPath(), + bootProps.getLogDirectory().getCanonicalPath()); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + TestUtils.cleanTempFiles(); + } + } + + /** + * Simple extension of the launcher for toggling of the behavior of some + * protected/internal methods in order to control code coverage in the + * parent. + */ + class TestLauncher extends Launcher { + int exceptionType = 0; + boolean superGetDefs = false; + int fakeJar = 0; + + final Map fakeEnv = new HashMap(); + + @Override + protected String getEnv(String key) { + return fakeEnv.get(key); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/SharedBootstrapConfig.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/SharedBootstrapConfig.java new file mode 100755 index 00000000000..1d506cdd7f2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/SharedBootstrapConfig.java @@ -0,0 +1,72 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import com.ibm.ws.kernel.boot.internal.FileUtils; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +public class SharedBootstrapConfig extends BootstrapConfig { + + public static SharedBootstrapConfig createSharedConfig(SharedOutputManager outputMgr) { + try { + return new SharedBootstrapConfig(); + } catch (IOException e) { + outputMgr.failWithThrowable("createSharedConfig", e); + // unreachable: make compiler happy + throw new RuntimeException(e); + } + } + + public static SharedBootstrapConfig createSharedConfig(SharedOutputManager outputMgr, String serverName) { + try { + return new SharedBootstrapConfig(serverName); + } catch (IOException e) { + outputMgr.failWithThrowable("createSharedConfig", e); + // unreachable: make compiler happy + throw new RuntimeException(e); + } + } + + private SharedBootstrapConfig(String serverName) throws IOException { + this.processName = serverName; + + File root = TestUtils.createTempDirectory(serverName); + if (root == null || !root.exists()) + throw new IllegalArgumentException("root directory does not exist"); + + final String rootDirStr = root.getAbsolutePath(); + + HashMap map = new HashMap(); + + this.findLocations(serverName, rootDirStr, null, null, null); + this.configure(map); + } + + private SharedBootstrapConfig() throws IOException { + this("defaultServer"); + } + + public void setInitProps(Map initProps) { + this.initProps = initProps; + } + + public void cleanServerDir() { + FileUtils.recursiveClean(getConfigFile(null)); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/BootstrapManifestTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/BootstrapManifestTest.java new file mode 100755 index 00000000000..bce5e3c9d85 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/BootstrapManifestTest.java @@ -0,0 +1,291 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FilenameFilter; +import java.util.HashMap; +import java.util.Map; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; +import test.shared.Constants; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.BootstrapConfig; +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; + +/** + * + */ +public class BootstrapManifestTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestName testName = new TestName(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + TestUtils.cleanTempFiles(); + TestUtils.setKernelUtilsBootstrapJar(null); // make sure jar is clear + } + + @AfterClass + public static void tearDownAfterClass() { + TestUtils.cleanTempFiles(); + } + + @After + public void tearDown() throws Exception { + // reset the bootstrap jar... + TestUtils.setKernelUtilsBootstrapJar(null); // make sure jar is clear + } + + @Test + public void testGetDefaults() throws Exception { + BootstrapConfig config = new BootstrapConfig(); + + setBootstrapJar(0); // use a real built jar + BootstrapManifest m = new BootstrapManifest(); + assertNotNull("Bundle version should be set for the kernel.boot jar/bundle", m.getBundleVersion()); + assertEquals("Kernel definition should be set to the name of the default", "kernelCore-1.0", m.getKernelDefinition(config)); + assertEquals("Log provider definition should be set to the name of the default", "defaultLogging-1.0", m.getLogProviderDefinition(config)); + } + + @Test + public void testMissingKernelDefinition() throws Exception { + BootstrapConfig config = new BootstrapConfig(); + + setBootstrapJar(1); // use a jar with a missing kernel definition + BootstrapManifest m = new BootstrapManifest(); + assertNull("No value should have been found for kernel version", m.getKernelDefinition(config)); // this will throw + assertNull("No value should have been found for log provider", m.getLogProviderDefinition(config)); + } + + @Test + public void testMissingAttributesWithProperties() throws Exception { + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + + setBootstrapJar(1); // use a jar with a missing kernel definition and log provider + + String kernelDef = "kernel_1.x"; + String operatingSystemExtensionsDef = "extension_1.x"; + String logProviderDef = "logging_1.x"; + + Map initProps = new HashMap(); + initProps.put(BootstrapManifest.BOOTPROP_KERNEL, kernelDef); + initProps.put(BootstrapManifest.BOOTPROP_OS_EXTENSIONS, operatingSystemExtensionsDef); + initProps.put(BootstrapManifest.BOOTPROP_LOG_PROVIDER, logProviderDef); + config.setInitProps(initProps); + + BootstrapManifest m = new BootstrapManifest(); + assertEquals("Property was set: Kernel definition should equal provided property value", + kernelDef, m.getKernelDefinition(config)); + assertEquals("Property was set: OS extensions definition should equal provided property value", + operatingSystemExtensionsDef, m.getOSExtensionDefinition(config)); + assertEquals("Property was set: Log provider definition should equal provided property value", + logProviderDef, m.getLogProviderDefinition(config)); + } + + @Test(expected = com.ibm.ws.kernel.boot.LaunchException.class) + public void testMissingSystemPackagesList() throws Exception { + BootstrapConfig config = new BootstrapConfig(); + + // WebSphere-SystemPackages in MANIFEST.MF, points to file not present in bundle/jar + setBootstrapJar(3); + BootstrapManifest m = new BootstrapManifest(); + m.prepSystemPackages(config); + } + + @Test + public void testSystemPackages() throws Exception { + Map initProps = new HashMap(); + + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + config.setInitProps(initProps); + + setBootstrapJar(1); // use a jar with system packages + BootstrapManifest m = new BootstrapManifest(); + m.prepSystemPackages(config); + //the system packages are obtained from a java.version file name + assertNull(initProps.get(BootstrapConstants.INITPROP_OSGI_EXTRA_PACKAGE)); + assertNotNull(initProps.get(BootstrapConstants.INITPROP_OSGI_SYSTEM_PACKAGES)); + } + + @Test + public void testSystemPackagesExtraFromExportPackage() throws Exception { + Map initProps = new HashMap(); + + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + config.setInitProps(initProps); + + // Export-Package in MANIFEST.MF + setBootstrapJar(2); + BootstrapManifest m = new BootstrapManifest(); + m.prepSystemPackages(config); + assertNotNull(initProps.get(BootstrapConstants.INITPROP_OSGI_EXTRA_PACKAGE)); + //system-packages are not null because we included mocked up properties files + assertNotNull(initProps.get(BootstrapConstants.INITPROP_OSGI_SYSTEM_PACKAGES)); + } + + @Test + public void testSystemPackagesJavaVersion() throws Exception { + Map initProps = new HashMap(); + + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + config.setInitProps(initProps); + + setBootstrapJar(5); // use a jar with fake system packages that have version numbers + BootstrapManifest m = new BootstrapManifest(); + m.prepSystemPackages(config); + String sysPkgs = initProps.get(BootstrapConstants.INITPROP_OSGI_SYSTEM_PACKAGES); + + String javaVersion = System.getProperty("java.version"); + // strip off the update modifier + int index = javaVersion.indexOf('_'); + index = (index == -1) ? javaVersion.indexOf('-') : index; + javaVersion = (index == -1) ? javaVersion : javaVersion.substring(0, index); + //validate the system packages obtained match the running java.version file name + assertTrue("The system packages being used do not match the running java.version: " + + javaVersion + + " . This is normal if you are running the test on a version of Java that we support for running the server, but do not fully support. If we are intending to fully support a new Java version then new files are required in /com.ibm.ws.kernel.boot/resources/OSGI-OPT/websphere/system-packages_*.properties for production and /com.ibm.ws.kernel.boot_test/resources/system-packages_*.properties for test.", + sysPkgs.contains(javaVersion)); + + String versionsToCheck = null; + if (javaVersion.equals("1.6.0")) { + versionsToCheck = "1.6.0"; + } else if (javaVersion.equals("1.7.0")) { + versionsToCheck = "1.7.0,1.6.0"; + } else if (javaVersion.equals("1.8.0")) { + versionsToCheck = "1.8.0,1.7.0,1.6.0"; + } else { + fail("The running java version: " + javaVersion + " is newer than we have properties files for, system-packages udpates are required"); + } + + //validate that merging works and we have the older versions too + assertEquals("The system-packages_*.properties files were not merged for multiple java versions.", versionsToCheck, + sysPkgs); + } + + @Test + public void testSystemPackagesFileWrongProperty() throws Exception { + Map initProps = new HashMap(); + + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + config.setInitProps(initProps); + + setBootstrapJar(4); + BootstrapManifest m = new BootstrapManifest(); + m.prepSystemPackages(config); + assertNull(initProps.get(BootstrapConstants.INITPROP_OSGI_EXTRA_PACKAGE)); + assertNull(initProps.get(BootstrapConstants.INITPROP_OSGI_SYSTEM_PACKAGES)); + } + + @Test + public void testGetNormalizedOperatingSystemName() throws Exception { + Map names = new HashMap(); + names.put("AIX", "aix"); + names.put("Digital Unix", "digitalunix"); + names.put("FreeBSD", "freebsd"); + names.put("HP UX", "hpux"); + names.put("Irix", "irix"); + names.put("Linux", "linux"); + names.put("Mac OS", "macos"); + names.put("Mac OS X", "macosx"); + names.put("MPE/iX", "mpeix"); + names.put("Netware 4.11", "netware411"); + names.put("OS/2", "os2"); + names.put("OS/390", "os390"); + names.put("Solaris", "solaris"); + names.put("Windows 2000", "windows2000"); + names.put("Windows 7", "windows7"); + names.put("Windows 8", "windows8"); + names.put("Windows 95", "windows95"); + names.put("Windows 98", "windows98"); + names.put("Windows NT", "windowsnt"); + names.put("Windows NT (unknown)", "windowsntunknown"); + names.put("Windows Server 2012", "windowsserver2012"); + names.put("Windows Vista", "windowsvista"); + names.put("Windows XP", "windowsxp"); + names.put("z/OS", "zos"); + + for (String osName : names.keySet()) { + assertEquals(names.get(osName), BootstrapManifest.getNormalizedOperatingSystemName(osName)); + } + } + + protected static void setBootstrapJar(int jarTestCase) throws Exception { + File root = new File(Constants.TEST_DIST_DIR); + final String filterExpr; + + switch (jarTestCase) { + default: + case 0: + filterExpr = "com.ibm.ws.kernel.boot.*\\.jar"; + root = new File(Constants.BOOTSTRAP_LIB_DIR); + break; + case 1: + // Manifest does not contain default kernel definition / log provider + filterExpr = "simple_1\\.0\\.jar"; + break; + case 2: // Fake jar with manifest that does not contain + // framework/kernel + // definitions + filterExpr = "simple_2\\.0\\.jar"; + break; + case 3: + // Manifest references a system package list that doesn't exist + filterExpr = "simple_3\\.0\\.jar"; + break; + case 4: + // the system packages file exists, but contains + // invalid properties + filterExpr = "simple_4\\.0\\.jar"; + break; + case 5: + // the system packages file exists, but contains + // invalid properties + filterExpr = "simple_5\\.0\\.jar"; + break; + } + + File fileList[] = root.listFiles(new FilenameFilter() + { + @Override + public boolean accept(File dir, String name) + { + return name.matches(filterExpr); + } + }); + + if (fileList == null || fileList.length < 1) + throw new RuntimeException("Unable to find " + filterExpr + " in " + root.getName()); + + TestUtils.setKernelUtilsBootstrapJar(fileList[0]); // set for the test case + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FileUtilsTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FileUtilsTest.java new file mode 100755 index 00000000000..066da6d25bb --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FileUtilsTest.java @@ -0,0 +1,260 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; +import test.shared.Constants; +import test.shared.TestUtils; + +public class FileUtilsTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestName testName = new TestName(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() { + TestUtils.cleanTempFiles(); + } + + @AfterClass + public static void tearDownAfterClass() { + TestUtils.cleanTempFiles(); + } + + @Test + public void testNormalizePathDrive() { + Assume.assumeTrue(File.separatorChar == '\\'); + Assert.assertEquals("", FileUtils.normalizePathDrive("")); + Assert.assertEquals("c", FileUtils.normalizePathDrive("c")); + Assert.assertEquals("C", FileUtils.normalizePathDrive("C")); + Assert.assertEquals("C:", FileUtils.normalizePathDrive("c:")); + Assert.assertEquals("C:", FileUtils.normalizePathDrive("C:")); + Assert.assertEquals("C:\\", FileUtils.normalizePathDrive("c:\\")); + Assert.assertEquals("C:\\", FileUtils.normalizePathDrive("C:\\")); + } + + @Test + public void testGetFile() throws MalformedURLException { + final String m = "testGetFile"; + + URL url; + File result; + String expected; + + try { + // The following strings were printed out from getBootstrapJar + // during debugging... Need to make sure all end up legible... + // (i.e. these strings construct equivalent URLs to what is returned + // from Utils.class.getProtectionDomain().getCodeSource().getLocation()) + + // UNC path with a space. + // The URL for a UNC path is file:////server/path, but the + // deprecated File.toURL() as used by java -jar/-cp incorrectly + // returns file://server/path/, which has an invalid authority + // component. + url = new URL("file://HOST/with%20space/lib/com.ibm.alpine_1.0.jar"); + expected = "//HOST/with space/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // UNC path without a space. + // The URL for a UNC path is file:////server/path, but the + // deprecated File.toURL() as used by java -jar/-cp incorrectly + // returns file://server/path/, which has an invalid authority + // component. + url = new URL("file://HOST/nospace/lib/com.ibm.alpine_1.0.jar"); + expected = "//HOST/nospace/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // Windows path with space + url = new URL("file:/C:/with%20space/lib/com.ibm.alpine_1.0.jar"); + expected = "/C:/with space/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // Windows path without space + url = new URL("file:/C:/nospace/lib/com.ibm.alpine_1.0.jar"); + expected = "/C:/nospace/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // Windows path with a literal + + url = new URL("file:/C:/with+plus/lib/com.ibm.alpine_1.0.jar"); + expected = "/C:/with+plus/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // *nix path with space + url = new URL("file:/with%20space/lib/com.ibm.alpine_1.0.jar"); + expected = "/with space/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // *nix path without space + url = new URL("file:/nospace/lib/com.ibm.alpine_1.0.jar"); + expected = "/nospace/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + + // *nix path with a literal + + url = new URL("file:/with+plus/lib/com.ibm.alpine_1.0.jar"); + expected = "/with+plus/lib/com.ibm.alpine_1.0.jar"; + result = FileUtils.getFile(url); + testResult(url, expected, result); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + outputMgr.restoreStreams(); + } + } + + private void testResult(URL url, String expected, File resultFile) { + File expectedFile = new File(expected); + + System.out.println("--- URL: " + url.toString()); + System.out.println(" expected:\t" + expectedFile); + System.out.println(" result:\t" + resultFile); + + assertEquals(url.toString() + " not converted to path as expected ", expectedFile, resultFile); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.internal.KernelUtils.Utils#recursiveClean(java.io.File)} . + * + * @throws IOException + */ + @Test + public void testRecursiveClean() throws IOException { + + // These shouldn't blow up + FileUtils.recursiveClean(null); + FileUtils.recursiveClean(new File("notexist")); + + // Test recursive clean + File file1, dir2, file3, dir4, file5; + String prefix = "FileTestTmp"; + + file1 = TestUtils.createTempFile(prefix, ".tmp"); + file1.deleteOnExit(); + + dir2 = new File(file1.getParentFile(), prefix); + dir2.mkdirs(); + dir2.deleteOnExit(); + + file3 = TestUtils.createTempFile(prefix, ".tmp", dir2); + + dir4 = new File(dir2, prefix); + dir4.mkdirs(); + dir4.deleteOnExit(); + + file5 = TestUtils.createTempFile(prefix, ".tmp", dir4); + + assertTrue(file1.exists()); + assertTrue(dir2.exists()); + assertTrue(file3.exists()); + assertTrue(file3.getParent().equals(dir2.getPath())); + assertTrue(dir4.exists()); + assertTrue(file5.exists()); + assertTrue(file5.getParent().equals(dir4.getPath())); + + FileUtils.recursiveClean(file1); + assertFalse("File1 should not exist (deleted)", file1.exists()); + assertTrue("Dir2 should exist (untouched)", dir2.exists()); + assertTrue("File3 should exist (untouched)", file3.exists()); + assertTrue("Dir4 should exist (untouched)", dir4.exists()); + assertTrue("File5 should exist (untouched)", file5.exists()); + + FileUtils.recursiveClean(dir2); + assertFalse("Dir2 should not exist (deleted)", dir2.exists()); + assertFalse("File3 should not exist(deleted recursively)", file3.exists()); + assertFalse("Dir4 should exist (deleted)", dir4.exists()); + assertFalse("File5 should exist (deleted)", file5.exists()); + } + + /** + * Test that recursiveClean doesn't blow up with an NPE when a directory can't be read + * + * @throws IOException + */ + @Test + public void testRecursiveCleanNoReadPerms() throws IOException { + File file1, dir2 = null; + try { + // These shouldn't blow up + FileUtils.recursiveClean(null); + FileUtils.recursiveClean(new File("notexist")); + + // Test recursive clean + + String prefix = "FileTestTmp"; + + dir2 = new File(Constants.TEST_TMP_ROOT_FILE, prefix); + dir2.mkdirs(); + dir2.deleteOnExit(); + if (!dir2.setReadable(false)) { + // Platform doesn't support setting readable to false, just return + return; + } + if ("root".equals(System.getProperty("user.name"))) { + // The super-user can't set a file not readable to itself, so just return + return; + } + + file1 = TestUtils.createTempFile(prefix, ".tmp", dir2); + file1.deleteOnExit(); + + assertTrue(file1.exists()); + assertTrue(dir2.exists()); + + boolean cleaned = FileUtils.recursiveClean(dir2); + assertFalse("recursiveClean should report failure", cleaned); + assertTrue("Dir2 should exist (not deleted)", dir2.exists()); + assertTrue("File1 should exist (not deleted)", file1.exists()); + + assertTrue(dir2.setReadable(true)); + assertTrue(dir2.setWritable(true)); + cleaned = FileUtils.recursiveClean(dir2); + assertTrue("recursiveClean should succeed", cleaned); + assertFalse("Dir2 should not exist (deleted)", dir2.exists()); + assertFalse("File1 should not exist (deleted)", file1.exists()); + } finally { + if (dir2 != null) { + dir2.setReadable(true); + dir2.setWritable(true); + } + } + + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FrameworkManagerTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FrameworkManagerTest.java new file mode 100755 index 00000000000..5142481538b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/FrameworkManagerTest.java @@ -0,0 +1,280 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013, 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import java.io.File; +import java.lang.reflect.Field; +import java.util.Collections; +import java.util.HashMap; +import java.util.concurrent.CountDownLatch; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.launch.Framework; + +import com.ibm.ws.kernel.boot.BootstrapConfig; +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; +import com.ibm.ws.kernel.boot.cmdline.Utils; +import com.ibm.ws.kernel.launch.internal.FrameworkManager; +import com.ibm.ws.kernel.launch.service.FrameworkReady; + +import junit.framework.Assert; +import test.common.SharedOutputManager; + +public class FrameworkManagerTest { + @Rule + public final TimeoutRule rule = new TimeoutRule(); + + @Rule + public final SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + private final Mockery mockery = new Mockery(); + Framework framework = mockery.mock(Framework.class); + BundleContext systemBundleContext = mockery.mock(BundleContext.class); + + boolean frameworkStarted; + boolean frameworkStopped; + private Thread launchFrameworkThread; + private Throwable launchFrameworkThrowable; + private File installDirBefore; + + @Before + public void before() throws Exception { + mockery.checking(new Expectations() { + { + allowing(framework).getBundleContext(); + will(returnValue(systemBundleContext)); + allowing(framework).getState(); + will(returnValue(Bundle.ACTIVE)); + + } + }); + + Field f = Utils.class.getDeclaredField("installDir"); + f.setAccessible(true); + installDirBefore = (File) f.get(null); + f.set(null, new File("unittest", "test data")); + } + + @After + public void after() throws Exception { + Field f = Utils.class.getDeclaredField("installDir"); + f.setAccessible(true); + f.set(null, installDirBefore); + + // Previous these tests were using @RunWith(JMock) to check expectations. I switched to asserting + // expectations here because the TimeoutRule will not be called when using @RunWith(JMock) + mockery.assertIsSatisfied(); + } + + private void setupFrameworkReadyServices() throws Exception { + mockery.checking(new Expectations() { + { + allowing(systemBundleContext).getServiceReferences(FrameworkReady.class, null); + will(returnValue(Collections.emptyList())); + } + }); + } + + private void launchFramework(FrameworkManager fm) { + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr); + config.setInitProps(new HashMap()); + fm.launchFramework(config, null); + } + + private void startLaunchFrameworkThread(final FrameworkManager fm) { + launchFrameworkThread = new Thread() { + @Override + public void run() { + try { + launchFramework(fm); + } catch (Throwable t) { + launchFrameworkThrowable = t; + } + } + }; + launchFrameworkThread.start(); + } + + private void joinLaunchFrameworkThread() throws InterruptedException { + launchFrameworkThread.join(); + if (launchFrameworkThrowable != null) { + throw new RuntimeException(launchFrameworkThrowable); + } + } + + @Test + public void testLaunchAndShutdown() throws Throwable { + setupFrameworkReadyServices(); + TestFrameworkManager fm = new TestFrameworkManager(); + + startLaunchFrameworkThread(fm); + fm.waitForReady(); + Assert.assertTrue(frameworkStarted); + + fm.shutdownFramework(); + fm.waitForShutdown(); + Assert.assertTrue(frameworkStopped); + + joinLaunchFrameworkThread(); + } + + @Test + public void testFrameworkReadyService() throws Exception { + mockery.checking(new Expectations() { + { + ServiceReference reference = mockery.mock(ServiceReference.class); + allowing(systemBundleContext).getServiceReferences(with(FrameworkReady.class), with((String) null)); + will(returnValue(Collections.singletonList(reference))); + + FrameworkReady frameworkReady = mockery.mock(FrameworkReady.class); + allowing(systemBundleContext).getService(reference); + will(returnValue(frameworkReady)); + + one(frameworkReady).waitForFrameworkReady(); + } + }); + + TestFrameworkManager fm = new TestFrameworkManager(); + + startLaunchFrameworkThread(fm); + Assert.assertTrue(fm.waitForReady()); + + fm.shutdownFramework(); + fm.waitForShutdown(); + + joinLaunchFrameworkThread(); + } + + @Test + public void testStartFrameworkException() throws Throwable { + TestFrameworkManager fm = new TestFrameworkManager() { + @Override + protected Framework startFramework(BootstrapConfig config) { + throw new TestException(); + } + }; + + try { + launchFramework(fm); + Assert.fail("expected TestException"); + } catch (TestException e) { + } + + Assert.assertFalse(fm.waitForReady()); + Assert.assertFalse(frameworkStarted); + + fm.waitForShutdown(); + Assert.assertFalse(frameworkStopped); + } + + @Test + public void testInnerLaunchFrameworkException() throws Throwable { + setupFrameworkReadyServices(); + + TestFrameworkManager fm = new TestFrameworkManager() { + @Override + protected void innerLaunchFramework(boolean isClient) { + throw new TestException(); + } + }; + + try { + launchFramework(fm); + Assert.fail("expected TestException"); + } catch (TestException e) { + } + + Assert.assertFalse(fm.waitForReady()); + Assert.assertTrue(frameworkStarted); + + fm.waitForShutdown(); + Assert.assertTrue(frameworkStopped); + } + + // Timing out here rather than in the ant script so that we can generate a core using TimeoutRule when + // this hangs. Five minutes is probably excessive, but it's still less than the ant timeout. + // This is here to debug Java Defect 126649 -- once we get a core from that, we can remove this. + @Test(timeout = 300000) + public void testShutdownHook() throws Throwable { + setupFrameworkReadyServices(); + TestFrameworkManager fm = new TestFrameworkManager(); + + startLaunchFrameworkThread(fm); + Assert.assertTrue(fm.waitForReady()); + Assert.assertTrue(frameworkStarted); + + fm.runShutdownHook(); + + fm.waitForShutdown(); + Assert.assertTrue(frameworkStopped); + + joinLaunchFrameworkThread(); + } + + @SuppressWarnings("serial") + private static class TestException extends RuntimeException {} + + private class TestFrameworkManager extends FrameworkManager { + private final CountDownLatch frameworkStoppedLatch = new CountDownLatch(1); + + void runShutdownHook() { + shutdownHook.run(); + } + + @Override + protected Framework startFramework(BootstrapConfig config) throws BundleException { + frameworkStarted = true; + return FrameworkManagerTest.this.framework; + } + + @Override + protected void stopFramework() { + frameworkStopped = true; + frameworkStoppedLatch.countDown(); + } + + @Override + protected void waitForFrameworkStop() { + try { + frameworkStoppedLatch.await(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + + @Override + protected void innerLaunchFramework(boolean isClient) {} + + @Override + protected void startServerCommandListener() {} + + @Override + public boolean waitForReady() throws InterruptedException { + boolean result = super.waitForReady(); + + if (result) { + Assert.assertNotNull(framework); + } + + return result; + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/KernelResolverTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/KernelResolverTest.java new file mode 100755 index 00000000000..9b39491155b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/KernelResolverTest.java @@ -0,0 +1,168 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import java.io.File; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; +import test.shared.DumpTimerRule; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.LaunchException; +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; + +/** + * + */ +public class KernelResolverTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + @Rule + public TestName testName = new TestName(); + + @Rule + public TestRule outputRule = outputMgr; + + @Rule + public TestRule dumpTimerRule = new DumpTimerRule(30000, new File("build/unittest")); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + TestUtils.cleanTempFiles(); + TestUtils.setKernelUtilsBootstrapLibDir(new File("unittest/test data/lbr/lib")); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + TestUtils.cleanTempFiles(); + TestUtils.setKernelUtilsBootstrapLibDir(null); + } + + // Shared configuration places the instance directory in the build dir + SharedBootstrapConfig config = SharedBootstrapConfig.createSharedConfig(outputMgr, "kernelResolver"); + File installDir = config.getInstallRoot(); + + @Test + public void testKernelResolverNoIncludesNoExtensions() throws Exception { + + // Read kernelCore and defaultLogging-- null os extensions + // This should be happy/healthy, and should not throw + KernelResolver resolver = new KernelResolver(installDir, null, "kernelCore-1.0", "defaultLogging-1.0", null); + + final List urlList = new ArrayList(4); + + // Add OSGi framework, log provider, and/or os extension "boot.jar" elements + resolver.addBootJars(urlList); + System.out.println(urlList); + + Assert.assertEquals("Should have two jars in the jar list by default", 2, urlList.size()); + Assert.assertTrue("Should have resolved x.y; version=\"[1.0.0,1.0.100)\"; type=\"boot.jar\" to x.y_1.0.jar", listContains(urlList, "x.y_1.0.jar")); + Assert.assertTrue("Should have resolved a.b; version=\"[1,1.0.100)\"; type=\"boot.jar\" to a.b_1.0.1.v2.jar", listContains(urlList, "a.b_1.0.1.v2.jar")); + Assert.assertEquals("Should have read the log provider from defaultLogging-1.0.jar", "com.ibm.ws.logging.internal.impl.LogProviderImpl", resolver.getLogProvider()); + + // There should be a warning issued about ignoring iFix jar a.b_1.0.2.v1.jar + Assert.assertTrue("Should have a warning message about skipping an iFix jar", outputMgr.checkForStandardOut("CWWKE0060W.*a.b_1.0.2.v1.jar")); + } + + @Test + public void testKernelResolverIncludesNoExtensions() throws Exception { + + // Read kernelCore and defaultLogging-- null os extensions + // This should be happy/healthy, and should not throw + KernelResolver resolver = new KernelResolver(installDir, null, "kernelCore-1.0", "binaryLogging-1.0", null); + + final List urlList = new ArrayList(4); + + resolver.addBootJars(urlList); + System.out.println(urlList); + + // Conditions are mostly the same: the binaryLogging mf includes defaultLogging mf, but the log provider class is different + Assert.assertEquals("Should have two jars in the jar list by default", 2, urlList.size()); + Assert.assertTrue("Should have resolved x.y; version=\"[1.0.0,1.0.100)\"; type=\"boot.jar\" to x.y_1.0.jar", listContains(urlList, "x.y_1.0.jar")); + Assert.assertTrue("Should have resolved a.b; version=\"[1,1.0.100)\"; type=\"boot.jar\" to a.b_1.0.1.v2.jar", listContains(urlList, "a.b_1.0.1.v2.jar")); + Assert.assertEquals("Should have read the log provider from defaultLogging-1.0.mf", "com.ibm.ws.logging.internal.hpel.HpelLogProviderImpl", resolver.getLogProvider()); + } + + @Test + public void testKernelResolverExtensions() { + + // Read kernelCore and defaultLogging-- null os extensions + // This should be happy/healthy, and should not throw + KernelResolver resolver = new KernelResolver(installDir, null, "kernelCore-1.0", "emptyLogging-1.0", "extension-1.0"); + + final List urlList = new ArrayList(4); + + resolver.addBootJars(urlList); + System.out.println(urlList); + + // Conditions are mostly the same: emptyLogging has no boot.jars, but extension-1.0 does + Assert.assertEquals("Should have two jars in the jar list by default", 2, urlList.size()); + Assert.assertTrue("Should have resolved x.y; version=\"[1.0.0,1.0.100)\"; type=\"boot.jar\" to x.y_1.0.jar", listContains(urlList, "x.y_1.0.jar")); + Assert.assertTrue("Should have resolved a.b; version=\"[1,1.0.100)\"; type=\"boot.jar\" to a.b_1.0.1.v2.jar", listContains(urlList, "a.b_1.0.1.v2.jar")); + Assert.assertEquals("Should have read the log provider from emptyLogging-1.0.mf", "dummy.LogProvider", resolver.getLogProvider()); + } + + @Test(expected = LaunchException.class) + public void testKernelResolverNullKernel() { + + // Throw: null kernel definition + new KernelResolver(installDir, null, null, null, null); + } + + @Test(expected = LaunchException.class) + public void testKernelResolverMissingKernel() { + + // Throw: null missing kernel definition + new KernelResolver(installDir, null, "bogus-1.0", null, null); + } + + @Test(expected = LaunchException.class) + public void testKernelResolverNullLogProvider() { + + // Throw: null log provider definition + new KernelResolver(installDir, null, "kernelCore-1.0", null, null); + } + + @Test(expected = LaunchException.class) + public void testKernelResolverMissingLogProvider() { + + // Throw: missing log provider definition + new KernelResolver(installDir, null, "kernelCore-1.0", "bogus-1.0", null); + } + + @Test(expected = LaunchException.class) + public void testKernelResolverMissingBundle() { + + // Throw: we couldn't find one of the specified jars + new KernelResolver(installDir, null, "kernelCore-1.0", "missingJar-1.0", null); + } + + boolean listContains(List urlList, String filename) { + for (URL url : urlList) { + if (url.toString().contains(filename)) + return true; + } + return false; + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerLockTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerLockTest.java new file mode 100755 index 00000000000..1c818db48ac --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerLockTest.java @@ -0,0 +1,263 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; + +import java.io.File; +import java.io.FileOutputStream; +import java.nio.channels.FileChannel; +import java.nio.channels.FileLock; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.LaunchException; +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; +import com.ibm.ws.kernel.boot.cmdline.Utils; + +/** + * + */ +public class ServerLockTest { + static SharedOutputManager outputMgr; + static SharedBootstrapConfig config; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + File f = TestUtils.createTempFile("ResourceUtilsTest", "tmp"); + f.delete(); + f.mkdir(); + + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + + // Bootstrap configuration/locations + config = SharedBootstrapConfig.createSharedConfig(outputMgr); + + outputMgr.captureStreams(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + outputMgr.restoreStreams(); + TestUtils.cleanTempFiles(); + } + + @Before + public void setUp() { + TestUtils.cleanTempFiles(); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.internal.KernelUtils#checkServerLock(java.io.File, java.lang.String)} . + * Additional testing of deleting the lock file at server shutdown + */ + @Test + public void testCheckServerLock() { + final String m = "testCheckServerLock"; + + try { + File sLockFile = config.getWorkareaFile(BootstrapConstants.S_LOCK_FILE); + assertTrue("Parent dirs should exist", sLockFile.getParentFile().exists() || sLockFile.getParentFile().mkdirs()); + + ServerLock serverLock = ServerLock.createServerLock(config); + try { + // get lock for testServer1 + serverLock.obtainServerLock(); + assertTrue("Lock file exists after call to obtain", sLockFile.exists()); + } finally { + serverLock.releaseServerLock(); + sLockFile.delete(); + } + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + if (config != null) { + // This method skips/preserves .sLock files + FileUtils.recursiveClean(config.getWorkareaFile(null)); + } + } + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.internal.KernelUtils#checkServerLock(java.io.File, java.lang.String)} . + * Test permissions surrounding get/obtain server lock + */ + @Test + public void testCheckServerLockPermissions() { + final String m = "testCheckServerLockPermissions"; + + try { + File tmpServerDir = config.getConfigFile(null); + File workArea = config.getWorkareaFile(null); + + // Test a write-only server directory + //we use an assume instead of an assert here because the test has no + //meaning and should be ignored if it could not set the directory to + //be unwritable (e.g. on Windows) + assumeTrue(tmpServerDir.setWritable(false, false)); + try { + // only test behavior with read-only directory if we could make the dir read-only: bug 48667 + if (tmpServerDir.canWrite() == false) { + assertFalse("tmpServerDir() should be false after setWritable(false)", tmpServerDir.canWrite()); + ServerLock.createServerLock(config); + throw new Exception("Missed expected launch exception with unwritable server directory"); + } + } catch (LaunchException le) { + // Expected exception + String translatedMsg = le.getTranslatedMessage(); + assertNotNull("Exception should contain translated message", translatedMsg); + assertTrue("Exception should contain console message CWWKE0044E", translatedMsg.contains("CWWKE0044E")); + assertFalse("Server workarea should not have been created", workArea.isDirectory()); + } finally { + tmpServerDir.setWritable(true, false); + } + + assertTrue("couldn't create workarea", workArea.mkdirs()); + + // Make allocated workarea read-only + assertTrue("must be able to make server workarea unwritable", workArea.setWritable(false, false)); + try { + // only test behavior with read-only directory if we could make the dir read-only: bug 48667 + if (workArea.canWrite() == false) { + assertFalse("workArea.canWrite() should be false after setWritable(false)", workArea.canWrite()); + ServerLock.createServerLock(config); + throw new Exception("Missed expected launch exception with read-only workarea"); + } + } catch (LaunchException le) { + // Expected exception + String translatedMsg = le.getTranslatedMessage(); + assertNotNull("Exception should contain translated message", translatedMsg); + assertTrue("Exception should contain console message CWWKE0044E", translatedMsg.contains("CWWKE0044E")); + } finally { + workArea.setWritable(true, false); + } + + // Allocate lock file, make it read-only + File lockFile = new File(workArea, BootstrapConstants.S_LOCK_FILE); + lockFile.createNewFile(); + assertTrue("must be able to make lockfile unwritable", lockFile.setWritable(false, false)); + try { + // only test behavior with read-only directory if we could make the dir read-only: bug 48667 + if (workArea.canWrite() == false) { + assertFalse("lockFile.canWrite() should be false after setWritable(false)", lockFile.canWrite()); + ServerLock.createServerLock(config); + throw new Exception("Missed expected launch exception with unwritable lock file"); + } + } catch (LaunchException le) { + // Expected exception + String translatedMsg = le.getTranslatedMessage(); + assertNotNull("Exception should contain translated message", translatedMsg); + assertTrue("Exception should contain console message CWWKE0044E", translatedMsg.contains("CWWKE0044E")); + } finally { + lockFile.setWritable(true, false); + } + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + if (config != null) { + FileUtils.recursiveClean(config.getWorkareaFile(null)); + } + } + } + + @Test + public void testCheckServerLockAlreadyLocked() { + final String m = "testCheckServerLockAlreadyLocked"; + + try { + File workArea = config.getWorkareaFile(null); + assertTrue("Parent dirs should exist", workArea.isDirectory() || workArea.mkdirs()); + + ServerLock serverLock = null; + File lockFile = null; + FileOutputStream fos = null; + FileChannel fc = null; + FileLock lock = null; + + try { + serverLock = ServerLock.createServerLock(config); + lockFile = new File(workArea, BootstrapConstants.S_LOCK_FILE); + fos = new FileOutputStream(lockFile); + fc = fos.getChannel(); + lock = fc.lock(); + + // Try to obtain with lock already held. + serverLock.obtainServerLock(); + throw new Exception("Missed expected launch exception: lock already held"); + } catch (LaunchException le) { + // Expected exception + String translatedMsg = le.getTranslatedMessage(); + assertNotNull("Exception should contain translated message", translatedMsg); + assertTrue("Exception should contain console message CWWKE0029E", translatedMsg.contains("CWWKE0029E")); + } finally { + if (lock != null) { + lock.release(); + lockFile.delete(); + } + if (!Utils.tryToClose(fc)) { + Utils.tryToClose(fos); + } + } + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + if (config != null) + FileUtils.recursiveClean(config.getWorkareaFile(null)); + } + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.internal.FileUtils#recursiveClean(java.io.File)} . + * Additional testing of not deleting the lock file. + */ + @Test + public void testRecursiveCleanWithLock() { + final String m = "testRecursiveCleanWithLock"; + + try { + ServerLock.createServerLock(config); + File workarea = config.getWorkareaFile(null); + assertTrue("Parent dirs should exist", workarea.isDirectory() || workarea.mkdirs()); + + File sLockFile = config.getWorkareaFile(BootstrapConstants.S_LOCK_FILE); + File nonLockFile = config.getWorkareaFile("notLock.file"); + + assertTrue(".sLock file should exist pre-test", sLockFile.exists() || sLockFile.createNewFile()); + assertTrue("nonLockFile should exist pre-test", nonLockFile.exists() || nonLockFile.createNewFile()); + + FileUtils.recursiveClean(config.getConfigFile(null)); + + assertFalse("non-lock file should not exist (deleted)", nonLockFile.exists()); + assertTrue("lock file should exist (untouched)", sLockFile.exists()); + assertTrue("workarea directory should exist (untouched-- preserve in-use .sLock file)", workarea.exists()); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerRunningTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerRunningTest.java new file mode 100755 index 00000000000..eebe7919a94 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/ServerRunningTest.java @@ -0,0 +1,131 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; + +/** + * + */ +public class ServerRunningTest { + static SharedOutputManager outputMgr; + static SharedBootstrapConfig config; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + File f = TestUtils.createTempFile("ResourceUtilsTest", "tmp"); + f.delete(); + boolean suc = f.mkdir(); + + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + + // Bootstrap configuration/locations + config = SharedBootstrapConfig.createSharedConfig(outputMgr); + + outputMgr.captureStreams(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + outputMgr.restoreStreams(); + TestUtils.cleanTempFiles(); + } + + /** + * Test to make sure .sRunning file is created and exists as server is running and that it isn't + * deleted as part of a cleaning of workarea. + */ + @Test + public void testServerRunning() { + + final String m = "testServerRunning"; + File sRunningFile = null; + + try { + // Must create parent workarea - server lock code ensures this exists + File serverWorkArea = config.getWorkareaFile(null); + if (!serverWorkArea.exists()) { + boolean suc = serverWorkArea.mkdirs(); + } + + ServerLock.createServerRunningMarkerFile(config); // Unit test runtime code + sRunningFile = config.getWorkareaFile(BootstrapConstants.SERVER_RUNNING_FILE); + assertTrue("Running marker file exists after call to obtain", sRunningFile.exists()); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + if (config != null) { + // This method skips/preserves .sRunning file + FileUtils.recursiveClean(config.getWorkareaFile(null)); + } + } + assertTrue("Running marke file exists after call to clean workspace", sRunningFile.exists()); + } + + /** + * Test to make sure workspace area is cleaned after a JVM ABEND + */ + @Test + public void testServerRunningAfterABEND() { + + final String m = "testServerRunningAfterABEND"; + File sRunningFile = null; + + try { + // Must create parent workarea - server lock code ensures this exists + File serverWorkArea = config.getWorkareaFile(null); + if (!serverWorkArea.exists()) { + boolean suc = serverWorkArea.mkdirs(); + } + + sRunningFile = config.getWorkareaFile(BootstrapConstants.SERVER_RUNNING_FILE); + sRunningFile.delete(); // Make sure sRunning file isn't there. + + ServerLock.createServerRunningMarkerFile(config); // Unit test runtime code + boolean cleanStart = config.checkCleanStart(); + assertFalse("Clean start should not be requested", cleanStart); + + ServerLock.createServerRunningMarkerFile(config); // 2nd call - file will exist, appears as ABEND + cleanStart = config.checkCleanStart(); + assertTrue("Clean start should be requested", cleanStart); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } finally { + if (config != null) { + // This method skips/preserves .sRunning file + FileUtils.recursiveClean(config.getWorkareaFile(null)); + } + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/TimeoutRule.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/TimeoutRule.java new file mode 100755 index 00000000000..cfabbac3cb3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/TimeoutRule.java @@ -0,0 +1,89 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal; + +import java.lang.management.ManagementFactory; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +/** + * + */ +public class TimeoutRule implements TestRule { + + /* + * (non-Javadoc) + * + * @see org.junit.rules.TestRule#apply(org.junit.runners.model.Statement, org.junit.runner.Description) + */ + @Override + public Statement apply(final Statement base, final Description arg1) { + return new CoreOnTimeoutStatement(base); + } + + public class CoreOnTimeoutStatement extends Statement { + + private final Statement base; + + /** + * @param base + */ + public CoreOnTimeoutStatement(Statement base) { + this.base = base; + } + + /* + * (non-Javadoc) + * + * @see org.junit.runners.model.Statement#evaluate() + */ + @Override + public void evaluate() throws Throwable { + try { + base.evaluate(); + } catch (Throwable ex) { + // Make sure this is a timeout + if (ex.getMessage() != null && ex.getMessage().startsWith("test timed out")) { + // Run gcore to generate a core dump on platforms where it's available + String osName = System.getProperty("os.name"); + if (osName.startsWith("Linux") || osName.startsWith("Solaris") || osName.startsWith("Sun")) { + int pid = getProcessPid(); + + Process p = Runtime.getRuntime().exec("gcore " + pid); + p.waitFor(); + } + } + + throw ex; + } + + } + + /** + * Get the process PID using the RuntimeMXBean. There are no real guarantees about the format, + * so this could easily break some day. + */ + private int getProcessPid() throws Exception { + String pidStr = ManagementFactory.getRuntimeMXBean().getName(); + + if (pidStr.contains("@")) { + return Integer.parseInt(pidStr.split("@")[0]); + } else { + return -1; + } + + } + + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/DumpProcessorTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/DumpProcessorTest.java new file mode 100755 index 00000000000..0474de7d9a4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/DumpProcessorTest.java @@ -0,0 +1,109 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.commands; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertTrue; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import test.common.SharedOutputManager; +import test.shared.Constants; + +import com.ibm.ws.kernel.boot.BootstrapConfig; +import com.ibm.ws.kernel.boot.ReturnCode; + +/** + * + */ +@Ignore +public class DumpProcessorTest { + + private static SharedOutputManager outputMgr; + + private final Mockery mockery = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // capture system output + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + outputMgr.restoreStreams(); + } + + @Test + public void testUnableToFindJavaDumps() throws Exception { + final String serverName = "server-testUnableToFindJavaDumps"; + final File tempServerDir = new File(new File(Constants.TEST_TMP_ROOT_FILE, "servers"), serverName); + final BootstrapConfig mockBootConfig = mockery.mock(BootstrapConfig.class); + + // Methods called on BootstratpConfig from DumpProcessor execute method. + mockery.checking(new Expectations() { + { + allowing(mockBootConfig).getUserRoot(); + will(returnValue(Constants.TEST_TMP_ROOT_FILE)); + + allowing(mockBootConfig).getOutputFile(null); + will(returnValue(tempServerDir)); + } + }); + + File dumpFile = new File(Constants.TEST_TMP_ROOT_FILE, "dump.testUnableToFindJavaDumps.zip").getAbsoluteFile(); + + assertTrue("Precondition Failed - unable to create temp server directory", tempServerDir.mkdirs()); + + dumpFile.createNewFile(); + + // create paths to heap and system dumps that do not exist + List javaDumps = new ArrayList(); + javaDumps.add(new File(Constants.TEST_TMP_ROOT, "NON_EXISTENT_HEAP_DUMP.phd").getAbsolutePath()); + javaDumps.add(new File(Constants.TEST_TMP_ROOT, "NON_EXISTENT_SYSTEM_DUMP.dmp").getAbsolutePath()); + + try { + DumpProcessor dumpProcessor = new DumpProcessor(serverName, dumpFile, mockBootConfig, javaDumps); + assertEquals(ReturnCode.OK, dumpProcessor.execute()); + + // verify that the user is alerted to missing java dump files: + assertTrue("Did not find expected error message for missing heap dump file", outputMgr.checkForStandardOut("CWWKE0009E.*NON_EXISTENT_HEAP_DUMP.phd")); + assertTrue("Did not find expected error message for missing system dump file", outputMgr.checkForStandardOut("CWWKE0009E.*NON_EXISTENT_SYSTEM_DUMP.dmp")); + } finally { + if (dumpFile.exists()) { + dumpFile.delete(); + } + if (tempServerDir.exists()) { + tempServerDir.delete(); + } + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/FolderStructureGeneratorTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/FolderStructureGeneratorTest.java new file mode 100755 index 00000000000..ee8244b435e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/FolderStructureGeneratorTest.java @@ -0,0 +1,59 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.commands; + +import java.io.File; +import java.util.Formatter; +import java.util.regex.Pattern; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; + +public class FolderStructureGeneratorTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + private static final File dataDir = new File("unittest/test data/dump"); + + @Rule + public TestRule outputRule = outputMgr; + + @Test + public void testMD5() { + String md5 = new ServerDumpPackager.FolderStructureGenerator().md5(new File(dataDir, "/md5-1.txt")); + Assert.assertEquals("a62c519aaabfce3f6d02bfc983f26098", md5); + } + + @Test + public void testPrintFileList() throws Exception { + StringBuilder builder = new StringBuilder(); + Formatter formatter = new Formatter(builder); + new ServerDumpPackager.FolderStructureGenerator().printFileList(dataDir, formatter, dataDir.getAbsolutePath().length() + 1); + String[] lines = builder.toString().split("\r?\n"); + String dateTime = "\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}"; + String sep = Pattern.quote(File.separator); + + int i = 0; + Assert.assertTrue(lines[i], lines[i].matches("d " + dateTime + " lib" + sep)); + i++; + Assert.assertTrue(lines[i], lines[i].matches("f 54 " + dateTime + " c327688b13b293d7d42c60d39e59f8a5 lib" + sep + "md5-2.txt")); + i++; + Assert.assertTrue(lines[i], lines[i].matches("f 46 " + dateTime + " a62c519aaabfce3f6d02bfc983f26098 md5-1.txt")); + i++; + Assert.assertTrue(lines[i], lines[i].matches("d " + dateTime + " usr" + sep)); + i++; + // Files beneath usr should not be printed. + Assert.assertEquals(i, lines.length); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/PackageProcessorTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/PackageProcessorTest.java new file mode 100755 index 00000000000..debfb02e46b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/commands/PackageProcessorTest.java @@ -0,0 +1,133 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.commands; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.jar.Attributes; +import java.util.jar.Manifest; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.Before; +import org.junit.Test; + +import test.shared.Constants; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.boot.BootstrapConfig; +import com.ibm.ws.kernel.boot.internal.BootstrapConstants; + +/** + * + */ +public class PackageProcessorTest { + + /** + * Mock environment. + */ + protected static Mockery mockery; + + /** + * Create the mockery environment. Called before each test to setup a new + * mockery environment for each test, which helps isolate Expectation sets + * and makes it easier to read error log output when Expectations fail. + */ + @Before + public void before() { + mockery = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + } + + /** + * @return A manifest file to use for testing. + */ + private File createTestManifestFile() throws IOException { + File maniFile = TestUtils.createTempFile("PackageProcessorTest.MANIFEST", ".mf"); + maniFile.deleteOnExit(); + + Manifest mf = new Manifest(); + Attributes atts = mf.getMainAttributes(); + + atts.putValue("Manifest-Version", "1.0"); + atts.putValue("Archive-Content-Type", "install"); + atts.putValue("Archive-Root", "wlp/"); + atts.putValue("Bnd-LastModified", "1389725452656"); + atts.putValue("Bundle-Copyright", "The Program materials contained in this file are IBM c" + + "opyright materials. WLP Copyright International Business Machines Corp." + + " 1999, 2013 All Rights Reserved * Licensed Materials - Property of IBM " + + "US Government Users Restricted Rights - Use, duplication or disclosure " + + "restricted by GSA ADP Schedule Contract with IBM Corp."); + atts.putValue("Bundle-Vendor", "IBM"); + atts.putValue("Created-By", "1.6.0 (IBM Corporation)"); + atts.putValue("Extract-Installer", "true"); + atts.putValue("Import-Package", "javax.xml.parsers,org.w3c.dom,org.xml.sax"); + atts.putValue("License-Agreement", "wlp/lafiles/LA"); + atts.putValue("License-Information", "wlp/lafiles/LI"); + atts.putValue("Main-Class", "wlp.lib.extract.SelfExtract"); + + mf.write(new FileOutputStream(maniFile)); + + return maniFile; + } + + /** + * + */ + @Test + public void testBuildManifestForIncludeEqualsUsr() throws Exception { + + final BootstrapConfig mockBootConfig = mockery.mock(BootstrapConfig.class); + + // Methods called on BootstratpConfig from PackageProcessor.CTOR. + mockery.checking(new Expectations() { + { + allowing(mockBootConfig).getUserRoot(); + will(returnValue(Constants.TEST_TMP_ROOT_FILE)); + + allowing(mockBootConfig).getConfigFile(null); + will(returnValue(Constants.TEST_TMP_ROOT_FILE)); + + allowing(mockBootConfig).get(BootstrapConstants.LOC_PROPERTY_SRVTMP_DIR); + will(returnValue(Constants.TEST_TMP_ROOT)); + + allowing(mockBootConfig).getProcessType(); + will(returnValue(BootstrapConstants.LOC_PROCESS_TYPE_SERVER)); + } + }); + + // Run the code under test. + File newManiFile = new PackageProcessor(null, null, mockBootConfig, null, null) + .buildManifestForIncludeEqualsUsr(createTestManifestFile()); + newManiFile.deleteOnExit(); + + // Verify content of new manifest file + Manifest mf = new Manifest(); + mf.read(new FileInputStream(newManiFile)); + + Attributes atts = mf.getMainAttributes(); + assertNull(atts.getValue("License-Information")); + assertNull(atts.getValue("License-Agreement")); + assertEquals("com.ibm.websphere.appserver", atts.getValue("Applies-To")); + assertEquals("false", atts.getValue("Extract-Installer")); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLauncherDelegate.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLauncherDelegate.java new file mode 100755 index 00000000000..5dc0ac9b68d --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLauncherDelegate.java @@ -0,0 +1,22 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.framework; + +import com.ibm.ws.kernel.boot.BootstrapConfig; +import com.ibm.ws.kernel.launch.internal.LauncherDelegateImpl; + +public class BasicLauncherDelegate extends LauncherDelegateImpl { + public BasicLauncherDelegate(BootstrapConfig config) { + super(config); + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLogProvider.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLogProvider.java new file mode 100755 index 00000000000..68698c56905 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/internal/framework/BasicLogProvider.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.internal.framework; + +import java.io.File; +import java.util.Map; + +import com.ibm.wsspi.logprovider.LogProvider; + +/** + * + */ +public class BasicLogProvider implements LogProvider { + @Override + public void configure(Map config, + File logLocation, + com.ibm.wsspi.logging.TextFileOutputStreamFactory factory) {} + + @Override + public void stop() {} +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/MBeanServerPipelineTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/MBeanServerPipelineTest.java new file mode 100755 index 00000000000..35389b732fe --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/MBeanServerPipelineTest.java @@ -0,0 +1,185 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.jmx.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import javax.management.MBeanServerFactory; + +import org.junit.Before; +import org.junit.Test; + +import com.ibm.ws.kernel.boot.jmx.service.MBeanServerForwarderDelegate; +import com.ibm.ws.kernel.boot.jmx.service.MBeanServerPipeline; + +/** + * + */ +public class MBeanServerPipelineTest { + + private static final String MBEAN_SERVER_BUILDER_PROPERTY = "javax.management.builder.initial"; + private static final String MBEAN_SERVER_BUILDER_CLASS = PlatformMBeanServerBuilder.class.getName(); + + public static final class MBeanServerPipelineHolder implements PlatformMBeanServerBuilderListener { + + private MBeanServerPipeline pipeline; + + @Override + public void platformMBeanServerCreated(MBeanServerPipeline pipeline) { + this.pipeline = pipeline; + } + + public MBeanServerPipeline getMBeanServerPipeline() { + return pipeline; + } + } + + public static class BasicFilter extends MBeanServerForwarderDelegate { + + private final int priority; + + public BasicFilter(int priority) { + this.priority = priority; + } + + @Override + public final int getPriority() { + return priority; + } + } + + public static class PriorityRecorder extends BasicFilter { + + private final List priorities; + + public PriorityRecorder(int priority, List priorities) { + super(priority); + this.priorities = priorities; + } + + @Override + public Integer getMBeanCount() { + priorities.add(getPriority()); + return super.getMBeanCount(); + } + } + + protected PlatformMBeanServer mBeanServer; + protected MBeanServerPipeline mBeanServerPipeline; + + @Before + public void setUp() throws Exception { + System.setProperty(MBEAN_SERVER_BUILDER_PROPERTY, MBEAN_SERVER_BUILDER_CLASS); + mBeanServer = (PlatformMBeanServer) MBeanServerFactory.newMBeanServer(); + MBeanServerPipelineHolder pipelineHolder = new MBeanServerPipelineHolder(); + mBeanServer.invokePlatformMBeanServerCreated(pipelineHolder); + mBeanServerPipeline = pipelineHolder.getMBeanServerPipeline(); + } + + @Test + public void testInsert() { + final BasicFilter f1 = new BasicFilter(5); + final BasicFilter f2 = new BasicFilter(-1); + + assertTrue("Excpected insert of BasicFilter(5) succeeded.", mBeanServerPipeline.insert(f1)); + assertFalse("Excpected insert of BasicFilter(5) failed.", mBeanServerPipeline.insert(f1)); + assertFalse("Excpected insert of BasicFilter(-1) failed.", mBeanServerPipeline.insert(f2)); + assertFalse("Excpected insert of null failed.", mBeanServerPipeline.insert(null)); + } + + @Test + public void testRemove() { + final BasicFilter f1 = new BasicFilter(42); + final BasicFilter f2 = new BasicFilter(8); + final BasicFilter f3 = new BasicFilter(13); + + assertFalse("Excpected remove of BasicFilter(42) failed.", mBeanServerPipeline.remove(f1)); + + mBeanServerPipeline.insert(f1); + mBeanServerPipeline.insert(f2); + mBeanServerPipeline.insert(f3); + + assertTrue("Excpected remove of BasicFilter(42) succeeded.", mBeanServerPipeline.remove(f1)); + assertTrue("Excpected remove of BasicFilter(8) succeeded.", mBeanServerPipeline.remove(f2)); + assertTrue("Excpected remove of BasicFilter(13) succeeded.", mBeanServerPipeline.remove(f3)); + assertFalse("Excpected remove of BasicFilter(42) failed.", mBeanServerPipeline.remove(f1)); + } + + @Test + public void testContains() { + final BasicFilter f1 = new BasicFilter(7); + final BasicFilter f2 = new BasicFilter(13); + final BasicFilter f3 = new BasicFilter(9); + final BasicFilter f4 = new BasicFilter(4); + + assertFalse("Excpected pipeline does not contain BasicFilter(7).", mBeanServerPipeline.contains(f1)); + assertFalse("Excpected pipeline does not contain null.", mBeanServerPipeline.contains(null)); + + mBeanServerPipeline.insert(f1); + mBeanServerPipeline.insert(f2); + mBeanServerPipeline.insert(f3); + + assertTrue("Excpected pipeline contains BasicFilter(7).", mBeanServerPipeline.contains(f1)); + assertTrue("Excpected pipeline contains BasicFilter(13).", mBeanServerPipeline.contains(f2)); + assertTrue("Excpected pipeline contains BasicFilter(9).", mBeanServerPipeline.contains(f3)); + assertFalse("Excpected pipeline does not contain BasicFilter(4).", mBeanServerPipeline.contains(f4)); + + mBeanServerPipeline.remove(f1); + mBeanServerPipeline.remove(f2); + mBeanServerPipeline.remove(f3); + + assertFalse("Excpected pipeline does not contain BasicFilter(7).", mBeanServerPipeline.contains(f1)); + assertFalse("Excpected pipeline does not contain BasicFilter(13).", mBeanServerPipeline.contains(f2)); + assertFalse("Excpected pipeline does not contain BasicFilter(9).", mBeanServerPipeline.contains(f3)); + } + + @Test + public void testPipelineOrder() { + final List priorities = new ArrayList(); + final PriorityRecorder f1 = new PriorityRecorder(7, priorities); + final PriorityRecorder f2 = new PriorityRecorder(13, priorities); + final PriorityRecorder f3 = new PriorityRecorder(9, priorities); + final PriorityRecorder f4 = new PriorityRecorder(4, priorities); + final PriorityRecorder f5 = new PriorityRecorder(15, priorities); + final PriorityRecorder f6 = new PriorityRecorder(6, priorities); + final PriorityRecorder f7 = new PriorityRecorder(12, priorities); + final PriorityRecorder f8 = new PriorityRecorder(8, priorities); + + final int mBeanCount1 = mBeanServer.getMBeanCount(); + + mBeanServerPipeline.insert(f1); + mBeanServerPipeline.insert(f2); + mBeanServerPipeline.insert(f3); + mBeanServerPipeline.insert(f4); + mBeanServerPipeline.insert(f5); + mBeanServerPipeline.insert(f6); + mBeanServerPipeline.insert(f7); + mBeanServerPipeline.insert(f8); + + final int mBeanCount2 = mBeanServer.getMBeanCount(); + assertEquals("Expected MBean counts to be equal.", mBeanCount1, mBeanCount2); + + final int length = priorities.size(); + assertEquals("Expected priorities.size() == 8.", 8, length); + + for (int i = 0; i < length - 1; ++i) { + int t0 = priorities.get(i); + int t1 = priorities.get(i + 1); + assertTrue("Expected '" + t0 + "' >= '" + t1 + "'.", t0 >= t1); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/PlatformMBeanServerDelegateTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/PlatformMBeanServerDelegateTest.java new file mode 100755 index 00000000000..9567278ecc2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/jmx/internal/PlatformMBeanServerDelegateTest.java @@ -0,0 +1,31 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.jmx.internal; + +import static org.junit.Assert.assertTrue; + +import javax.management.MBeanServerDelegate; + +import org.junit.Test; + +/** + * + */ +public class PlatformMBeanServerDelegateTest { + + @Test + public void testPlatformMBeanServerDelegateAttributes() throws Exception { + MBeanServerDelegate mBeanServerDelegate = new PlatformMBeanServerDelegate(); + assertTrue("Expected that server ID starts with WebSphere", + mBeanServerDelegate.getMBeanServerId().startsWith("WebSphere")); + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/security/WLPDynamicPolicyTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/security/WLPDynamicPolicyTest.java new file mode 100755 index 00000000000..66c666bfa4b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/boot/security/WLPDynamicPolicyTest.java @@ -0,0 +1,163 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.boot.security; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.net.URL; +import java.security.AllPermission; +import java.security.CodeSource; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Policy; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * + */ +public class WLPDynamicPolicyTest { + + private static URL testURL1; + private static URL testURL2; + private static URL unlistedURL; + private static List urls; + + private final Mockery mockery = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + private Policy policy; + private WLPDynamicPolicy dynamicPolicy; + private final Permission allPermission = new AllPermission(); + private PermissionsCombiner permissionsCombiner; + private PermissionCollection combinedPermissions; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + testURL1 = new URL("file:///testURL1"); + testURL2 = new URL("file:///testURL2"); + unlistedURL = new URL("file:///unlistedURL"); + urls = new ArrayList(); + urls.add(testURL1); + urls.add(testURL2); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Before + public void setUp() throws Exception { + policy = Policy.getPolicy(); + dynamicPolicy = new WLPDynamicPolicy(policy, urls); + permissionsCombiner = mockery.mock(PermissionsCombiner.class); + } + + @After + public void tearDown() throws Exception { + Policy.setPolicy(policy); + mockery.assertIsSatisfied(); + } + + /** + * Test method for {@link com.ibm.ws.kernel.boot.internal.WLPDynamicPolicy#getPermissions(java.security.CodeSource)}. + */ + @Test + public void testGetPermissionsCodeSource_AllPermission() { + CodeSource codesource = new CodeSource(testURL1, (java.security.cert.Certificate[]) null); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertTrue("The AllPermission must be granted to the codesource.", pemissionCollection.implies(allPermission)); + } + + @Test + public void testGetPermissionsCodeSource_AllPermissionForDifferentCodeSource() { + CodeSource codesource = new CodeSource(testURL2, (java.security.cert.Certificate[]) null); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertTrue("The AllPermission must be granted to the codesource.", pemissionCollection.implies(allPermission)); + } + + @Test + public void testGetPermissionsCodeSource_AllPermissionForCodeSourceNotListedAndNoStaticPolicy() throws Exception { + dynamicPolicy = new WLPDynamicPolicy(null, urls); + CodeSource codesource = new CodeSource(unlistedURL, (java.security.cert.Certificate[]) null); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertTrue("The AllPermission must be granted to the codesource.", pemissionCollection.implies(allPermission)); + } + + @Test + public void testGetPermissionsCodeSource_StaticPermissionsForCodeSourceNotListed() throws Exception { + CodeSource codesource = new CodeSource(unlistedURL, (java.security.cert.Certificate[]) null); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + List staticPermissions = Collections.list(policy.getPermissions(codesource).elements()); + assertTrue("The static permissions must be granted to the codesource.", staticPermissions.equals(Collections.list(pemissionCollection.elements()))); + } + + @Test + public void testGetPermissionsCodeSource_StaticPermissionsForNullCodeSource() throws Exception { + dynamicPolicy.setPermissionsCombiner(permissionsCombiner); + CodeSource codesource = null; + + try { + List staticPermissions = Collections.list(policy.getPermissions(codesource).elements()); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertTrue("The static permissions must be granted to the codesource.", staticPermissions.equals(Collections.list(pemissionCollection.elements()))); + } catch (NullPointerException e) { + // Ignore NPE from policy.getPermissions(codesource) since Oracle's JDK does not support a null code source. + } + } + + @Test + public void testGetPermissionsCodeSource_StaticPermissionsForNullLocation() throws Exception { + dynamicPolicy.setPermissionsCombiner(permissionsCombiner); + CodeSource codesource = new CodeSource(null, (java.security.cert.Certificate[]) null); + List staticPermissions = Collections.list(policy.getPermissions(codesource).elements()); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertTrue("The static permissions must be granted to the codesource.", staticPermissions.equals(Collections.list(pemissionCollection.elements()))); + } + + @Test + public void testGetPermissionsCodeSource_CombinedPermissionsForCodeSourceNotListed() throws Exception { + dynamicPolicy.setPermissionsCombiner(permissionsCombiner); + + CodeSource codesource = new CodeSource(unlistedURL, (java.security.cert.Certificate[]) null); + createPermissionsCombinerExpectations(codesource); + PermissionCollection pemissionCollection = dynamicPolicy.getPermissions(codesource); + assertEquals("The combined permissions must be granted to the codesource.", combinedPermissions, pemissionCollection); + } + + private void createPermissionsCombinerExpectations(final CodeSource codesource) { + combinedPermissions = mockery.mock(PermissionCollection.class); + mockery.checking(new Expectations() { + { + one(permissionsCombiner).getCombinedPermissions(with(any(PermissionCollection.class)), with(codesource)); + will(returnValue(combinedPermissions)); + } + }); + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/classloader/JarFileClassLoaderTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/classloader/JarFileClassLoaderTest.java new file mode 100755 index 00000000000..5bd444a0b47 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/classloader/JarFileClassLoaderTest.java @@ -0,0 +1,217 @@ +package com.ibm.ws.kernel.internal.classloader; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.net.URLConnection; +import java.net.URLStreamHandler; +import java.util.Enumeration; +import java.util.Properties; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import test.common.SharedOutputManager; + +public class JarFileClassLoaderTest { + + static SharedOutputManager outputMgr; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + private JarFileClassLoader getFileURLClassLoader(boolean verify) throws Exception { + File badJar = new File("../com.ibm.ws.kernel.boot_test/unittest/test data/signed/bad.jar"); + assertTrue(badJar.exists()); + return new JarFileClassLoader(new URL[] { badJar.toURI().toURL() }, verify, null); + } + + @Test + public void testDirectoryClassPath() throws Exception { + File directory = new File("../com.ibm.ws.kernel.boot_test/unittest/test data/"); + assertTrue(directory.exists()); + JarFileClassLoader classloader = new JarFileClassLoader(new URL[] { directory.toURI().toURL() }, false, null); + assertNotNull(classloader.getResource("signed/bad.jar")); + } + + @Ignore + public void testFileURL() throws Exception { + JarFileClassLoader loader = null; + + loader = getFileURLClassLoader(true); + testClassLoaderVerify(loader); + + loader = getFileURLClassLoader(false); + testClassLoaderNoVerify(loader); + } + + private JarFileClassLoader getNonFileURLClassLoader(boolean verify) throws Exception { + final File badJar = new File("../com.ibm.ws.kernel.boot_test/unittest/test data/signed/bad.jar"); + assertTrue(badJar.exists()); + URLStreamHandler handler = (new URLStreamHandler() { + @Override + protected URLConnection openConnection(URL u) throws IOException { + return new URLConnection(u) { + @Override + public void connect() throws IOException {} + + @Override + public InputStream getInputStream() throws IOException { + return new FileInputStream(badJar); + } + }; + } + }); + URL url = new URL("foo", "", -1, badJar.getAbsolutePath(), handler); + return new JarFileClassLoader(new URL[] { url }, verify, null); + } + + @Ignore + public void testNonFileURL() throws Exception { + JarFileClassLoader loader = null; + + loader = getNonFileURLClassLoader(true); + System.out.println(loader); + System.out.println(loader.getURLs()); + testClassLoaderVerify(loader); + + loader = getNonFileURLClassLoader(false); + System.out.println(loader); + System.out.println(loader.getURLs()); + testClassLoaderNoVerify(loader); + } + + private void testClassLoaderNoVerify(JarFileClassLoader loader) throws Exception { + // test loadClass() + assertNotNull(loader.loadClass("org.eclipse.equinox.metatype.Extendable")); + + // test getResource() + URL resource = loader.getResource("org/eclipse/equinox/metatype/EquinoxMetaTypeService.class"); + assertNotNull(resource); + assertNotNull(resource.openStream()); + + // test getResources() + Enumeration resources = loader.getResources("org/eclipse/equinox/metatype/EquinoxMetaTypeInformation.class"); + assertNotNull(resources); + assertTrue(resources.hasMoreElements()); + assertNotNull(resources.nextElement().openStream()); + } + + private void testClassLoaderVerify(JarFileClassLoader loader) throws Exception { + // test loadClass() + try { + loader.loadClass("org.eclipse.equinox.metatype.Extendable"); + fail("Did not throw SecurityException"); + } catch (SecurityException e) { + // we expect SecurityException + } + + // test getResource() + URL resource = loader.getResource("org/eclipse/equinox/metatype/EquinoxMetaTypeService.class"); + assertNotNull(resource); + try { + resource.openStream(); + fail("Did not throw SecurityException"); + } catch (SecurityException e) { + // we expect SecurityException + } + + // test getResources() + Enumeration resources = loader.getResources("org/eclipse/equinox/metatype/EquinoxMetaTypeInformation.class"); + assertNotNull(resources); + assertTrue(resources.hasMoreElements()); + try { + resources.nextElement().openStream(); + fail("Did not throw SecurityException"); + } catch (SecurityException e) { + // we expect SecurityException + } + } + + private ClassLoader getResourceTestURLClassLoader(boolean urlLoader) throws MalformedURLException { + File parentJar = new File("../com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources1.jar"); + assertTrue("No parent jar: " + parentJar, parentJar.exists()); + File childJar = new File("../com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources2.jar"); + assertTrue("No child jar: " + childJar, childJar.exists()); + URLClassLoader parent = new URLClassLoader(new URL[] { parentJar.toURI().toURL() }); + URL[] childUrls = new URL[] { childJar.toURI().toURL() }; + if (urlLoader) { + return new BootstrapChildFirstURLClassloader(childUrls, parent); + } else { + return new BootstrapChildFirstJarClassloader(childUrls, parent); + } + } + + @Test + public void testChildFirstGetResource() throws MalformedURLException { + doTestChildFirstGetResource(getResourceTestURLClassLoader(true)); + doTestChildFirstGetResource(getResourceTestURLClassLoader(false)); + } + + public void doTestChildFirstGetResource(ClassLoader loader) { + URL bootResource = loader.getResource("com/ibm/ws/kernel/boot/test.properties"); + assertNotNull("no boot resource found.", bootResource); + URL testResource = loader.getResource("resources/test.properties"); + assertNotNull("no test resource found.", testResource); + assertResource(bootResource, "1"); + assertResource(testResource, "2"); + } + + private void assertResource(URL resource, String expected) { + Properties props = new Properties(); + try { + props.load(resource.openStream()); + } catch (IOException e) { + fail("Failed to load resource: " + e.toString()); + } + assertEquals("Wrong resource test value", expected, props.getProperty("test")); + } + + @Test + public void testChildFirstGetResources() throws MalformedURLException { + doTestChildFirstGetResources(getResourceTestURLClassLoader(true)); + doTestChildFirstGetResources(getResourceTestURLClassLoader(false)); + } + + public void doTestChildFirstGetResources(ClassLoader loader) { + try { + Enumeration bootResources = loader.getResources("com/ibm/ws/kernel/boot/test.properties"); + assertNotNull("no boot resource found.", bootResources); + Enumeration testResources = loader.getResources("resources/test.properties"); + assertNotNull("no test resource found.", testResources); + assertResources(bootResources, "1", "2"); + assertResources(testResources, "2", "1"); + } catch (IOException e) { + fail("Failed to get resources: " + e.toString()); + } + } + + private void assertResources(Enumeration testResources, String... expected) { + for (String expectedValue : expected) { + assertResource(testResources.nextElement(), expectedValue); + } + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/reference/Handler.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/reference/Handler.java new file mode 100755 index 00000000000..e4ecccdc593 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/internal/reference/Handler.java @@ -0,0 +1,39 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.internal.reference; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; + +/** + * + */ +public class Handler extends URLStreamHandler { + + /** {@inheritDoc} */ + @Override + protected URLConnection openConnection(URL arg0) throws IOException { + return new URLConnection(arg0) { + @Override + public void connect() throws IOException {} + + @Override + public InputStream getInputStream() { + return null; + } + }; + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkConfigurationTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkConfigurationTest.java new file mode 100755 index 00000000000..687ca558952 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkConfigurationTest.java @@ -0,0 +1,40 @@ +package com.ibm.ws.kernel.launch.internal; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedOutputManager; + +public class FrameworkConfigurationTest { + + static SharedOutputManager outputMgr; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + @After + public void tearDown() throws Exception { + // Clear the output generated after each method invocation, this keeps + // things sane + outputMgr.resetStreams(); + } + + @Test + public void testStub() { + // There are no longer and tests in this suite! + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkManagerTimeTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkManagerTimeTest.java new file mode 100755 index 00000000000..f294374215b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/FrameworkManagerTimeTest.java @@ -0,0 +1,276 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.launch.internal; + +import java.text.DecimalFormatSymbols; +import java.util.Locale; + +import junit.framework.Assert; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedOutputManager; + +/** + * + */ +public class FrameworkManagerTimeTest { + static SharedOutputManager outputMgr; + static Locale saveLocale; + static FrameworkManager frameworkManager; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + saveLocale = Locale.getDefault(); + frameworkManager = new FrameworkManager(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + Locale.setDefault(saveLocale); + + } + + @Test + public void testgetElapsedTimeAsStringFromFrameworkManager_English() { + @SuppressWarnings("unused") + final String m = "testgetElapsedTimeAsStringFromFrameworkManager_English"; + String loc = "en"; //example: "pl" or "en" + DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(new Locale(loc)); + String days = " days, "; + String hours = " hours, "; + String min = " minutes, "; + String sec = " seconds"; + String decSep = decimalFormatSymbols.getDecimalSeparator() + ""; //Decimal Separator in English is '.' + String grpSep = decimalFormatSymbols.getGroupingSeparator() + ""; //Grouping Separator in English is ',' + + testgetElapsedTimeAsStringFromFrameworkManager(loc, days, hours, min, sec, decSep, grpSep); + + } + + @Test + public void testgetElapsedTimeAsStringFromFrameworkManager_Polish() { + @SuppressWarnings("unused") + final String m = "testgetElapsedTimeAsStringFromFrameworkManager_Polish"; + String loc = "pl"; //example: "pl" or "en" + DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(new Locale(loc)); + String days = " days, "; // dn. + String hours = " hours, ";// godz. + String min = " minutes, ";// min. + String sec = " seconds";// sek. + String decSep = decimalFormatSymbols.getDecimalSeparator() + ""; //Decimal Separator in Polish is ',' + String grpSep = decimalFormatSymbols.getGroupingSeparator() + ""; //Grouping Separator + + testgetElapsedTimeAsStringFromFrameworkManager(loc, days, hours, min, sec, decSep, grpSep); + + } + + private void testgetElapsedTimeAsStringFromFrameworkManager(String locale, String days, String hours, String min, String sec, String decSep, String grpSep) { + @SuppressWarnings("unused") + final String m = "testgetElapsedTimeAsStringFromFrameworkManager"; + Locale.setDefault(new Locale(locale)); //example: "pl" or "en" + long elapsedTimeVerify; + String[] processedTime = new String[48]; + String[] expectedResults = new String[48]; + + //Testing the first branch of the 'if' statement + //First Group- testing the mixed units + elapsedTimeVerify = 2007208124L;//The milliseconds of 23 days, 5 hours, 33 minutes, 28.124 seconds + expectedResults[0] = "23" + days + "5" + hours + "33" + min + "28" + decSep + "124" + sec; + processedTime[0] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 1989208124L;//The milliseconds of 23 days, 33 minutes, 28.124 seconds + expectedResults[1] = "23" + days + "33" + min + "28" + decSep + "124" + sec; + processedTime[1] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 2005228124L;//The milliseconds of 23 days, 5 hours, 28.124 seconds + expectedResults[2] = "23" + days + "5" + hours + "28" + decSep + "124" + sec; + processedTime[2] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 1987228124L;//The milliseconds of 23 days, 28.124 seconds + expectedResults[3] = "23" + days + "28" + decSep + "124" + sec; + processedTime[3] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 20008124L; //The milliseconds of 5 hours, 33 minutes, 28.124 seconds + expectedResults[4] = "5" + hours + "33" + min + "28" + decSep + "124" + sec; + processedTime[4] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 18028124L; //The milliseconds of 5 hours, 28.124 seconds + expectedResults[5] = "5" + hours + "28" + decSep + "124" + sec; + processedTime[5] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 2008124L; //The milliseconds of 33 minutes, 28.124 seconds + expectedResults[6] = "33" + min + "28" + decSep + "124" + sec; + processedTime[6] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 28124L; //The milliseconds of 28.124 seconds + expectedResults[7] = "28" + decSep + "124" + sec; + processedTime[7] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 28120L; //The milliseconds of 28.12 seconds + expectedResults[8] = "28" + decSep + "12" + sec; + processedTime[8] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 28100L; //The milliseconds of 28.1 seconds + expectedResults[9] = "28" + decSep + "1" + sec; + processedTime[9] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 28000L; //The milliseconds of 28 seconds + expectedResults[10] = "28" + sec; + processedTime[10] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 2000L; //The milliseconds of 2 seconds + expectedResults[11] = "2" + sec; + processedTime[11] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 200L; //The milliseconds of 0.2 seconds + expectedResults[12] = "0" + decSep + "2" + sec; + processedTime[12] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 20L; //The milliseconds of 0.02 seconds + expectedResults[13] = "0" + decSep + "02" + sec; + processedTime[13] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 2L; //The milliseconds of 0.002 seconds + expectedResults[14] = "0" + decSep + "002" + sec; + processedTime[14] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 1009L; //The milliseconds of 1.009 seconds + expectedResults[15] = "1" + decSep + "009" + sec; + processedTime[15] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + + //Second Group - testing with zero seconds + elapsedTimeVerify = 0L; //The milliseconds of 0 seconds + expectedResults[16] = "0" + sec; + processedTime[16] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 60000L; //The milliseconds of 1 minutes, 0 seconds + expectedResults[17] = "1" + min + "0" + sec; + processedTime[17] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 1987200000L;//The milliseconds of 23 days, 0 seconds + expectedResults[18] = "23" + days + "0" + sec; + processedTime[18] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 18000000L; //The milliseconds of 5 hours, 0 seconds + expectedResults[19] = "5" + hours + "0" + sec; + processedTime[19] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = 1980000L; //The milliseconds of 33 minutes, 0 seconds + expectedResults[20] = "33" + min + "0" + sec; + processedTime[20] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + + //Third Group - testing with maximum value of Long + elapsedTimeVerify = Long.MAX_VALUE; //The milliseconds of 106,751,991,167 days, 7 hours, 12 minutes 55.635 seconds + //(Seconds rounded from 55.634688) However due in difference in calculation accuracy when the Remainder '%' is used on Long, the + // Value will be 55.807 + //Long.MAX_VALUE = 9223372036854775807 + expectedResults[21] = "106" + grpSep + "751" + grpSep + "991" + grpSep + "167" + days + "7" + hours + "12" + min + "55" + decSep + "807" + sec; + processedTime[21] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + + //Third Group - Negative testing + elapsedTimeVerify = -1L; // No Time in negative value - Currently return 0 seconds + expectedResults[22] = "0" + sec; + processedTime[22] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + elapsedTimeVerify = Long.MIN_VALUE; // No Time in negative value - Currently return 0 seconds + // Long.MIN_VALUE = -9223372036854775808 + expectedResults[23] = "0" + sec; + processedTime[23] = frameworkManager.getElapsedTime(true, elapsedTimeVerify); + + //Testing the second branch of the 'if' statement, the 'else' + //First Group + elapsedTimeVerify = 1009L; //The milliseconds of 1.009 seconds + expectedResults[24] = "1" + decSep + "009" + sec; + processedTime[24] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 0L; //The milliseconds of 0 seconds + expectedResults[25] = "0" + sec; + processedTime[25] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2L; //The milliseconds of 0.002 seconds + expectedResults[26] = "0" + decSep + "002" + sec; + processedTime[26] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20L; //The milliseconds of 0.02 seconds + expectedResults[27] = "0" + decSep + "02" + sec; + processedTime[27] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200L; //The milliseconds of 0.2 seconds + expectedResults[28] = "0" + decSep + "2" + sec; + processedTime[28] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000L; //The milliseconds of 2 seconds + expectedResults[29] = "2" + sec; + processedTime[29] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20000L; //The milliseconds of 20 seconds + expectedResults[30] = "20" + sec; + processedTime[30] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200000L; //The milliseconds of 200 seconds + expectedResults[31] = "200" + sec; + processedTime[31] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000000L; //The milliseconds of 2,000 seconds + expectedResults[32] = "2" + grpSep + "000" + sec; + processedTime[32] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20000000L; //The milliseconds of 20,000 seconds + expectedResults[33] = "20" + grpSep + "000" + sec; + processedTime[33] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200000000L; //The milliseconds of 200,000 seconds + expectedResults[34] = "200" + grpSep + "000" + sec; + processedTime[34] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000000000L; //The milliseconds of 2,000,000 seconds + expectedResults[35] = "2" + grpSep + "000" + grpSep + "000" + sec; + processedTime[35] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20000000000L; //The milliseconds of 20,000,000 seconds + expectedResults[36] = "20" + grpSep + "000" + grpSep + "000" + sec; + processedTime[36] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200000000000L; //The milliseconds of 200,000,000 seconds + expectedResults[37] = "200" + grpSep + "000" + grpSep + "000" + sec; + processedTime[37] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000000000000L; //The milliseconds of 2,000,000,000 seconds + expectedResults[38] = "2" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[38] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20000000000000L; //The milliseconds of 20,000,000,000 seconds + expectedResults[39] = "20" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[39] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200000000000000L; //The milliseconds of 200,000,000,000 seconds + expectedResults[40] = "200" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[40] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000000000000000L; //The milliseconds of 2,000,000,000,000 seconds + expectedResults[41] = "2" + grpSep + "000" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[41] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 20000000000000000L; //The milliseconds of 20,000,000,000,000 seconds + expectedResults[42] = "20" + grpSep + "000" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[42] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 200000000000000000L; //The milliseconds of 200,000,000,000,000 seconds + expectedResults[43] = "200" + grpSep + "000" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[43] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = 2000000000000000000L; //The milliseconds of 2,000,000,000,000,000 seconds + expectedResults[44] = "2" + grpSep + "000" + grpSep + "000" + grpSep + "000" + grpSep + "000" + grpSep + "000" + sec; + processedTime[44] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + //Second Group - testing with maximum value of Long + elapsedTimeVerify = Long.MAX_VALUE; //The milliseconds of 9,223,372,036,854,775.807 seconds + // Long.MAX_VALUE = 9223372036854775807 + // The double will convert these seconds to 9,223,372,036,854,776 seconds + expectedResults[45] = "9" + grpSep + "223" + grpSep + "372" + grpSep + "036" + grpSep + "854" + grpSep + "776" + sec; + processedTime[45] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + //Third Group - Negative testing + elapsedTimeVerify = -1L; // No Time in negative value - Currently return 0 seconds + expectedResults[46] = "0" + sec; + processedTime[46] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + elapsedTimeVerify = Long.MIN_VALUE; // No Time in negative value - Currently return 0 seconds + // Long.MIN_VALUE = -9223372036854775808 + expectedResults[47] = "0" + sec; + processedTime[47] = frameworkManager.getElapsedTime(false, elapsedTimeVerify); + + // Assisting the results + String whiteSpacePattern = "\\s"; + //int i = 47; + for (int i = 0; i < expectedResults.length; i++) { + boolean result = expectedResults[i].replaceAll(whiteSpacePattern, ""). + equalsIgnoreCase(processedTime[i].replaceAll(whiteSpacePattern, "")); + String errMsg = "Elapsed Time is not formated correctly for the " + Locale.getDefault() + " language.\n" + + "The expected result at test # [" + i + "] is: " + expectedResults[i] + "\n" + + "The actual result is: " + processedTime[i]; + Assert.assertEquals(errMsg, true, result); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/LibertyProcessImplTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/LibertyProcessImplTest.java new file mode 100755 index 00000000000..60f26726b8e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/LibertyProcessImplTest.java @@ -0,0 +1,84 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.launch.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.ArrayList; +import java.util.Arrays; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.SharedOutputManager; + +/** + * + */ +public class LibertyProcessImplTest { + static SharedOutputManager outputMgr; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // make stdout/stderr "quiet"-- no output will show up for test + // unless one of the copy methods or documentThrowable is called + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + /** + * Test method for {@link com.ibm.ws.kernel.launch.internal.LibertyProcessImpl#getArgs()} . + */ + @Test + public void testGetArgs() { + final String m = "testGetArgs"; + + LibertyProcessImpl cmi; + String[] list; + + try { + cmi = new LibertyProcessImpl(null, null); + list = cmi.getArgs(); + assertNotNull(list); + assertEquals(0, list.length); + + cmi = new LibertyProcessImpl(new ArrayList(), null); + list = cmi.getArgs(); + assertNotNull(list); + assertEquals(0, list.length); + + final String dummy = "dummy"; + + cmi = new LibertyProcessImpl(Arrays.asList(new String[] { dummy }), null); + list = cmi.getArgs(); + assertNotNull(list); + assertEquals(1, list.length); + assertEquals(dummy, list[0]); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManagerTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManagerTest.java new file mode 100755 index 00000000000..7de936619d6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManagerTest.java @@ -0,0 +1,159 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.launch.internal; + +import static com.ibm.ws.kernel.launch.internal.NoRethrowSecurityManager.lineSep; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.FilePermission; +import java.security.AllPermission; +import java.security.CodeSource; +import java.security.Permission; +import java.security.Permissions; +import java.security.ProtectionDomain; +import java.security.SecureClassLoader; +import java.util.Enumeration; + +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Unit test for {@link NoRethrowSecurityManager} class. + */ +public class NoRethrowSecurityManagerTest { + + private static final Mockery mock = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + + private static final Permission PERMISSION1 = new FilePermission("<>", "read"); + private static final Permission PERMISSION2 = new AllPermission(); + + private static final CodeSource CODE_SOURCE2 = mock.mock(CodeSource.class, "source with no URL"); + + private static final Permissions PERMISSIONS = new Permissions(); + + private final ClassLoader CLASS_LOADER = ClassLoader.getSystemClassLoader(); + private final Class[] CLASS_ARRAY = { String.class, NoRethrowSecurityManager.class, + SecureClassLoader.class, org.osgi.service.permissionadmin.PermissionInfo.class }; + + private final String CS_STR_NULL_CODE_SOURCE = "null code source"; + private final String CS_STR_NULL_URL = "null code URL"; + + private final String PERMISSION_STR1 = "ClassLoader: Primordial Classloader" + lineSep + + " Permissions granted to CodeSource null" + lineSep + + " {" + lineSep + + " }"; + private String PERMISSION_STR2 = "ClassLoader: " + CLASS_LOADER.getClass().getName() + lineSep + + " Permissions granted to CodeSource " + CODE_SOURCE2 + lineSep + + " {" + lineSep + + " ;" + lineSep + + " ;" + lineSep + + " }"; + + @BeforeClass + public static void setup() { + PERMISSIONS.add(PERMISSION1); + PERMISSIONS.add(PERMISSION2); + } + + @Test + public void checkPermissionTest() { + NoRethrowSecurityManager secManager = new NoRethrowSecurityManager(); + try { + secManager.checkPermission(PERMISSION1); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + @Test + public void handleSecurityExceptionTest() { + NoRethrowSecurityManager secManager = new NoRethrowSecurityManager(); + try { + secManager.checkPermission(PERMISSION2); + } catch (SecurityException e) { + fail(e.getMessage()); + } + } + + @Test + public void getCodeSorce() { + NoRethrowSecurityManager secManager = new NoRethrowSecurityManager(); + String csLocation = getClass().getProtectionDomain().getCodeSource().getLocation().toString(); + + ProtectionDomain protectionDomain = new ProtectionDomain(null, null); + String csstr = secManager.getCodeSource(protectionDomain); + assertTrue("The result code source string is incorrect, expected '" + CS_STR_NULL_CODE_SOURCE + + "' and got '" + csstr + "'.", CS_STR_NULL_CODE_SOURCE.equals(csstr)); + + protectionDomain = new ProtectionDomain(CODE_SOURCE2, null); + csstr = secManager.getCodeSource(protectionDomain); + assertTrue("The result code source string is incorrect, expected '" + CS_STR_NULL_URL + + "' and got '" + csstr + "'.", CS_STR_NULL_URL.equals(csstr)); + + protectionDomain = getClass().getProtectionDomain(); + csstr = secManager.getCodeSource(protectionDomain); + assertTrue("The result code source string is incorrect, expected '" + csLocation + + "' and got '" + csstr + "'.", csLocation.equals(csstr)); + } + + @Test + public void permissionToStringTest() { + NoRethrowSecurityManager secManager = new NoRethrowSecurityManager(); + String result = secManager.permissionToString(null, null, null); + assertTrue("The result string is incorrect, should be: \n" + PERMISSION_STR1 + + "\n and got : " + result, PERMISSION_STR1.equals(result)); + + configPermissionsString(); + result = secManager.permissionToString(CODE_SOURCE2, CLASS_LOADER, PERMISSIONS); + assertTrue("The result string is incorrect, should be: \n" + PERMISSION_STR2 + + "\n and got :" + result, PERMISSION_STR2.equals(result)); + } + + @Test + public void isOffendingClassTest() { + NoRethrowSecurityManager secManager = new NoRethrowSecurityManager(); + ProtectionDomain domain = getClass().getProtectionDomain(); + boolean result; + + result = secManager.isOffendingClass(CLASS_ARRAY, 0, domain, PERMISSION1); + assertFalse("The class " + CLASS_ARRAY[0] + " should not be offending class.", result); + + result = secManager.isOffendingClass(CLASS_ARRAY, 1, domain, PERMISSION1); + assertFalse("The class " + CLASS_ARRAY[1] + " should not be offending class.", result); + + result = secManager.isOffendingClass(CLASS_ARRAY, 2, domain, PERMISSION1); + assertFalse("The class " + CLASS_ARRAY[2] + " should not be offending class.", result); + + result = secManager.isOffendingClass(CLASS_ARRAY, 3, domain, PERMISSION1); + assertTrue("The class " + CLASS_ARRAY[3] + " should be offending class.", result); + + } + + private void configPermissionsString() { + Enumeration elements = PERMISSIONS.elements(); + int cont = 1; + while (elements.hasMoreElements()) { + Permission p = elements.nextElement(); + PERMISSION_STR2 = PERMISSION_STR2.replaceFirst("", p.toString()); + cont++; + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/ProvisionerTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/ProvisionerTest.java new file mode 100755 index 00000000000..8211c4d7697 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/launch/internal/ProvisionerTest.java @@ -0,0 +1,527 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010, 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.launch.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JMock; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; +import org.osgi.framework.Constants; +import org.osgi.framework.startlevel.BundleStartLevel; +import org.osgi.framework.startlevel.FrameworkStartLevel; +import org.osgi.framework.wiring.BundleRevision; + +import com.ibm.ws.kernel.boot.LaunchException; +import com.ibm.ws.kernel.boot.SharedBootstrapConfig; +import com.ibm.ws.kernel.boot.internal.KernelResolver; +import com.ibm.ws.kernel.boot.internal.KernelStartLevel; +import com.ibm.ws.kernel.launch.internal.Provisioner.InvalidBundleContextException; +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +@RunWith(JMock.class) +public class ProvisionerTest { + static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + static SharedBootstrapConfig config; + + @Rule + public TestName testName = new TestName(); + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + TestUtils.cleanTempFiles(); + TestUtils.setKernelUtilsBootstrapLibDir(new File("unittest/test data/lbr/lib")); + TestUtils.setUtilsInstallDir(new File("unittest/test data/lbr")); + + config = SharedBootstrapConfig.createSharedConfig(outputMgr); + BundleRepositoryRegistry.initializeDefaults(null, true); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + TestUtils.cleanTempFiles(); + TestUtils.setKernelUtilsBootstrapLibDir(null); + } + + /** Trivial interface that groups Bundle & BundleStartLevel so mock can push through the adapt method */ + interface TestBundleStartLevel extends Bundle, BundleStartLevel {} + + /** Trivial interface that groups Bundle & BundleRevision so mock can push through the adapt method */ + interface TestBundleRevision extends Bundle, BundleRevision {} + + /** Trivial interface that groups Bundle & FrameworkStartLevel so mock can push through the adapt method */ + interface TestFrameworkStartLevel extends Bundle, FrameworkStartLevel {} + + Mockery context = new Mockery(); + + final Bundle mockBundle = context.mock(Bundle.class); + final BundleContext mockBundleContext = context.mock(BundleContext.class); + final TestBundleRevision mockBundleRevision = context.mock(TestBundleRevision.class); + final TestBundleStartLevel mockBundleStartLevel = context.mock(TestBundleStartLevel.class); + final TestFrameworkStartLevel mockFrameworkStartLevel = context.mock(TestFrameworkStartLevel.class); + + final ProvisionerImpl provisioner = new ProvisionerImpl(); + + @Before + public void setUp() throws Exception { + System.setProperty("java.protocol.handler.pkgs", "com.ibm.ws.kernel.internal"); + context.checking(new Expectations() { + { + atLeast(1).of(mockBundleContext).getBundle(Constants.SYSTEM_BUNDLE_LOCATION); + will(returnValue(mockFrameworkStartLevel)); + + one(mockFrameworkStartLevel).adapt(FrameworkStartLevel.class); + will(returnValue(mockFrameworkStartLevel)); + + one(mockFrameworkStartLevel).setInitialBundleStartLevel(KernelStartLevel.ACTIVE.getLevel()); + } + }); + } + + @Test + public void testInstallNonexistentBundle() throws Exception { + + BundleInstallStatus iStatus; + + // B -- non-existent bundle + + KernelResolver resolver = new KernelResolver(config.getInstallRoot(), null, "kernelCoreMissing-1.0", "defaultLogging-1.0", null); + config.setKernelResolver(resolver); + + provisioner.getServices(mockBundleContext); + iStatus = provisioner.installBundles(config); + + String listMissingBundles = iStatus.listMissingBundles(); + + assertTrue("B: Bundles notexist should be missing: " + listMissingBundles, iStatus.bundlesMissing()); + assertNotNull("B: listMissingBundles should not return null: " + listMissingBundles, listMissingBundles); + assertTrue("B: List of missing bundles should include p.q: " + listMissingBundles, listMissingBundles.contains("p.q")); + } + + @Test + public void testInstallBundle() throws Exception { + final String m = "testInstallBundle"; + + BundleInstallStatus iStatus; + + context.checking(new Expectations() { + { + one(mockBundleContext).installBundle(with(any(String.class)), with(any(InputStream.class))); + will(returnValue(mockBundle)); + + one(mockBundle).adapt(BundleStartLevel.class); + will(returnValue(mockBundleStartLevel)); + + one(mockBundle).adapt(BundleRevision.class); + will(returnValue(mockBundleRevision)); + + one(mockBundleRevision).getTypes(); + will(returnValue(0)); + + one(mockBundleStartLevel).getStartLevel(); + will(returnValue(1)); + + one(mockBundleStartLevel).setStartLevel(KernelStartLevel.BOOTSTRAP.getLevel()); + } + }); + + KernelResolver resolver = new KernelResolver(config.getInstallRoot(), null, "kernelCore-1.0", "emptyLogging-1.0", null); + config.setKernelResolver(resolver); + + provisioner.getServices(mockBundleContext); + iStatus = provisioner.installBundles(config); + + if (iStatus.bundlesMissing()) + System.out.println(iStatus.listMissingBundles()); + + assertFalse(m + " C: There should be no missing bundles", iStatus.bundlesMissing()); + assertNull(m + " C: The list of missing bundles should be null", iStatus.listMissingBundles()); + + recordExceptions(iStatus); // print any unexpected exceptions for + // debug + + assertFalse(m + " C: There should not be an install exception", iStatus.installExceptions()); + assertNull(m + " C: There should not be an exception to trace", iStatus.traceInstallExceptions()); + + if (iStatus.bundlesToStart()) + System.out.println(iStatus.getBundlesToStart()); + + assertTrue(m + " C: Bundles were installed", iStatus.bundlesToStart()); + assertTrue(m + " C: The list of bundles should contain the installed bundle", iStatus.getBundlesToStart().contains(mockBundle)); + } + + @Test + public void testInstallExistingBundle() throws Exception { + final String m = "testInstallExistingBundle"; + + BundleInstallStatus iStatus; + + KernelResolver resolver = new KernelResolver(config.getInstallRoot(), null, "kernelCore-1.0", "kernelCore-1.0", null); + config.setKernelResolver(resolver); + + File simple_1 = new File("unittest/test data/lbr/lib", "x.y_1.0.jar"); + final String locationString = "reference:" + simple_1.toURI().toURL().toString(); + + context.checking(new Expectations() { + { + one(mockBundleContext).installBundle("kernel@" + locationString, null); + will(returnValue(mockBundle)); + + one(mockBundle).adapt(BundleRevision.class); + will(returnValue(mockBundleRevision)); + + one(mockBundleRevision).getTypes(); + will(returnValue(0)); + + one(mockBundle).adapt(BundleStartLevel.class); + will(returnValue(mockBundleStartLevel)); + + one(mockBundleStartLevel).getStartLevel(); + will(returnValue(1)); + + one(mockBundleStartLevel).setStartLevel(KernelStartLevel.BOOTSTRAP.getLevel()); + } + }); + + provisioner.getServices(mockBundleContext); + iStatus = provisioner.installBundles(config); + + if (iStatus.bundlesMissing()) + System.out.println(iStatus.listMissingBundles()); + + assertFalse(m + " C: There should be no missing bundles", iStatus.bundlesMissing()); + assertNull(m + " C: The list of missing bundles should be null", iStatus.listMissingBundles()); + + recordExceptions(iStatus); // print any unexpected exceptions for + // debug + + assertFalse(m + " C: There should not be an install exception", iStatus.installExceptions()); + assertNull(m + " C: There should not be an exception to trace", iStatus.traceInstallExceptions()); + + if (iStatus.bundlesToStart()) + System.out.println(iStatus.getBundlesToStart()); + + assertTrue(m + " C: Bundles were installed", iStatus.bundlesToStart()); + assertTrue(m + " C: The list of bundles should contain the installed bundle", iStatus.getBundlesToStart().contains(mockBundle)); + } + + @Test + public void testInstallBundleException() throws Exception { + + BundleInstallStatus iStatus; + + // D -- existing bundle with EXCEPTION on install; + // one call to installBundle (that will throw exception) + // no calls to getHeaders + + final BundleException testEx = new BundleException("Expected exception installing bundle"); + + KernelResolver resolver = new KernelResolver(config.getInstallRoot(), null, "kernelCore-1.0", "emptyLogging-1.0", null); + config.setKernelResolver(resolver); + + context.checking(new Expectations() { + { + one(mockBundleContext).installBundle(with(any(String.class)), with(any(InputStream.class))); + will(throwException(testEx)); + + never(mockBundle).adapt(BundleRevision.class); + never(mockBundleRevision).getTypes(); + + never(mockBundle).adapt(BundleStartLevel.class); + never(mockBundleStartLevel).getStartLevel(); + never(mockBundleStartLevel).setStartLevel(with(any(int.class))); + } + }); + + provisioner.getServices(mockBundleContext); + iStatus = provisioner.installBundles(config); + + assertFalse("D: There should be no bundles installed", iStatus.bundlesToStart()); + assertTrue("D: There should be an install exception", iStatus.installExceptions()); + assertNotNull("D: There should be exceptions to trace", iStatus.traceInstallExceptions()); + + Map badness = iStatus.getInstallExceptions(); + System.out.println(badness); + + assertTrue("D: There should be an exception associated with bad bundle", badness.keySet().contains("x.y;version=\"[1.0.0,1.0.100)\"")); + assertEquals("D: The exception in the map should match the one thrown", badness.get("x.y;version=\"[1.0.0,1.0.100)\""), testEx); + } + + @Test + public void testInstallFragment() throws Exception { + + BundleInstallStatus iStatus; + + KernelResolver resolver = new KernelResolver(config.getInstallRoot(), null, "kernelCore-1.0", "emptyLogging-1.0", null); + config.setKernelResolver(resolver); + + // E -- existing FRAGMENT bundle; + // should not be added to list of "installed" bundles + context.checking(new Expectations() { + { + one(mockBundleContext).installBundle(with(any(String.class)), with(any(InputStream.class))); + will(returnValue(mockBundle)); + + one(mockBundle).adapt(BundleRevision.class); + will(returnValue(mockBundleRevision)); + + one(mockBundleRevision).getTypes(); + will(returnValue(BundleRevision.TYPE_FRAGMENT)); + + never(mockBundle).adapt(BundleStartLevel.class); + never(mockBundleStartLevel).getStartLevel(); + never(mockBundleStartLevel).setStartLevel(with(any(int.class))); + } + }); + + provisioner.getServices(mockBundleContext); + iStatus = provisioner.installBundles(config); + + assertFalse("E: The fragment bundle should not be in the list of installed bundles", iStatus.bundlesToStart()); + } + + @Test + public void testStartNullList() { + provisioner.getServices(mockBundleContext); + + // A -- null properties, empty array + + provisioner.startBundles(null); + provisioner.startBundles(new ArrayList()); + } + + @Test + public void testStartBundle() throws Exception { + BundleStartStatus sStatus; + provisioner.getServices(mockBundleContext); + + // B -- mock bundle; + // one call to b.start, bundle already started + + List bList = new ArrayList(); + bList.add(mockBundle); + + context.checking(new Expectations() { + { + one(mockBundle).getState(); + will(returnValue(org.osgi.framework.Bundle.RESOLVED)); + + one(mockBundle).start(with(any(int.class))); + } + }); + + sStatus = provisioner.startBundles(bList); + + assertFalse(sStatus.startExceptions()); + assertNull(sStatus.traceStartExceptions()); + + // C -- Felix path + context.checking(new Expectations() { + { + one(mockFrameworkStartLevel).adapt(FrameworkStartLevel.class); + will(returnValue(mockFrameworkStartLevel)); + + one(mockFrameworkStartLevel).setInitialBundleStartLevel(KernelStartLevel.ACTIVE.getLevel()); + + one(mockBundle).getState(); + will(returnValue(org.osgi.framework.Bundle.RESOLVED)); + + one(mockBundle).start(with(any(int.class))); + } + }); + + provisioner.getServices(mockBundleContext); + + sStatus = provisioner.startBundles(bList); + } + + @Test + public void testStartStartedBundle() throws Exception { + BundleStartStatus sStatus; + provisioner.getServices(mockBundleContext); + + // C -- mock bundle; + // one call to b.start, works fine + + List bList = new ArrayList(); + bList.add(mockBundle); + + context.checking(new Expectations() { + { + one(mockBundle).getState(); + will(returnValue(org.osgi.framework.Bundle.STARTING)); + + never(mockBundle).start(with(any(int.class))); + } + }); + + sStatus = provisioner.startBundles(bList); + + assertFalse(sStatus.startExceptions()); + assertNull(sStatus.traceStartExceptions()); + } + + @Test + public void testStartBundleException() throws Exception { + BundleStartStatus sStatus; + provisioner.getServices(mockBundleContext); + + // D -- existing bundle with EXCEPTION; + // one call to b.start, throws bundle exception + + final BundleException testEx = new BundleException("Expected exception starting bundle"); + + context.checking(new Expectations() { + { + one(mockBundle).getState(); + will(returnValue(org.osgi.framework.Bundle.RESOLVED)); + + one(mockBundle).start(with(any(int.class))); + will(throwException(testEx)); + + one(mockBundle).getSymbolicName(); + will(returnValue("mockBundle")); + } + }); + + List bList = new ArrayList(); + bList.add(mockBundle); + + sStatus = provisioner.startBundles(bList); + + assertTrue(sStatus.startExceptions()); + assertNotNull(sStatus.traceStartExceptions()); + + Map badness = sStatus.getStartExceptions(); + assertTrue(badness.keySet().contains(mockBundle)); + assertEquals(badness.get(mockBundle), testEx); + } + + @Test(expected = LaunchException.class) + public void testInstallStatusInstallException() { + final String m = "testInstallStatusInstallException"; + try { + final BundleInstallStatus iStatus = new BundleInstallStatus(); + iStatus.addInstallException("bundleName", new Throwable("pretend error")); + + provisioner.getServices(mockBundleContext); + provisioner.checkInstallStatus(iStatus); + } catch (LaunchException b) { + if (!b.getMessage().contains("installing")) + outputMgr.failWithThrowable(m, new AssertionError("exception message does not contain message about exceptions while installing bundles")); + + throw b; // expected + } + } + + @Test(expected = LaunchException.class) + public void testInstallStatusMissingBundles() { + final String m = "testInstallStatusMissingBundles"; + try { + final BundleInstallStatus iStatus = new BundleInstallStatus(); + iStatus.addMissingBundle("missing"); + + provisioner.getServices(mockBundleContext); + provisioner.checkInstallStatus(iStatus); + } catch (LaunchException b) { + if (!b.getMessage().contains("Missing")) + outputMgr.failWithThrowable(m, new AssertionError("exception message does not contain message about missing bundles")); + + throw b; // expected + } + } + + @Test(expected = LaunchException.class) + public void testInstallStatusNoBundles() { + final String m = "testInstallStatusNoBundles"; + + try { + final BundleInstallStatus iStatus = new BundleInstallStatus(); + + // no bundles to start.. + provisioner.getServices(mockBundleContext); + provisioner.checkInstallStatus(iStatus); + } catch (LaunchException b) { + if (!b.getMessage().contains("No required bundles")) + outputMgr.failWithThrowable(m, new AssertionError("exception message does not contain message about no bundles to start")); + + throw b; // expected + } + } + + @Test(expected = LaunchException.class) + public void testCheckStartStatusStartException() throws InvalidBundleContextException { + + context.checking(new Expectations() { + { + oneOf(mockBundle).getLocation(); + will(returnValue("bundle location")); + } + }); + + BundleStartStatus startStatus = new BundleStartStatus(); + startStatus.addStartException(mockBundle, new BundleException("fake exception")); + + provisioner.getServices(mockBundleContext); + provisioner.checkStartStatus(startStatus); + } + + @Test(expected = InvalidBundleContextException.class) + public void testCheckStartStatusInvalidContext() throws InvalidBundleContextException { + BundleStartStatus startStatus = new BundleStartStatus(); + startStatus.markContextInvalid(); + + provisioner.getServices(mockBundleContext); + provisioner.checkStartStatus(startStatus); + } + + protected void recordExceptions(BundleInstallStatus iStatus) { + + if (iStatus.installExceptions()) { + Map exceptions = iStatus.getInstallExceptions(); + for (String key : exceptions.keySet()) { + Throwable t = exceptions.get(key); + System.out.println("+UNEXPECTED EXCEPTION for " + key); + System.out.println("ex: " + t.getMessage()); + t.printStackTrace(System.out); + } + } + } + +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/LocalBundleRepositoryTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/LocalBundleRepositoryTest.java new file mode 100755 index 00000000000..8934454e7d6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/LocalBundleRepositoryTest.java @@ -0,0 +1,146 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.provisioining; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.osgi.framework.VersionRange; + +import test.common.SharedOutputManager; +import test.shared.TestUtils; + +import com.ibm.ws.kernel.provisioning.ContentBasedLocalBundleRepository; + +/** + * + */ +public class LocalBundleRepositoryTest { + private final SharedOutputManager outputMgr = SharedOutputManager.getInstance().trace("*=all"); + @Rule + public final TestRule outputRule = outputMgr; + + private static File cacheDir; + + @BeforeClass + public static void setupCache() throws IOException { + cacheDir = TestUtils.createTempDirectory("cache.data"); + } + + /** + * This method checks that if the location attribute identifies an exact file we use that rather than applying the iFix selection rules. + */ + @Test + public void testFullySpecifiedLocation() { + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/lbr"), cacheDir, true); + File f = lbr.selectBundle("lib/a.b_1.0.jar", "a.b", new VersionRange("0.0.0")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "a.b_1.0.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + lbr.dispose(); + } + + /** + * This method tests that if we don't have iFixes, or fix pack updates to a bundle we install the correct bundle. This + * is very low level belts and braces. If we don't do this right all BVTs are going to fail. + */ + @Test + public void testSelectSingleMatch() { + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/lbr"), cacheDir, true); + File f = lbr.selectBundle("", "x.y", new VersionRange("[1.0.0,1.0.100)")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "x.y_1.0.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + lbr.dispose(); + } + + /** + * This is the key iFix install routine. It is testing that when we have multiple iFixes for a fix pack we select the most + * recent one. It also checks that we ignore iFixes for fixpack jars that have not been installed. So this is really important. + */ + @Test + public void testSelectMultiMatch() { + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/lbr"), cacheDir, true); + File f = lbr.selectBundle("", "a.b", new VersionRange("[1.0.0,1.0.100)")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "a.b_1.0.1.v2.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + assertTrue("The ifix warning message (CWWKE0060W) was not output", outputMgr.checkForMessages("CWWKE0060W")); + assertTrue("The ifix warning message did not identify the iFix a.b_1.0.2.v1.jar", outputMgr.checkForMessages("a.b_1.0.2.v1.jar")); + assertTrue("The ifix warning message did not identify the base a.b_1.0.2.v1.jar", outputMgr.checkForMessages("a.b_1.0.2.jar")); + lbr.dispose(); + } + + /** + * This test ensures that if you have different bundles with the same symbolic name but different versions, and the bundle versions don't have + * qualifiers i.e. they are not ifix/apar bundles, that the bundle with the highest version is selected. + */ + @Test + public void testMultipleVersionedBundlesWithNoQualifiers() { + // We specifically don't want the cache because we are using a different bundle repository. If we use the cache this goes boom. + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/nonIFixLBR"), null, true); + File f = lbr.selectBundle("", "a.b", new VersionRange("[1.0.0,1.0.100)")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "a.b_1.0.1.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + lbr.dispose(); + } + + /** + * This method checks that we can select jars from two locations. We should pick the most recent from both locations. In + * the test the base jar 1.0.2 is in dev and the iFixes are in lib. We should pick up the iFixes and ignore the ones in + * dev. + */ + @Test + public void testMultipleLocations() { + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/lbr"), cacheDir, true); + File f = lbr.selectBundle("dev/,lib/", "a.b", new VersionRange("[1.0.0,1.0.100)")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "a.b_1.0.2.v1.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + f = lbr.selectBundle("dev/", "a.b", new VersionRange("[1.0.0,1.0.100)")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "bad.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + lbr.dispose(); + } + + /** + * This method checks that we can select and return jars that don't match the naming convetion, but where the content + * correctly identifies the jar. In this case we select dev and lib and select bundles up to 1.0.2, excluding iFixes. + * The jar is called bad.jar, but the SymbolicName is a.b and version is 1.0.2. + */ + @Test + public void testBadlyNamedJar() { + ContentBasedLocalBundleRepository lbr = new ContentBasedLocalBundleRepository(new File("unittest/test data/lbr"), cacheDir, true); + File f = lbr.selectBundle("dev/,lib/", "a.b", new VersionRange("[1.0.0,1.0.2]")); + assertNotNull("A file could not be located", f); + assertEquals("The file name is not correct", "bad.jar", f.getName()); + assertTrue("The file is not a file", f.isFile()); + assertTrue("The file does not exist", f.exists()); + lbr.dispose(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/ServiceFingerprintTest.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/ServiceFingerprintTest.java new file mode 100755 index 00000000000..cb97c3a8902 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/com/ibm/ws/kernel/provisioining/ServiceFingerprintTest.java @@ -0,0 +1,152 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.provisioining; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.Properties; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; + +import com.ibm.ws.kernel.boot.internal.FileUtils; +import com.ibm.ws.kernel.provisioning.ServiceFingerprint; + +/** + * + */ +public class ServiceFingerprintTest { + private static File workArea = new File("build/service.print/workarea/"); + private static File installDir = new File("../build.image/wlp"); + @Rule + public TestRule sharedOutputRuleThingy = SharedOutputManager.getInstance(); + + @Before + public void setup() { + new File(workArea, "platform").mkdirs(); + ServiceFingerprint.hasServiceBeenApplied(installDir, workArea); + ServiceFingerprint.putInstallDir(null, installDir); + } + + /** + * Add a single file to the ServiceFingerprint. Then check to see if service has been applied. Since the file has not + * changed it should not have changed. + */ + @Test + public void checkServiceDetectionWithNoChanges() { + ServiceFingerprint.put(new File("resources/packages.list")); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + } + + /** + * Add two files to the ServiceFingerprint. One doesn't change. One is deleted. Then check to see if service has been applied. + * Since a file is deleted it should return true for the final call to hasServiceBeenApplied. + */ + @Test + public void checkServiceDetectionWithFileDelete() throws IOException { + ServiceFingerprint.put(new File("resources/packages.list")); + File tmp = File.createTempFile("test", ".txt"); + PrintStream out = new PrintStream(tmp); + out.println("some data"); + out.close(); + ServiceFingerprint.put(tmp); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + tmp.delete(); + assertTrue("We should have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + } + + /** + * Add two files to the ServiceFingerprint. One doesn't change. One doesn't exist when it is initially added. The + * file is then created before checking to see if service has been applied. + * Since a file is added it should return true for the final call to hasServiceBeenApplied. + */ + @Test + public void checkServiceDetectionWithFileCreation() throws IOException { + ServiceFingerprint.put(new File("resources/packages.list")); + File tmp = File.createTempFile("test", ".txt"); + tmp.delete(); + ServiceFingerprint.put(tmp); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + PrintStream out = new PrintStream(tmp); + out.println("some data"); + out.close(); + assertTrue("We should have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + tmp.delete(); + } + + /** + * Add two files to the ServiceFingerprint. One doesn't change. One does. Then check to see if service has been applied. + * Since a file has changed it should return true for the final call to hasServiceBeenApplied. + */ + @Test + public void checkServiceDetectionWithFileChange() throws IOException { + ServiceFingerprint.put(new File("resources/packages.list")); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + File tmp = File.createTempFile("test", ".txt"); + tmp.delete(); + PrintStream out = new PrintStream(tmp); + out.println("some data"); + out.close(); + ServiceFingerprint.put(tmp); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + out = new PrintStream(tmp); + out.println("some totally new data"); + out.close(); + assertTrue("We should have detected a file change", ServiceFingerprint.hasServiceBeenApplied(installDir, workArea)); + tmp.delete(); + } + + /** + * Add two files to the ServiceFingerprint. One doesn't change. One is deleted. Then check to see if service has been applied. + * Since a file is deleted it should return true for the final call to hasServiceBeenApplied. + */ + @Test + public void checkServiceDetectionWithFileDeleteAndClear() throws IOException { + File tmpInstall = File.createTempFile("wlp", null); + tmpInstall.delete(); + File tmpVersions = new File(tmpInstall, "lib/versions/"); + tmpVersions.mkdirs(); + File tmpServiceFingerprint = new File(tmpVersions, "service.fingerprint"); + PrintStream out = new PrintStream(tmpServiceFingerprint); + out.println("some data"); + out.close(); + ServiceFingerprint.putInstallDir(null, tmpInstall); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(tmpInstall, workArea)); + // rename the install area + File renameTmpInstall = new File(tmpInstall.getParentFile(), tmpInstall.getName() + "2"); + tmpInstall.renameTo(renameTmpInstall); + assertTrue("We should have detected a file change", ServiceFingerprint.hasServiceBeenApplied(tmpInstall, workArea)); + ServiceFingerprint.clear(); + ServiceFingerprint.putInstallDir(null, renameTmpInstall); + assertFalse("We should not have detected a file change", ServiceFingerprint.hasServiceBeenApplied(renameTmpInstall, workArea)); + FileUtils.recursiveClean(renameTmpInstall); + } + + @After + public void cleanup() throws FileNotFoundException, IOException { + Properties props = new Properties(); + props.store(new FileOutputStream(new File(workArea, "platform/service.fingerprint")), null); + ServiceFingerprint.hasServiceBeenApplied(installDir, workArea); + new File("build/service.print/workarea/platform/service.fingerprint").delete(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/Constants.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/Constants.java new file mode 100755 index 00000000000..46022b1432b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/Constants.java @@ -0,0 +1,52 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2010 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * Change activity: + * + * Issue Date Name Description + * ----------- ----------- --------- ------------------------------------ + * Initial version + */ +package test.shared; + +import java.io.File; + +/** + * + */ +public class Constants { + /** + * Test data directory: note the space! always test paths with spaces. + * Dratted windows. + */ + public static final String TEST_DATA_DIR = "../com.ibm.ws.kernel.boot_test/build/unittest/test data/"; + + public static final File TEST_DATA_FILE = new File(TEST_DATA_DIR); + + /** Test dist dir: where our generated sample jars live */ + public static final String TEST_DIST_DIR = "../com.ibm.ws.kernel.boot_test/build/unittest/test data/lib/"; + + /** Test dist dir: where our generated sample jars live */ + public static final File TEST_DIST_DIR_FILE = new File(TEST_DIST_DIR); + + public static final String TEST_PLATFORM_DIR = "../com.ibm.ws.kernel.boot_test/build/unittest/test data/lib/platform/"; + + public static final String TEST_TMP_ROOT = "../com.ibm.ws.kernel.boot_test/build/tmp/"; + + public static final File TEST_TMP_ROOT_FILE = new File(TEST_TMP_ROOT); + + /** The dist dir containing the real jar file for the bootstrap */ + public static final String BOOTSTRAP_LIB_DIR = "../com.ibm.ws.kernel.boot/build/lib/"; + + public static final String BOOTSTRAP_PUBLISH_DIR = "../com.ibm.ws.kernel.boot/publish/"; + + public static final String MOCK_FRAMEWORK_LAUNCH = "MOCK_FRAMEWORK_LAUNCH"; +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/DumpTimerRule.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/DumpTimerRule.java new file mode 100755 index 00000000000..1c6b04e6fcb --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/DumpTimerRule.java @@ -0,0 +1,91 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.shared; + +import java.io.File; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.kernel.boot.internal.commands.JavaDumpAction; +import com.ibm.ws.kernel.boot.internal.commands.JavaDumper; + +/** + * + */ +public class DumpTimerRule implements TestRule { + + private static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); + + private final long timeoutMillis; + private final File outputDir; + private volatile boolean complete; + + public DumpTimerRule(long timeoutMillis, File outputDir) { + this.timeoutMillis = timeoutMillis; + this.outputDir = outputDir; + } + + /* + * (non-Javadoc) + * + * @see org.junit.rules.TestRule#apply(org.junit.runners.model.Statement, org.junit.runner.Description) + */ + @Override + public Statement apply(Statement statement, Description arg1) { + return new DumpTimerStatement(statement); + } + + private class DumpTimerStatement extends Statement { + private final Statement statement; + + private DumpTimerStatement(Statement statement) { + this.statement = statement; + } + + /* + * (non-Javadoc) + * + * @see org.junit.runners.model.Statement#evaluate() + */ + @Override + public void evaluate() throws Throwable { + DumpThreads dumper = new DumpThreads(); + ScheduledFuture future = scheduler.schedule(dumper, timeoutMillis, TimeUnit.MILLISECONDS); + try { + statement.evaluate(); + } finally { + complete = true; + future.cancel(false); + } + + } + + } + + private class DumpThreads implements Runnable { + + @Override + public void run() { + if (!complete) { + JavaDumper.getInstance().dump(JavaDumpAction.THREAD, outputDir); + } + + } + + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/TestUtils.java b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/TestUtils.java new file mode 100755 index 00000000000..05012f324c8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/src/test/shared/TestUtils.java @@ -0,0 +1,141 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.shared; + +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.concurrent.atomic.AtomicInteger; + +import com.ibm.ws.kernel.boot.cmdline.Utils; +import com.ibm.ws.kernel.boot.internal.KernelUtils; + +/** + * + */ +public class TestUtils { + private static AtomicInteger count = new AtomicInteger(0); + static Field bootJarField = null; + static Field bootLibDirField = null; + static Field utilsInstallDirField = null; + + public static File findBuiltKernelBundle() { + File root = new File(Constants.BOOTSTRAP_LIB_DIR); + + File fileList[] = root.listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.matches("com.ibm.ws.kernel.boot.*\\.jar"); + } + }); + + if (fileList == null || fileList.length < 1) + throw new RuntimeException("Unable to find com.ibm.ws.kernel.boot.*\\.jar in " + root.getAbsolutePath()); + + return fileList[0]; + } + + public static void setKernelUtilsBootstrapJar(File bootstrapJar) throws Exception { + if (bootJarField == null) { + bootJarField = KernelUtils.class.getDeclaredField("launchHome"); + bootJarField.setAccessible(true); + } + bootJarField.set(null, bootstrapJar); + } + + public static void setKernelUtilsBootstrapLibDir(File bootLibDir) throws Exception { + if (bootLibDirField == null) { + bootLibDirField = KernelUtils.class.getDeclaredField("libDir"); + bootLibDirField.setAccessible(true); + } + bootLibDirField.set(null, bootLibDir); + } + + public static void setUtilsInstallDir(File installDir) throws Exception { + if (utilsInstallDirField == null) { + utilsInstallDirField = Utils.class.getDeclaredField("installDir"); + utilsInstallDirField.setAccessible(true); + } + utilsInstallDirField.set(null, installDir); + } + + public static File createTempFile(String name, String suffix) throws IOException { + if (!Constants.TEST_TMP_ROOT_FILE.isDirectory()) { + Constants.TEST_TMP_ROOT_FILE.mkdirs(); + } + return File.createTempFile(name, suffix, Constants.TEST_TMP_ROOT_FILE); + } + + public static File createTempFile(String name, String suffix, File dir) throws IOException { + return File.createTempFile(name, suffix, dir); + } + + public static File createTempDirectory(String name) throws IOException { + File f = new File(Constants.TEST_TMP_ROOT_FILE, name + count.incrementAndGet()); + + if (!f.exists() && !f.mkdirs()) { + System.out.println("alex: file creation failed for: " + f.getAbsolutePath()); + throw new IOException("Unable to create temporary directory"); + } + return f; + } + + public static void cleanTempFiles(File dir) { + recursiveClean(dir); + } + + public static void cleanTempFiles() { + recursiveClean(Constants.TEST_TMP_ROOT_FILE); + } + + private static boolean recursiveClean(final File fileToRemove) { + if (fileToRemove == null) + return true; + + if (!fileToRemove.exists()) + return true; + + boolean success = true; + + if (fileToRemove.isDirectory()) { + File[] files = fileToRemove.listFiles(); + for (File file : files) { + if (file.isDirectory()) { + success |= recursiveClean(file); + } else { + success |= file.delete(); + } + } + files = fileToRemove.listFiles(); + if (files.length == 0) + success |= fileToRemove.delete(); + } else { + success |= fileToRemove.delete(); + } + return success; + } + + public static Method getMethod(Class subjectClass, String methodName, Class... parameterClasses) throws NoSuchMethodException { + try { + return subjectClass.getDeclaredMethod(methodName, parameterClasses); + } catch (NoSuchMethodException e) { + Class superClass = subjectClass.getSuperclass(); + if (superClass != null) { + return getMethod(superClass, methodName, parameterClasses); + } else { + throw new NoSuchMethodException(); + } + } + } +} diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/lib/md5-2.txt b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/lib/md5-2.txt new file mode 100755 index 00000000000..91dbf2724c8 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/lib/md5-2.txt @@ -0,0 +1 @@ +Another file for testing MD5. Do not change contents. \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/md5-1.txt b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/md5-1.txt new file mode 100755 index 00000000000..31a2ac49f4e --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/md5-1.txt @@ -0,0 +1 @@ +File for testing MD5. Do not change contents. \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/usr/ignored.txt b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/usr/ignored.txt new file mode 100755 index 00000000000..c891e9054e0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/dump/usr/ignored.txt @@ -0,0 +1 @@ +This file should be ignored by the file list generator. \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/a.b_1.0.2.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/a.b_1.0.2.mf new file mode 100755 index 00000000000..177bf28b64a --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/a.b_1.0.2.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.2 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/bad.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/bad.jar new file mode 100755 index 00000000000..e72d9cdc23c Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/dev/bad.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.jar new file mode 100755 index 00000000000..a8ad3ab74dd Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.mf new file mode 100755 index 00000000000..d1e287c057b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.0.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.jar new file mode 100755 index 00000000000..7a7d36cad52 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.mf new file mode 100755 index 00000000000..04cf5ce5103 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.1 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.jar new file mode 100755 index 00000000000..98bbadc01fc Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.mf new file mode 100755 index 00000000000..a9d0a16987b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v1.mf @@ -0,0 +1,4 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.1.v1 +IBM-Interim-Fixes: PQ1234 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.jar new file mode 100755 index 00000000000..5b1f20a19fe Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.mf new file mode 100755 index 00000000000..98eddeddcfc --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.1.v2.mf @@ -0,0 +1,4 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.1.v2 +IBM-Test-Fixes: PK1234 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.jar new file mode 100755 index 00000000000..a9cbe374093 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.mf new file mode 100755 index 00000000000..7d909d5851c --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.100.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.100 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.jar new file mode 100755 index 00000000000..246c26cc366 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.mf new file mode 100755 index 00000000000..6c3ffc629a3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.2.v1.mf @@ -0,0 +1,4 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b +Bundle-Version: 1.0.2.v1 +IBM-Test-Fixes: PK1234 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.jar new file mode 100755 index 00000000000..56b4c60a319 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.mf new file mode 100755 index 00000000000..b8f69510b0b --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/a.b_1.0.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: a.b; singleton:=true +Bundle-Version: 1.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/dummy.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/dummy.jar new file mode 100755 index 00000000000..3fbb1489bcd Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/dummy.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/binaryLogging-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/binaryLogging-1.0.mf new file mode 100755 index 00000000000..242af6b39e9 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/binaryLogging-1.0.mf @@ -0,0 +1,15 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: binaryLogging-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.binary.logging-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +WebSphere-LogProvider: com.ibm.ws.logging.internal.hpel.HpelLogProviderImpl + +## +## This relies on defaultLogging. We include a location hint to +## assist with bootstrapping. This is not generally applicable (don't copy). +## +Subsystem-Content: com.ibm.websphere.appserver.logging-1.0; location:="lib/platform/defaultLogging-1.0.mf"; type="osgi.subsystem.feature", + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/defaultLogging-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/defaultLogging-1.0.mf new file mode 100755 index 00000000000..f6f835186b7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/defaultLogging-1.0.mf @@ -0,0 +1,12 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: defaultLogging-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.logging-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +WebSphere-LogProvider: com.ibm.ws.logging.internal.impl.LogProviderImpl + +Subsystem-Content: a.b; version="[1,1.0.100)"; type="boot.jar", + a.b; version="[1,1.0.100)" + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/emptyLogging-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/emptyLogging-1.0.mf new file mode 100755 index 00000000000..4a524e0d0b3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/emptyLogging-1.0.mf @@ -0,0 +1,9 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: emptyLogging-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.logging-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +WebSphere-LogProvider: dummy.LogProvider + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/extension-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/extension-1.0.mf new file mode 100755 index 00000000000..de2a12fb769 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/extension-1.0.mf @@ -0,0 +1,8 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: com.ibm.websphere.appserver.logging-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +Subsystem-Content: a.b; version="[1,1.0.100)"; type="boot.jar", + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernel-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernel-1.0.mf new file mode 100755 index 00000000000..fb9341772a5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernel-1.0.mf @@ -0,0 +1,64 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: com.ibm.websphere.appserver.kernel-1.0; visibility:=private +Subsystem-Version: 1.0.0 +Subsystem-Content: README.TXT; location:="README.TXT"; type="file", + Copyright.txt; location:="Copyright.txt"; type="file", + isadc; location:="bin/isadc"; type="file", + isadc.bat; location:="bin/isadc.bat"; type="file", + productInfo; location:="bin/productInfo"; type="file", + productInfo.bat; location:="bin/productInfo.bat"; type="file", + securityUtility; location:="bin/securityUtility"; type="file", + securityUtility.bat; location:="bin/securityUtility.bat"; type="file", + featureManager; location:="bin/featureManager"; type="file", + featureManager.bat; location:="bin/featureManager.bat"; type="file", + server; location:="bin/server"; type="file", + server.bat; location:="bin/server.bat"; type="file", + ws-featurelist.jar; location:="bin/tools/ws-featurelist.jar"; type="file", + ws-featureManager.jar; location:="bin/tools/ws-featureManager.jar"; type="file", + ws-isadc.jar; location:="bin/tools/ws-isadc.jar"; type="file", + ws-productutil.jar; location:="bin/tools/ws-productutil.jar"; type="file", + ws-schemagen.jar; location:="bin/tools/ws-schemagen.jar"; type="file", + ws-securityutil.jar; location:="bin/tools/ws-securityutil.jar"; type="file", + cachespec.dtd; location:="dev/api/ibm/schema/cachespec.dtd"; type="file", + ibm-application-bnd_1_0.xsd; location:="dev/api/ibm/schema/ibm-application-bnd_1_0.xsd"; type="file", + ibm-application-bnd_1_1.xsd; location:="dev/api/ibm/schema/ibm-application-bnd_1_1.xsd"; type="file", + ibm-application-ext_1_0.xsd; location:="dev/api/ibm/schema/ibm-application-ext_1_0.xsd"; type="file", + ibm-application-ext_1_1.xsd; location:="dev/api/ibm/schema/ibm-application-ext_1_1.xsd"; type="file", + ibm-common-bnd_1_0.xsd; location:="dev/api/ibm/schema/ibm-common-bnd_1_0.xsd"; type="file", + ibm-common-bnd_1_1.xsd; location:="dev/api/ibm/schema/ibm-common-bnd_1_1.xsd"; type="file", + ibm-common-ext_1_0.xsd; location:="dev/api/ibm/schema/ibm-common-ext_1_0.xsd"; type="file", + ibm-common-ext_1_1.xsd; location:="dev/api/ibm/schema/ibm-common-ext_1_1.xsd"; type="file", + ibm-ejb-jar-bnd_1_0.xsd; location:="dev/api/ibm/schema/ibm-ejb-jar-bnd_1_0.xsd"; type="file", + ibm-ejb-jar-bnd_1_1.xsd; location:="dev/api/ibm/schema/ibm-ejb-jar-bnd_1_1.xsd"; type="file", + ibm-ejb-jar-ext_1_0.xsd; location:="dev/api/ibm/schema/ibm-ejb-jar-ext_1_0.xsd"; type="file", + ibm-ejb-jar-ext_1_1.xsd; location:="dev/api/ibm/schema/ibm-ejb-jar-ext_1_1.xsd"; type="file", + ibm-managed-bean-bnd_1_0.xsd; location:="dev/api/ibm/schema/ibm-managed-bean-bnd_1_0.xsd"; type="file", + ibm-web-bnd_1_0.xsd; location:="dev/api/ibm/schema/ibm-web-bnd_1_0.xsd"; type="file", + ibm-web-bnd_1_1.xsd; location:="dev/api/ibm/schema/ibm-web-bnd_1_1.xsd"; type="file", + ibm-web-ext_1_0.xsd; location:="dev/api/ibm/schema/ibm-web-ext_1_0.xsd"; type="file", + ibm-web-ext_1_1.xsd; location:="dev/api/ibm/schema/ibm-web-ext_1_1.xsd"; type="file", + com.ibm.websphere.appserver.spi.kernel.filemonitor; location:="dev/spi/ibm/com.ibm.websphere.appserver.spi.kernel.filemonitor_1.0.0.jar"; type="jar", + com.ibm.websphere.appserver.spi.kernel.service; location:="dev/spi/ibm/com.ibm.websphere.appserver.spi.kernel.service_1.0.0.jar"; type="jar", + com.ibm.websphere.appserver.spi.kernel.metatype; location:="dev/spi/ibm/com.ibm.websphere.appserver.spi.kernel.metatype_1.0.0.jar"; type="jar", + com.ibm.websphere.appserver.spi.logging; location:="dev/spi/ibm/com.ibm.websphere.appserver.spi.logging_1.1.0.jar"; type="jar", + com.ibm.websphere.appserver.spi.kernel.filemonitor_1.0-javadoc.zip; location:="dev/spi/ibm/javadoc/com.ibm.websphere.appserver.spi.kernel.filemonitor_1.0-javadoc.zip"; type="file", + com.ibm.websphere.appserver.spi.kernel.metatype_1.0-javadoc.zip; location:="dev/spi/ibm/javadoc/com.ibm.websphere.appserver.spi.kernel.metatype_1.0-javadoc.zip"; type="file", + com.ibm.websphere.appserver.spi.kernel.service_1.0-javadoc.zip; location:="dev/spi/ibm/javadoc/com.ibm.websphere.appserver.spi.kernel.service_1.0-javadoc.zip"; type="file", + com.ibm.websphere.appserver.spi.logging_1.1-javadoc.zip; location:="dev/spi/ibm/javadoc/com.ibm.websphere.appserver.spi.logging_1.1-javadoc.zip"; type="file", + com.ibm.websphere.appserver.spi.threading_1.0.0.jar; location:="dev/spi/ibm/com.ibm.websphere.appserver.spi.threading_1.0.0.jar"; type="jar", + com.ibm.websphere.appserver.spi.threading_1.0-javadoc.zip; location:="dev/spi/ibm/javadoc/com.ibm.websphere.appserver.spi.threading_1.0-javadoc.zip"; type="file", + osgi.core; location:="dev/spi/spec/com.ibm.wsspi.org.osgi.core.5.0.0_1.0.0.jar"; type="jar", + wlp-anttasks.jar; location:="dev/tools/ant/wlp-anttasks.jar"; type="file", + bootstrap-agent.jar; location:="lib/bootstrap-agent.jar"; type="file", + ws-launch.jar; location:="lib/ws-launch.jar"; type="file", + com.ibm.ws.org.apache.commons.lang.2.4_1.0.0.jar; location:="lib/com.ibm.ws.org.apache.commons.lang.2.4_1.0.0.jar"; type="jar", + com.ibm.rls.og_1.0.jar; location:="lib/com.ibm.rls.og_1.0.jar"; type="jar", + com.ibm.ws.anno.servlet_1.0.1.jar; location:="lib/com.ibm.ws.anno.servlet_1.0.1.jar"; type="jar", + com.ibm.ws.managedobject_1.0.jar; location:="lib/com.ibm.ws.managedobject_1.0.jar"; type="jar", + com.ibm.ws.product.utility_1.0.2.jar; location:="lib/com.ibm.ws.product.utility_1.0.2.jar"; type="jar", + com.ibm.ws.security.utility_1.0.3.jar; location:="lib/com.ibm.ws.security.utility_1.0.3.jar"; type="jar", + com.ibm.ws.timedoperations_1.0.jar; location:="lib/com.ibm.ws.timedoperations_1.0.jar"; type="jar", + internal-isadc.bat; location:="lib/tools/internal-isadc.bat";type="file", + .isadc; location:="lib/tools/.isadc";type="file" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCore-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCore-1.0.mf new file mode 100755 index 00000000000..e5fe928b845 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCore-1.0.mf @@ -0,0 +1,13 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: kernelCore-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.kernelCore-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +WebSphere-LogProvider: dummy.LogProvider + +Subsystem-Content: com.ibm.websphere.appserver.kernel-1.0; type="osgi.subsystem.feature", + x.y; version="[1.0.0,1.0.100)"; type="boot.jar", + x.y; version="[1.0.0,1.0.100)"; start-phase:=BOOTSTRAP, + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCoreMissing-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCoreMissing-1.0.mf new file mode 100755 index 00000000000..bc67f16575f --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/kernelCoreMissing-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: com.ibm.websphere.appserver.kernelCore-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +Subsystem-Content: com.ibm.websphere.appserver.kernel-1.0; type="osgi.subsystem.feature", + x.y; version="[1.0.0,1.0.100)"; type="boot.jar", + p.q; version="[1.0.0,1.0.100)", + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/missingJar-1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/missingJar-1.0.mf new file mode 100755 index 00000000000..5ddf4899c71 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/platform/missingJar-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: emptyLogging-1.0 +Subsystem-SymbolicName: com.ibm.websphere.appserver.logging-1.0; visibility:=private +Subsystem-Version: 1.0.0 + +Subsystem-Content: com.ibm.websphere.appserver.kernel-1.0; type="osgi.subsystem.feature", + p.q; version="[1.0.0,1.0.100)"; type="boot.jar" + +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/rebuildjars.bat b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/rebuildjars.bat new file mode 100755 index 00000000000..290d4f76350 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/rebuildjars.bat @@ -0,0 +1,15 @@ +set JAR=c:\java60\bin\jar + +for /r %%i in (*.jar) do ( + if exist %%~ni.mf ( + echo "%%~ni" + mkdir "%%~ni" + cd %%~ni + %JAR% xvf "%%i" + cd .. + del "%%i" + %JAR% cvmf "%%~ni.mf" "%%i" -C "%%~ni" . + del /s/q "%%~ni" + rmdir /s/q "%%~ni" + ) + ) \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.jar new file mode 100755 index 00000000000..155f46165f9 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.mf b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.mf new file mode 100755 index 00000000000..f430599b2d7 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lbr/lib/x.y_1.0.mf @@ -0,0 +1,3 @@ +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: x.y +Bundle-Version: 1.0 diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/include.properties b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/include.properties new file mode 100755 index 00000000000..2b550e2ae72 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/include.properties @@ -0,0 +1,3 @@ +bootstrap.include=peer.properties, ../platform/relative.properties +dummy=true +override=original \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/peer.properties b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/peer.properties new file mode 100755 index 00000000000..f1d7c4837a1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/peer.properties @@ -0,0 +1,2 @@ +override=peer +peer=found \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/relative.properties b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/relative.properties new file mode 100755 index 00000000000..82d0ad91bcd --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/relative.properties @@ -0,0 +1,2 @@ +override=relative +relative=found \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/testDefNoEquals.map b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/testDefNoEquals.map new file mode 100755 index 00000000000..38467bdd9ad --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/platform/testDefNoEquals.map @@ -0,0 +1,2 @@ +Alpine-ListVersion=a +TestStringNoValue \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..825482e73eb --- /dev/null +++ b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,7 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=$LIBERTY_VERSION$ +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition=BASE_ILAN +com.ibm.websphere.productLicenseType=ILAN diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.0.jar new file mode 100755 index 00000000000..09cf269ca3a Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.1.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.1.jar new file mode 100755 index 00000000000..94f8985caa1 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.100.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.100.jar new file mode 100755 index 00000000000..35bf68176aa Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.100.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.jar new file mode 100755 index 00000000000..dc6ee885299 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/a.b_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/x.y_1.0.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/x.y_1.0.jar new file mode 100755 index 00000000000..51d7da73ab6 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/nonIFixLBR/lib/x.y_1.0.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources1.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources1.jar new file mode 100755 index 00000000000..be7b833e8d2 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources1.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources2.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources2.jar new file mode 100755 index 00000000000..31d30e11c4f Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/resources/resources2.jar differ diff --git a/dev/com.ibm.ws.kernel.boot_test/unittest/test data/signed/bad.jar b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/signed/bad.jar new file mode 100755 index 00000000000..6dcf2c83617 Binary files /dev/null and b/dev/com.ibm.ws.kernel.boot_test/unittest/test data/signed/bad.jar differ diff --git a/dev/com.ibm.ws.kernel.feature_test/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.feature_test/bnd.bnd.gradle index f542f561a2c..f915f94644e 100644 --- a/dev/com.ibm.ws.kernel.feature_test/bnd.bnd.gradle +++ b/dev/com.ibm.ws.kernel.feature_test/bnd.bnd.gradle @@ -17,6 +17,7 @@ src: \ com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ com.ibm.ws.kernel.service;version=latest,\ com.ibm.ws.kernel.service.location;version=latest,\ com.ibm.ws.logging.core;version=latest,\ diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath b/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath.gradle b/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.gitignore b/dev/com.ibm.ws.kernel.filemonitor_fat/.gitignore new file mode 100644 index 00000000000..62c58326f56 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.gitignore @@ -0,0 +1,2 @@ +dropins +/nohup.out diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.project b/dev/com.ibm.ws.kernel.filemonitor_fat/.project new file mode 100755 index 00000000000..ab03967beda --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.filemonitor_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..f48ecd6cc60 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..74d9c72c1f3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,113 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd b/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd new file mode 100644 index 00000000000..35ef5a473ba --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.kernel.filemonitor;version=latest diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..35ef5a473ba --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/bnd.bnd.gradle @@ -0,0 +1,16 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.ws.jmx.connector.client.rest;version=latest, \ + com.ibm.ws.kernel.filemonitor;version=latest diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/build-test.xml b/dev/com.ibm.ws.kernel.filemonitor_fat/build-test.xml new file mode 100755 index 00000000000..4862d2787e3 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/build-test.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/build.gradle b/dev/com.ibm.ws.kernel.filemonitor_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/delivery.sets b/dev/com.ibm.ws.kernel.filemonitor_fat/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/AbstractNotificationTest.java b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/AbstractNotificationTest.java new file mode 100755 index 00000000000..4ab5fd62387 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/AbstractNotificationTest.java @@ -0,0 +1,291 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.junit.BeforeClass; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class AbstractNotificationTest { + + protected static final String MESSAGE_LOG = "logs/messages.log"; + private static final String BUNDLE_NAME = "com.ibm.ws.kernel.filemonitor.monitor.test.bundle_1.0.0"; + private static final String FEATURE_NAME = "monitoringPrintingFeature-1.0"; + + // Not thread-safe, but this code is unlikely to run multi-threaded, being a unit test + private static final DateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss:SSS"); + + protected static LibertyServer server; + protected static File monitoredFolder; + protected static File monitoredFile; + protected static File nonexistentFolder; + protected static File nonexistentFile; + + @BeforeClass + public static void classSetUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.kernel.filemonitor.server"); + // install our user feature + server.installUserBundle(BUNDLE_NAME); // NO HYPHENS! NO ".jar" SUFFIX! + server.installUserFeature(FEATURE_NAME); // NO UNDERSCORES! NO ".mf" SUFFIX! + server.startServer(); + + // Figure out where our test monitors are monitoring + String foldereyecatcher = "-MONITORED FOLDER-"; + String line = server.waitForStringInLog(foldereyecatcher); + assertNotNull("Our test feature should report the folder location we're monitoring.", line); + int index = line.indexOf(foldereyecatcher) + foldereyecatcher.length(); + // We create the file objects but not files on disk + monitoredFolder = new File(line.substring(index)); + + String fileeyecatcher = "-MONITORED FILE-"; + line = server.waitForStringInLog(fileeyecatcher); + assertNotNull("Our test feature should report the file location we're monitoring.", line); + index = line.indexOf(fileeyecatcher) + fileeyecatcher.length(); + // We create the file objects but not files on disk + monitoredFile = new File(line.substring(index)); + + String nonexistentfileeyecatcher = "-NONEXISTENT FILE-"; + line = server.waitForStringInLog(nonexistentfileeyecatcher); + assertNotNull("Our test feature should report the file location we're monitoring.", line); + index = line.indexOf(nonexistentfileeyecatcher) + nonexistentfileeyecatcher.length(); + // We create the file objects but not files on disk + nonexistentFile = new File(line.substring(index)); + + String nonexistentfoldereyecatcher = "-NONEXISTENT FOLDER-"; + line = server.waitForStringInLog(nonexistentfoldereyecatcher); + assertNotNull("Our test feature should report the folder location we're monitoring.", line); + index = line.indexOf(nonexistentfoldereyecatcher) + nonexistentfoldereyecatcher.length(); + // We create the folder objects but not folders on disk + nonexistentFolder = new File(line.substring(index)); + + } + + /** + * Waits for notifications to catch up after file changes that we're not especially + * interested in. This method should be used with caution since it resets + * the mark, so it should only be used when no monitor might want to see + * the changes that got notified. + */ + protected int flushNotifications(MonitorReader monitor) throws Exception { + // Wait for notifications to catch up + int count = monitor.scrapeLogsForChanges(); + monitor.clear(); + + server.setMarkToEndOfLog(); + + return count; + } + + protected void createFolder(File folder) { + assertTrue("Folder should have been created on the file system", folder.mkdirs()); + } + + /** + * Creates a file and also asserts we did actually create it + * (thus avoiding many puzzling notification failures). + */ + protected void createFile(File f) throws IOException { + assertTrue("File should have been created on the file system: " + f, f.createNewFile()); + } + + /** + * Deletes a file or folder and all its contents. + * If anything doesn't get deleted, an assertion will be failed. + */ + protected boolean deleteFile(File f) { + boolean success = false; + for (int pass = 0; !success && pass < 10; ++pass) + { + if (f.isDirectory()) { + File[] files = f.listFiles(); + for (File file : files) { + if (file.isDirectory()) { // Very minor efficiency hack, avoid last level of recursion + // Recurse + deleteFile(file); + } else { + file.delete(); // Failure here will be caught by the later f.delete. Ugly, but that's what we had. + } + } + } + success = f.delete(); + + if (!success) + { + try + { + Thread.sleep(500); + } catch (InterruptedException e) + { + // that's ok, just try it again + } + } + } + assertTrue("Should have been able to delete the file " + f, success); + return success; + } + + protected void appendSomething(File f) throws FileNotFoundException { + PrintWriter w = new PrintWriter(new FileOutputStream(f)); + w.println(new Date() + "Append some stuff\n\n"); + w.flush(); + w.close(); + } + + protected boolean updateTimestamp(File f) { + return f.setLastModified(System.currentTimeMillis() - (30 * 60 * 1000)); + } + + protected void assertNothingDeleted(final MonitorReader monitorReader) { + assertTrue( + "The following files were unexpectedly reported as deleted by the " + monitorReader.name + ":" + stringify(monitorReader.deleted), + monitorReader.deleted.isEmpty()); + } + + protected void assertNothingDeleted(String messagePrefix, final MonitorReader monitorReader) { + assertTrue(messagePrefix + + "the following files were unexpectedly reported as deleted by the " + monitorReader.name + ":" + stringify(monitorReader.deleted), + monitorReader.deleted.isEmpty()); + } + + protected void assertNothingModified(final MonitorReader monitorReader) { + assertTrue("The following files were unexpectedly reported as modified by the " + monitorReader.name + ":" + stringify(monitorReader.modified), + monitorReader.modified.isEmpty()); + } + + protected void assertNothingCreated(String messagePrefix, final MonitorReader monitorReader) { + assertTrue(messagePrefix + + "the following files were unexpectedly reported as created by the " + monitorReader.name + ":" + stringify(monitorReader.created), + monitorReader.created.isEmpty()); + } + + protected void assertNothingCreated(final MonitorReader monitorReader) { + assertTrue( + "The following files were unexpectedly reported as created by the " + monitorReader.name + ":" + stringify(monitorReader.created), + monitorReader.created.isEmpty()); + } + + protected void assertModified(final MonitorReader monitorReader, File... files) { + + final Collection collected = new ArrayList(); + for (File file : files) { + collected.add(file); + } + + assertNothingCreated(monitorReader); + assertNothingDeleted(monitorReader); + + assertFalse("A file should have been reported as modified by the " + monitorReader.name + ". \nGave up searching at " + DATE_FORMAT.format(monitorReader.lastSearchTime) + + ".", monitorReader.modified.isEmpty()); + assertEqualsOrderless("The wrong file was reported as modified by the " + monitorReader.name, collected, monitorReader.modified); + } + + protected void assertDeleted(final MonitorReader monitorReader, File... files) { + + final Collection collected = new ArrayList(); + for (File file : files) { + collected.add(file); + } + + assertNothingModified(monitorReader); + assertNothingCreated(monitorReader); + + assertFalse("A file should have been reported as deleted by the " + monitorReader.name + ". \nGave up searching at " + DATE_FORMAT.format(monitorReader.lastSearchTime) + + ".", monitorReader.deleted.isEmpty()); + assertEqualsOrderless("The wrong file was reported as deleted by the " + monitorReader.name, collected, monitorReader.deleted); + } + + protected void assertCreated(final MonitorReader monitorReader, File... files) { + + final Collection collected = new ArrayList(); + for (File file : files) { + collected.add(file); + } + + assertNothingModified(monitorReader); + assertNothingDeleted(monitorReader); + + assertFalse("A file should have been reported as created by the " + monitorReader.name + ". \nGave up searching at " + DATE_FORMAT.format(monitorReader.lastSearchTime) + + ".", monitorReader.created.isEmpty()); + assertEqualsOrderless("The wrong file was reported as created by the " + monitorReader.name, collected, monitorReader.created); + } + + protected void assertEqualsOrderless(String message, File[] expected, Collection actual) { + assertEqualsOrderless(message, Arrays.asList(expected), actual); + } + + /** + * Compares two collections for equality, ignoring the original order of elements + */ + private void assertEqualsOrderless(String message, Collection expected, Collection actual) { + // Compare by sorting before comparing + + // Put into a set to eliminate duplicates (we'll check for those in a moment) + Set actualSet = convertToSet(actual); + Set expectedSet = convertToSet(expected); + + // Convert to a list so we get ordering + List expectedList = convertToSortedList(expectedSet); + List actualList = convertToSortedList(actualSet); + + assertEquals(message, expectedList, actualList); + + // Now check for duplicates (unless we had the same duplicates in the expected list) + assertEquals("Although we were notified about the correct files, the same file was unexpectedly included multiple times in the list of changed files.", + convertToSortedList(expectedList), + convertToSortedList(actual)); + + } + + private String stringify(Collection list) { + return Arrays.toString(list.toArray()); + } + + private List convertToSortedList(Collection collection) { + List list = new ArrayList(); + list.addAll(collection); + Collections.sort(list); + + return list; + } + + private Set convertToSet(Collection collection) { + Set set = new HashSet(); + set.addAll(collection); + return set; + } +} diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FATSuite.java b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FATSuite.java new file mode 100755 index 00000000000..cc2f711d5a4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FATSuite.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * + */ +@RunWith(Suite.class) +@SuiteClasses( { FileMonitorTest.class, FileNotificationMBeanTest.class }) +public class FATSuite { + +} diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileMonitorTest.java b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileMonitorTest.java new file mode 100755 index 00000000000..4117cc1c7c6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileMonitorTest.java @@ -0,0 +1,1022 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; + +import org.junit.After; +import org.junit.Test; + +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; + +/** + * + */ +public class FileMonitorTest extends AbstractNotificationTest { + + /** + * Cut-and-pasted from the test feature. No direct compile-time or run-time + * communication is possible, so we're fragile. + */ + private static final MonitorReader fileMonitor = new MonitorReader("-FILETESTMONITOROUTPUT-", "file monitor"); + private static final MonitorReader nonexistentFileMonitor = new MonitorReader("-FILENONEXISTENTTESTMONITOROUTPUT-", "file monitor for file which doesn't exist"); + private static final MonitorReader confusedFileMonitor = new MonitorReader("-FILEBUTACTUALLYMONITORINGDIRECTORYTESTMONITOROUTPUT-", "file monitor for a file which is actually a folder"); + private static final MonitorReader recursiveMonitor = new MonitorReader("-RECURSIVETESTMONITOROUTPUT-", "recursive folder monitor"); + private static final MonitorReader nonexistentFolderMonitor = new MonitorReader("-NONEXISTENTFOLDERTESTMONITOROUTPUT-", "folder monitor for folder which doesn't exist"); + private static final MonitorReader confusedFolderMonitor = new MonitorReader("-RECURSIVEBUTACTUALLYMONITORINGFILETESTMONITOROUTPUT-", "folder monitor for a folder which is actually a file"); + private static final MonitorReader filterMonitor = new MonitorReader("-FILTEREDTESTMONITOROUTPUT-", "filtered folder monitor"); + private static final MonitorReader filefilterMonitor = new MonitorReader("-FILEFILTERTESTMONITOROUTPUT-", "only-files filtered folder monitor"); + private static final MonitorReader directoryfilterMonitor = new MonitorReader("-DIRECTORYFILTERTESTMONITOROUTPUT-", "only-directories filtered folder monitor"); + private static final MonitorReader nonRecursiveMonitor = new MonitorReader("-NONRECURSINGTESTMONITOROUTPUT-", "non-recursive folder monitor"); + private static final MonitorReader nonRecursiveMonitorSelfMonitor = new MonitorReader("-NONRECURSEMONITORSELFTESTMONITOROUTPUT-", "non-recursive self-monitoring folder monitor"); + private static final MonitorReader monitorSelfMonitor = new MonitorReader("-MONITORSELFTESTMONITOROUTPUT-", "self-monitoring folder monitor"); + + @After + public void tearDown() throws Exception { + // Clear up after any tests which may have deleted the monitored folder + if (!monitoredFolder.exists()) { + monitoredFolder.mkdirs(); + // Get rid of any notifications from reinstating the folder + // This flush assumes that the monitor self monitor works + flushNotifications(monitorSelfMonitor); + } + + // Get rid of any dangling notifications from tests, using the monitor most likely to catch something + flushNotifications(recursiveMonitor); + + } + + @Test + public void testBaselineIsReported() throws Exception { + + recursiveMonitor.scrapeLogsForBaseline(); + + assertFalse("The baseline should not be empty", recursiveMonitor.baseline.isEmpty()); + // We're not monitoring the directory itself, so it won't get included in the baseline + } + + @Mode(TestMode.FULL) + @Test + public void testBaselineIncludesNestedFolders() throws Exception { + File baseline = new File(monitoredFolder, "baseline"); + File baseline1 = new File(monitoredFolder, "baseline1"); + File nested = new File(monitoredFolder, "nestedBaselineFolder"); + File nestedFile = new File(nested, "nestedBaselineFile"); + + recursiveMonitor.scrapeLogsForBaseline(); + + assertFalse("The baseline should not be empty", recursiveMonitor.baseline.isEmpty()); + assertEqualsOrderless("The baseline didn't have the expected files in it.", new File[] { baseline, baseline1, nested, nestedFile }, recursiveMonitor.baseline); + } + + @Test + public void testBaselineDoesNotIncludeNestedFoldersInNonRecursiveCase() throws Exception { + File baseline = new File(monitoredFolder, "baseline"); + File baseline1 = new File(monitoredFolder, "baseline1"); + File nested = new File(monitoredFolder, "nestedBaselineFolder"); + + nonRecursiveMonitor.scrapeLogsForBaseline(); + + assertFalse("The baseline should not be empty", nonRecursiveMonitor.baseline.isEmpty()); + assertEqualsOrderless("The baseline didn't have the expected files in it.", new File[] { baseline, baseline1, nested }, nonRecursiveMonitor.baseline); + } + + @Test + public void testBaselineIncludesSelfInSelfDirectoryCase() throws Exception { + File baseline = new File(monitoredFolder, "baseline"); + File baseline1 = new File(monitoredFolder, "baseline1"); + File nested = new File(monitoredFolder, "nestedBaselineFolder"); + File nestedFile = new File(nested, "nestedBaselineFile"); + + // Set the mark to the beginning of the log, since the baseline will happen at the beginning but + // this test could run in any order + // This will reset the marks, too + server.resetLogOffsets(); + monitorSelfMonitor.scrapeLogsForBaseline(); + + assertFalse("The baseline should not be empty", monitorSelfMonitor.baseline.isEmpty()); + assertEqualsOrderless("The baseline didn't have the expected files in it.", new File[] { monitoredFolder, baseline, baseline1, nested, nestedFile }, + monitorSelfMonitor.baseline); + } + + @Mode(TestMode.FULL) + @Test + public void testBaselineIncludesSelfInSelfNonRecursiveDirectoryCase() throws Exception { + File baseline = new File(monitoredFolder, "baseline"); + File baseline1 = new File(monitoredFolder, "baseline1"); + File nested = new File(monitoredFolder, "nestedBaselineFolder"); + + nonRecursiveMonitorSelfMonitor.scrapeLogsForBaseline(); + + assertFalse("The baseline should not be empty", nonRecursiveMonitorSelfMonitor.baseline.isEmpty()); + assertEqualsOrderless("The baseline didn't have the expected files in it.", new File[] { monitoredFolder, baseline, baseline1, nested }, + nonRecursiveMonitorSelfMonitor.baseline); + } + + @Test + public void testBaselineIsEmptyForNonExistentFile() throws Exception { + nonexistentFileMonitor.scrapeLogsForBaseline(); + + assertEquals("A baseline should have been reported, and been empty.", 0, nonexistentFileMonitor.baseline.size()); + } + + @Test + public void testFileCreationIsNotified() throws Exception { + // Don't assume test ordering + if (monitoredFile.exists()) { + assertTrue(monitoredFile.delete()); + flushNotifications(fileMonitor); + } + createFile(monitoredFile); + + fileMonitor.scrapeLogsForChanges(); + + assertCreated(fileMonitor, monitoredFile); + } + + @Test + public void testFileModificationIsNotified() throws Exception { + + // Make the file to modify + if (!monitoredFile.exists()) { + createFile(monitoredFile); + fileMonitor.scrapeLogsForChanges(); + server.setMarkToEndOfLog(); + } + + appendSomething(monitoredFile); + + fileMonitor.scrapeLogsForChanges(); + assertModified(fileMonitor, monitoredFile); + } + + @Test + public void testFileCreationAndModificationIsNotifiedAsCreation() throws Exception { + + // Don't assume test ordering + if (monitoredFile.exists()) { + assertTrue(monitoredFile.delete()); + fileMonitor.scrapeLogsForChanges(); + server.setMarkToEndOfLog(); + } + + createFile(monitoredFile); + appendSomething(monitoredFile); + + fileMonitor.scrapeLogsForChanges(); + assertCreated(fileMonitor, monitoredFile); + } + + @Mode(TestMode.FULL) + @Test + public void testTimestampChanging() throws Exception { + // Make a file to delete (and make sure we noticed it) + if (!monitoredFile.exists()) { + createFile(monitoredFile); + fileMonitor.scrapeLogsForChanges(); + server.setMarkToEndOfLog(); + } + + // Make it a lot older (~30min) than it is (should still be considered modified) + monitoredFile.setLastModified(System.currentTimeMillis() - (30 * 60 * 1000)); + + fileMonitor.scrapeLogsForChanges(); + assertModified(fileMonitor, monitoredFile); + + } + + @Test + public void testFileDeletionIsNotified() throws Exception { + // Make a file to delete (and make sure we noticed it) + if (!monitoredFile.exists()) { + createFile(monitoredFile); + fileMonitor.scrapeLogsForChanges(); + server.setMarkToEndOfLog(); + } + + // Delete the file: it should be added to the 'deleted' list + assertTrue("File should be deleted on the filesystem", monitoredFile.delete()); + fileMonitor.scrapeLogsForChanges(); + assertDeleted(fileMonitor, monitoredFile); + + } + + /** + * An easy test, as a sanity baseline. + */ + @Test + public void testNoNotificationsHappenWhenNothingChanges() throws Exception { + // Do nothing :) + int count = recursiveMonitor.scrapeLogsForChanges(); + // Sanity check - we didn't see anything, right? + assertEquals("We didn't change any files so we shouldn't have had any monitoring activity.", 0, count); + assertNothingCreated(recursiveMonitor); + assertNothingDeleted(recursiveMonitor); + assertNothingModified(recursiveMonitor); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderCreationIsNotified() throws Exception { + File f = new File(monitoredFolder, "monitoredFile"); + createFile(f); + + recursiveMonitor.scrapeLogsForChanges(); + + assertCreated(recursiveMonitor, f); + } + + @Test + public void testMultipleFileCreationInFolderIsNotified() throws Exception { + File f1 = new File(monitoredFolder, "testMultipleFileCreationIsNotified1"); + File f2 = new File(monitoredFolder, "testMultipleFileCreationIsNotified2"); + createFile(f1); + createFile(f2); + + recursiveMonitor.scrapeLogsForChanges(); + + assertCreated(recursiveMonitor, f1, f2); + } + + @Test + public void testFileCreationInNestedFoldersIsNotifiedDependingOnRecursionSetting() throws Exception { + File folder = new File(monitoredFolder, "nestedFolder"); + createFolder(folder); + File f = new File(folder, "testFileCreationInNestedFoldersIsNotifiedDependingOnRecursionSetting"); + createFile(f); + + nonRecursiveMonitor.scrapeLogsForChanges(); + recursiveMonitor.scrapeLogsForChanges(); + + assertCreated(recursiveMonitor, folder, f); + // The non-recursive monitor should only see the folder, not its contents + assertCreated(nonRecursiveMonitor, folder); + + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderModificationIsNotified() throws Exception { + + // Make a file to modify (and make sure we noticed it) + File f = new File(monitoredFolder, "testFileModificationIsNotified"); + createFile(f); + flushNotifications(recursiveMonitor); + + appendSomething(f); + + recursiveMonitor.scrapeLogsForChanges(); + assertModified(recursiveMonitor, f); + } + + @Test + public void testFileInNestedFolderModificationIsNotifiedDependingOnRecursionSettings() throws Exception { + + // Make a file to modify (and make sure we noticed it) + // Make a file to delete (and make sure we noticed it) + File folder = new File(monitoredFolder, "nestedFolderForModification"); + createFolder(folder); + File f = new File(folder, "testFileInNestedFolderModificationIsNotifiedDependingOnRecursionSettings"); + createFile(f); + assertTrue("We should find a created notification to flush", flushNotifications(recursiveMonitor) > 0); + flushNotifications(nonRecursiveMonitor); + + appendSomething(f); + + recursiveMonitor.scrapeLogsForChanges(); + nonRecursiveMonitor.scrapeLogsForChanges(); + + assertModified(recursiveMonitor, f); + assertNothingModified(nonRecursiveMonitor); + + } + + @Test + public void testFileInNestedFolderCreationIsNotNotifiedWhenFileDoesNotMatchFilter() throws Exception { + + File folder = new File(monitoredFolder, "nestedFolderForFilteredCreation"); + createFolder(folder); + + File f = new File(folder, "testFileInNestedFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + + filterMonitor.scrapeLogsForChanges(); + assertNothingCreated(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingModified(filterMonitor); + + // Now check other files do get past the filter + File excluded = new File(folder, "testFileInNestedFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(folder, "testFileInNestedFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + + filterMonitor.scrapeLogsForChanges(); + assertCreated(filterMonitor, passed); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderModficationIsNotNotifiedWhenFileDoesNotMatchFilter() throws Exception { + + File folder = new File(monitoredFolder, "nestedFolderForFilteredModification"); + createFolder(folder); + + File f = new File(folder, "testFileInNestedFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + File excluded = new File(folder, "testFileInNestedFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(folder, "testFileInNestedFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + flushNotifications(filterMonitor); + + appendSomething(f); + filterMonitor.scrapeLogsForChanges(); + assertNothingModified(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingModified(filterMonitor); + + // Now check other files do get past the filter + appendSomething(excluded); + appendSomething(passed); + filterMonitor.scrapeLogsForChanges(); + assertModified(filterMonitor, passed); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderDeletionIsNotNotifiedWhenFileDoesNotMatchFilter() throws Exception { + + File folder = new File(monitoredFolder, "nestedFolderForFilteredDeletion"); + createFolder(folder); + + File f = new File(folder, "testFileInNestedFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + File excluded = new File(folder, "testFileInNestedFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(folder, "testFileInNestedFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + flushNotifications(filterMonitor); + + deleteFile(f); + filterMonitor.scrapeLogsForChanges(); + assertNothingDeleted(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingDeleted(filterMonitor); + + // Now check other files do get past the filter + deleteFile(excluded); + deleteFile(passed); + filterMonitor.scrapeLogsForChanges(); + assertDeleted(filterMonitor, passed); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderCreationIsNotNotifiedWhenNeitherFolderNorFileMatchFilter() throws Exception { + + File includedFolder = new File(monitoredFolder, "includedNestedFolderForFilteredCreation"); + File excludedFolder = new File(monitoredFolder, "excludedNestedFolderForFilteredCreation"); + createFolder(includedFolder); + createFolder(excludedFolder); + + filterMonitor.scrapeLogsForChanges(); + // We should get told about only one of the folders + assertCreated(filterMonitor, includedFolder); + + // Update any marks so we don't see that notification again + flushNotifications(filterMonitor); + + // We should still be monitoring in both folders + File iif = new File(includedFolder, "testFileInNestedFolderCreationIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(iif); + File ief = new File(includedFolder, "testFileInNestedFolderCreationIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(ief); + + File eif = new File(excludedFolder, "testFileInNestedFolderCreationIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(eif); + File eef = new File(excludedFolder, "testFileInNestedFolderCreationIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(eef); + + filterMonitor.scrapeLogsForChanges(); + // We should get told about everything whose base name matches the filter + assertCreated(filterMonitor, iif, eif); + } + + @Test + public void testFileInNestedFolderModificationIsNotNotifiedWhenNeitherFolderNorFileMatchFilter() throws Exception { + + File includedFolder = new File(monitoredFolder, "includedNestedFolderForFilteredModification"); + File excludedFolder = new File(monitoredFolder, "excludedNestedFolderForFilteredModification"); + createFolder(includedFolder); + createFolder(excludedFolder); + + // We should still be monitoring in both folders + File iif = new File(includedFolder, "testFileInNestedFolderModificationIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(iif); + File ief = new File(includedFolder, "testFileInNestedFolderModificationIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(ief); + + File eif = new File(excludedFolder, "testFileInNestedFolderModificationIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(eif); + File eef = new File(excludedFolder, "testFileInNestedFolderModificationIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(eef); + + flushNotifications(filterMonitor); + + appendSomething(iif); + appendSomething(ief); + appendSomething(eif); + appendSomething(eef); + + filterMonitor.scrapeLogsForChanges(); + // We should get told about everything whose base name matches the filter + assertModified(filterMonitor, iif, eif); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderDeletionIsNotNotifiedWhenNeitherFolderNorFileMatchFilter() throws Exception { + + File includedFolder = new File(monitoredFolder, "includedNestedFolderForFilteredDeletion"); + File excludedFolder = new File(monitoredFolder, "excludedNestedFolderForFilteredDeletion"); + createFolder(includedFolder); + createFolder(excludedFolder); + + // We should still be monitoring in both folders + File iif = new File(includedFolder, "testFileInNestedFolderDeletionIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(iif); + File ief = new File(includedFolder, "testFileInNestedFolderDeletionIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(ief); + + File eif = new File(excludedFolder, "testFileInNestedFolderDeletionIsNotNotifiedWhenFolderDoesNotMatchFilterincludedfile"); + createFile(eif); + File eef = new File(excludedFolder, "testFileInNestedFolderDeletionIsNotNotifiedWhenFolderDoesNotMatchFilterexcludedfile"); + createFile(eef); + + flushNotifications(filterMonitor); + + deleteFile(iif); + deleteFile(ief); + deleteFile(eif); + deleteFile(eef); + + filterMonitor.scrapeLogsForChanges(); + // We should get told about everything whose base name matches the filter + assertDeleted(filterMonitor, iif, eif); + } + + @Test + public void testFileInNestedFolderCreationIsNotNotifiedForDirectoryTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderCreationIsNotNotifiedForDirectoryTypeFilter"); + createFolder(folder); + flushNotifications(directoryfilterMonitor); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + directoryfilterMonitor.scrapeLogsForChanges(); + // We should get told about every directory + assertCreated(directoryfilterMonitor, childFolder); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderCreationIsNotNotifiedForFileTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderCreationIsNotNotifiedForFileTypeFilter"); + createFolder(folder); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + filefilterMonitor.scrapeLogsForChanges(); + // We should get told about every directory + assertCreated(filefilterMonitor, childFile); + } + + @Test + public void testFileInNestedFolderModificationIsNotNotifiedForDirectoryTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderModificationIsNotNotifiedForDirectoryTypeFilter"); + createFolder(folder); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + flushNotifications(directoryfilterMonitor); + + appendSomething(childFile); + + // We don't check timestamps on folders, so these notifications should have no effect + updateTimestamp(folder); + updateTimestamp(childFolder); + // We're including self, so we expect to get notified about the root folder, too + updateTimestamp(monitoredFolder); + + directoryfilterMonitor.scrapeLogsForChanges(); + // We should get told about every directory + assertNothingModified(directoryfilterMonitor); + } + + @Test + public void testFileInNestedFolderModificationIsNotifiedForFileTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderModificationIsNotNotifiedForFileTypeFilter"); + createFolder(folder); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + flushNotifications(filefilterMonitor); + + appendSomething(childFile); + updateTimestamp(folder); + updateTimestamp(childFolder); + updateTimestamp(monitoredFolder); + + filefilterMonitor.scrapeLogsForChanges(); + // We should get told about every directory + assertModified(filefilterMonitor, childFile); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderDeletionIsNotifiedForDirectoryTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderDeletionIsNotNotifiedForDirectoryTypeFilter"); + // Get rid of any clutter we don't know about in the monitored folder (we want to make sure we notice it being deleted) + deleteFile(monitoredFolder); + createFolder(monitoredFolder); + createFolder(folder); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + flushNotifications(directoryfilterMonitor); + + deleteFile(childFile); + deleteFile(childFolder); + deleteFile(folder); + deleteFile(monitoredFolder); + + directoryfilterMonitor.scrapeLogsForChanges(); + // We should get told about every directory, but not the file + assertDeleted(directoryfilterMonitor, monitoredFolder, folder, childFolder); + } + + @Test + public void testFileInNestedFolderDeletionIsNotifiedForFileTypeFilter() throws Exception { + + File folder = new File(monitoredFolder, "testFileInNestedFolderDeletionIsNotifiedForFileTypeFilter"); + createFolder(folder); + + File childFile = new File(folder, "childFile"); + createFile(childFile); + File childFolder = new File(folder, "childFolder"); + createFolder(childFolder); + + flushNotifications(filefilterMonitor); + + // deleteFile(childFile); + deleteFile(childFolder); + deleteFile(folder); + + filefilterMonitor.scrapeLogsForChanges(); + // We should get told about every file (but no folders) + assertDeleted(filefilterMonitor, childFile); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderCreationAndModificationIsNotifiedAsCreation() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderCreationAndModificationIsNotifiedAsCreation"); + createFile(f); + appendSomething(f); + + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderCreationAndDeletionIsNotNotifiedAtAll() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderCreationAndDeletionIsNotifiedAsCreation"); + createFile(f); + deleteFile(f); + + recursiveMonitor.scrapeLogsForChanges(); + assertNothingCreated(recursiveMonitor); + assertNothingDeleted(recursiveMonitor); + assertNothingModified(recursiveMonitor); + } + + @Test + public void testFileInFolderCreationAndThenModificationAndThenDeletionIsNotNotifiedAtAll() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderCreationAndDeletionIsNotifiedAsCreation"); + createFile(f); + appendSomething(f); + deleteFile(f); + + recursiveMonitor.scrapeLogsForChanges(); + assertNothingCreated(recursiveMonitor); + assertNothingDeleted(recursiveMonitor); + assertNothingModified(recursiveMonitor); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderCreationIsNotNotifiedWhenItDoesNotMatchFilter() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + + filterMonitor.scrapeLogsForChanges(); + assertNothingCreated(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingModified(filterMonitor); + + // Now check other files do get past the filter + File excluded = new File(monitoredFolder, "testFileInFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(monitoredFolder, "testFileInFolderCreationIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + + filterMonitor.scrapeLogsForChanges(); + assertCreated(filterMonitor, passed); + } + + @Test + public void testFileInFolderModficationIsNotNotifiedWhenItDoesNotMatchFilter() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + File excluded = new File(monitoredFolder, "testFileInFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(monitoredFolder, "testFileInFolderModificationIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + flushNotifications(filterMonitor); + + appendSomething(f); + filterMonitor.scrapeLogsForChanges(); + assertNothingModified(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingModified(filterMonitor); + + // Now check other files do get past the filter + appendSomething(excluded); + appendSomething(passed); + filterMonitor.scrapeLogsForChanges(); + assertModified(filterMonitor, passed); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilter() throws Exception { + + File f = new File(monitoredFolder, "testFileInFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterexcludedfile"); + createFile(f); + File excluded = new File(monitoredFolder, "testFileInFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterStillexcluded"); + createFile(excluded); + File passed = new File(monitoredFolder, "testFileInFolderDeletionIsNotNotifiedWhenItDoesNotMatchFilterincluded"); + createFile(passed); + flushNotifications(filterMonitor); + + deleteFile(f); + filterMonitor.scrapeLogsForChanges(); + assertNothingDeleted(filterMonitor); + assertNothingDeleted(filterMonitor); + assertNothingDeleted(filterMonitor); + + // Now check other files do get past the filter + deleteFile(excluded); + deleteFile(passed); + filterMonitor.scrapeLogsForChanges(); + assertDeleted(filterMonitor, passed); + } + + @Test + public void testMonitoringOfFileAsADirectoryDoesNotProduceNotifications() throws Exception { + + appendSomething(monitoredFile); + confusedFolderMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFolderMonitor); + assertNothingModified(confusedFolderMonitor); + assertNothingDeleted(confusedFolderMonitor); + + flushNotifications(confusedFolderMonitor); + deleteFile(monitoredFile); + confusedFolderMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFolderMonitor); + assertNothingModified(confusedFolderMonitor); + assertNothingDeleted(confusedFolderMonitor); + + flushNotifications(confusedFolderMonitor); + createFile(monitoredFile); + confusedFolderMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFolderMonitor); + assertNothingModified(confusedFolderMonitor); + assertNothingDeleted(confusedFolderMonitor); + } + + @Test + public void testMonitoringOfDirectoryAsAFileDoesNotProduceNotifications() throws Exception { + + File file = new File(monitoredFolder, "testMonitoringOfDirectoryAsAFileDoesNotProduceNotifications"); + createFile(file); + confusedFileMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFileMonitor); + assertNothingModified(confusedFileMonitor); + assertNothingDeleted(confusedFileMonitor); + + flushNotifications(confusedFileMonitor); + deleteFile(file); + confusedFileMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFileMonitor); + assertNothingModified(confusedFileMonitor); + assertNothingDeleted(confusedFileMonitor); + + flushNotifications(confusedFileMonitor); + createFile(file); + confusedFileMonitor.scrapeLogsForChanges(); + assertNothingCreated(confusedFileMonitor); + assertNothingModified(confusedFileMonitor); + assertNothingDeleted(confusedFileMonitor); + } + + @Mode(TestMode.FULL) + @Test + public void testFileCreationIsNotifiedWhenMonitoredFileDoesNotInitiallyExist() throws Exception { + + // Don't assume test ordering + if (nonexistentFile.exists()) { + deleteFile(nonexistentFile); + flushNotifications(nonexistentFileMonitor); + } + createFile(nonexistentFile); + nonexistentFileMonitor.scrapeLogsForChanges(); + assertCreated(nonexistentFileMonitor, nonexistentFile); + } + + @Mode(TestMode.FULL) + @Test + public void testFileModificationIsNotifiedWhenMonitoredFileDoesNotInitiallyExist() throws Exception { + // Don't assume test ordering + if (!nonexistentFile.exists()) { + createFile(nonexistentFile); + flushNotifications(nonexistentFileMonitor); + } + + appendSomething(nonexistentFile); + nonexistentFileMonitor.scrapeLogsForChanges(); + assertModified(nonexistentFileMonitor, nonexistentFile); + } + + @Test + public void testFileDeletionIsNotifiedWhenMonitoredFileDoesNotInitiallyExist() throws Exception { + // Don't assume test ordering + if (!nonexistentFile.exists()) { + createFile(nonexistentFile); + flushNotifications(nonexistentFileMonitor); + } + deleteFile(nonexistentFile); + nonexistentFileMonitor.scrapeLogsForChanges(); + assertDeleted(nonexistentFileMonitor, nonexistentFile); + } + + @Test + public void testFolderCreationIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist() throws Exception { + + // Don't assume test ordering + if (!nonexistentFolder.exists()) { + createFolder(nonexistentFolder); + flushNotifications(nonexistentFolderMonitor); + } + File file = new File(nonexistentFolder, "testFolderCreationIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist"); + createFile(file); + nonexistentFolderMonitor.scrapeLogsForChanges(); + assertCreated(nonexistentFolderMonitor, file); + } + + @Mode(TestMode.FULL) + @Test + public void testFolderModificationIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist() throws Exception { + // Don't assume test ordering + if (!nonexistentFolder.exists()) { + createFolder(nonexistentFolder); + flushNotifications(nonexistentFolderMonitor); + } + + File file = new File(nonexistentFolder, "testFolderModificationIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist"); + createFile(file); + flushNotifications(nonexistentFolderMonitor); + + appendSomething(file); + nonexistentFolderMonitor.scrapeLogsForChanges(); + assertModified(nonexistentFolderMonitor, file); + } + + @Mode(TestMode.FULL) + @Test + public void testFolderDeletionIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist() throws Exception { + // Don't assume test ordering + if (!nonexistentFolder.exists()) { + createFolder(nonexistentFolder); + flushNotifications(nonexistentFolderMonitor); + } + + File file = new File(nonexistentFolder, "testFolderDeletionIsNotifiedWhenMonitoredFolderDoesNotInitiallyExist"); + createFile(file); + flushNotifications(nonexistentFolderMonitor); + + deleteFile(file); + nonexistentFolderMonitor.scrapeLogsForChanges(); + assertDeleted(nonexistentFolderMonitor, file); + } + + @Test + public void testFileInFolderTimestampChanging() throws Exception { + // Make a file to delete (and make sure we noticed it) + File f = new File(monitoredFolder, "testFileInFolderTimestampChanging"); + createFile(f); + flushNotifications(recursiveMonitor); + + // Make it a lot older than it is (should still be considered modified) + updateTimestamp(f); + + recursiveMonitor.scrapeLogsForChanges(); + assertModified(recursiveMonitor, f); + + } + + @Test + public void testFileInFolderDeletionIsNotified() throws Exception { + // Make a file to delete (and make sure we noticed it) + File f = new File(monitoredFolder, "testFileInFolderDeletionIsNotified"); + createFile(f); + flushNotifications(recursiveMonitor); + + // Delete the file: it should be added to the 'deleted' list + assertTrue("File should be deleted on the filesystem", f.delete()); + recursiveMonitor.scrapeLogsForChanges(); + assertDeleted(recursiveMonitor, f); + + } + + @Test + public void testAllContentsAreIncludedForFileInFolderDeletion() throws Exception { + // Make a file to delete (and make sure we noticed it) + File folder = new File(monitoredFolder, "testFileInFolderDeletionIsNotified"); + createFolder(folder); + File f = new File(folder, "childFile"); + createFile(f); + flushNotifications(recursiveMonitor); + + // Delete the folder: it and its contents should be added to the 'deleted' list + deleteFile(folder); + recursiveMonitor.scrapeLogsForChanges(); + assertDeleted(recursiveMonitor, f, folder); + } + + @Mode(TestMode.FULL) + @Test + public void testFileInNestedFolderDeletionIsNotified() throws Exception { + // Make a file to delete (and make sure we noticed it) + File folder = new File(monitoredFolder, "nestedFolderForDeletion"); + createFolder(folder); + File f = new File(folder, "testFileInNestedFolderDeletionIsNotified"); + createFile(f); + flushNotifications(recursiveMonitor); + flushNotifications(nonRecursiveMonitor); + + // Delete the file: it should be added to the 'deleted' list + deleteFile(f); + recursiveMonitor.scrapeLogsForChanges(); + nonRecursiveMonitor.scrapeLogsForChanges(); + assertDeleted(recursiveMonitor, f); + assertNothingDeleted(nonRecursiveMonitor); + + } + + @Test + public void testFileInNestedFolderFolderDeletionIsNotified() throws Exception { + File bfolder = new File(monitoredFolder, "testFileInNestedFolderFolderDeletionIsNotified"); + // Get rid of any clutter we don't know about in the monitored folder (we want to make sure we notice it being deleted) + // But don't assume test ordering -- don't try to delete if it doesn't exist! + if (monitoredFolder.exists()) + deleteFile(monitoredFolder); + createFolder(monitoredFolder); + createFolder(bfolder); + + File bchildFile = new File(bfolder, "childFile"); + createFile(bchildFile); + File bchildFolder = new File(bfolder, "childFolder"); + createFolder(bchildFolder); + + flushNotifications(recursiveMonitor); + + deleteFile(bchildFile); + deleteFile(bchildFolder); + deleteFile(bfolder); + deleteFile(monitoredFolder); + + recursiveMonitor.scrapeLogsForChanges(); + // We should get told about every directory + assertDeleted(recursiveMonitor, bfolder, bchildFolder, bchildFile); + + // Make a file to delete (and make sure we noticed it) + File folder = new File(monitoredFolder, "testFileInNestedFolderFolderDeletionIsNotified"); + createFolder(folder); + File childFolder = new File(folder, "testFileInNestedFolderDeletionIsNotified"); + createFile(childFolder); + flushNotifications(recursiveMonitor); + flushNotifications(nonRecursiveMonitor); + + // Delete the folder: it and its contents should be added to the 'deleted' list + deleteFile(childFolder); + deleteFile(folder); + recursiveMonitor.scrapeLogsForChanges(); + nonRecursiveMonitor.scrapeLogsForChanges(); + assertDeleted(recursiveMonitor, folder, childFolder); + assertDeleted(nonRecursiveMonitor, folder); + + } + + @Test + public void testCreationOfMonitoredFolderIsNotifiedOnlyWhenIgnoreSelfIsTrue() throws Exception { + // Get rid of anything in the monitored folder so we can make it again + deleteFile(monitoredFolder); + flushNotifications(recursiveMonitor); + flushNotifications(monitorSelfMonitor); + + monitoredFolder.mkdirs(); + recursiveMonitor.scrapeLogsForChanges(); + monitorSelfMonitor.scrapeLogsForChanges(); + assertNothingCreated(recursiveMonitor); + assertCreated(monitorSelfMonitor, monitoredFolder); + + // Now wait and make sure we don't get told again about the deleted file + flushNotifications(recursiveMonitor); + flushNotifications(monitorSelfMonitor); + recursiveMonitor.scrapeLogsForChanges(); + monitorSelfMonitor.scrapeLogsForChanges(); + assertNothingCreated(recursiveMonitor); + assertNothingCreated("After an initial (correct) creation report, ", monitorSelfMonitor); + + } + + @Mode(TestMode.FULL) + @Test + public void testDeletionOfMonitoredFolderIsNotifiedOnlyWhenIgnoreSelfIsTrue() throws Exception { + // Get rid of anything in the monitored folder so we can safely delete it (by deleting it) + deleteFile(monitoredFolder); + // Now make the actual folder back (so when we delete it we know what notification to expect) + monitoredFolder.mkdirs(); + flushNotifications(recursiveMonitor); + flushNotifications(monitorSelfMonitor); + + deleteFile(monitoredFolder); + // Delete the whole folder: it should be added to the 'deleted' list + recursiveMonitor.scrapeLogsForChanges(); + monitorSelfMonitor.scrapeLogsForChanges(); + assertNothingDeleted(recursiveMonitor); + assertDeleted(monitorSelfMonitor, monitoredFolder); + + // Now wait and make sure we don't get told again about the deleted file + flushNotifications(recursiveMonitor); + flushNotifications(monitorSelfMonitor); + recursiveMonitor.scrapeLogsForChanges(); + monitorSelfMonitor.scrapeLogsForChanges(); + assertNothingDeleted(recursiveMonitor); + assertNothingDeleted("After an initial (correct) deletion report, ", monitorSelfMonitor); + + } +} diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileNotificationMBeanTest.java b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileNotificationMBeanTest.java new file mode 100755 index 00000000000..6a2f2827273 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/FileNotificationMBeanTest.java @@ -0,0 +1,778 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.fat; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.UndeclaredThrowableException; +import java.net.ConnectException; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import javax.management.JMX; +import javax.management.MBeanServerConnection; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.filemonitor.FileNotificationMBean; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; + +/** + * + */ +public class FileNotificationMBeanTest extends AbstractNotificationTest { + + /** Used for sanity checks of changes in the timed scan case */ + private static final MonitorReader recursiveMonitor = new MonitorReader("-RECURSIVETESTMONITOROUTPUT-", "recursive folder monitor"); + private static final MonitorReader manualMonitor = new MonitorReader("-MANUALMONITOROUTPUT-", "externally triggered folder monitor"); + + private static JMXConnector jmxConnector; + private static FileNotificationMBean mbean; + + /** + * JUnit guarantees that this gets run after the static set up in the superclass (as long as the names are different). + */ + @BeforeClass + public static void jmxSetUp() throws Exception { + + // Wait for the JMX server to be started + assertNotNull("The application 'IBMJMXConnectorREST' did not report it was started", + server.waitForStringInLog("CWWKT0016I.*IBMJMXConnectorREST")); + // Wait for secure port to be ready + assertNotNull("SSL port is not ready", + server.waitForStringInLog("CWWKO0219I.*ssl")); + assertNotNull("The server is not ready to run a smarter planet", + server.waitForStringInLog("CWWKF0011I")); + assertNotNull("The security service is not ready", + server.waitForStringInLog("CWWKS0008I")); + + trustEverything(); + + Map fileTransferConfig = new HashMap(); + fileTransferConfig.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); + fileTransferConfig.put(JMXConnector.CREDENTIALS, new String[] { "theUser", "thePassword" }); + fileTransferConfig.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + fileTransferConfig.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); + + JMXServiceURL jmxServiceUrl = new JMXServiceURL("REST", server.getHostname(), server + .getHttpDefaultSecurePort(), "/IBMJMXConnectorREST"); + long connectTime = System.currentTimeMillis(); + try { + jmxConnector = JMXConnectorFactory.connect(jmxServiceUrl, fileTransferConfig); + + MBeanServerConnection mbeanConn = jmxConnector.getMBeanServerConnection(); + final ObjectName name = new ObjectName(com.ibm.ws.kernel.filemonitor.FileNotificationMBean.INSTANCE_NAME); + mbean = JMX.newMBeanProxy(mbeanConn, name, + FileNotificationMBean.class); + + assertNotNull("We should have got access to the FileNotificationMBean", mbean); + } catch (ConnectException e) { + DateFormat formatter = new SimpleDateFormat("dd/MMM/yyyy HH:mm:ss:SSS z"); + String timestamp = formatter.format(new Date(connectTime)); + fail("Could not get a connection to the JMX server using URL " + jmxServiceUrl + ".\n Tried at " + timestamp + ".\n The exception was " + e); + } + + } + + /** + * Adjusts our SSL code so that it doesn't complain when we connect to servers using untrusted + * certificates. + * + * @throws NoSuchAlgorithmException + * @throws KeyManagementException + */ + private static void trustEverything() throws NoSuchAlgorithmException, KeyManagementException { + TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + + } + + @AfterClass + public static void classTearDown() throws MalformedObjectNameException, NullPointerException, IOException { + if (jmxConnector != null) { + jmxConnector.close(); + } + } + + @Before + public void setUp() throws Exception { + + } + + @After + public void tearDown() throws Exception { + // Clear up after any tests which may have deleted the monitored folder + if (!monitoredFolder.exists()) { + monitoredFolder.mkdirs(); + // Nothing we're using is monitoring the folder itself + } + + // Get rid of any dangling notifications from tests + flushNotifications(recursiveMonitor); + flushNotifications(); + + } + + @Test + public void testFileInFolderCreationIsNotNotifiedWithoutMBeanRequest() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderModificationIsNotNotifiedWithoutMBeanRequest"); + createFile(f); + + manualMonitor.scrapeLogsForChanges(); + // We shouldn't be told about anything, since we haven't triggered the scan + assertNothingCreated(manualMonitor); + assertNothingDeleted(manualMonitor); + assertNothingModified(manualMonitor); + + // Sanity check - the recursive monitor should have noticed + HashSet created = new HashSet(); + created.add(f); + recursiveMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(recursiveMonitor, f); + } + + @Test + public void testFileInFolderCreationIsNotNotifiedForMBeanRequestOnUnrelatedFile() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderCreationIsNotNotifiedForMBeanRequestOnUnrelatedFile"); + createFile(f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + + Collection wrongFileSet = new HashSet(); + wrongFileSet.add(monitoredFile.getAbsolutePath()); + + try { + // Notify changes, but for the wrong file + mbean.notifyFileChanges(wrongFileSet, null, null); + manualMonitor.scrapeLogsForChanges(); + // We shouldn't be told about anything since we passed through the wrong file + assertNothingCreated(manualMonitor); + assertNothingDeleted(manualMonitor); + assertNothingModified(manualMonitor); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInFolderCreationIsNotNotifiedForMBeanRequestOfWrongChangeType() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderCreationIsNotNotifiedForMBeanRequestOfWrongChangeType"); + createFile(f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + + Collection wrongFileSet = new HashSet(); + wrongFileSet.add(monitoredFile.getAbsolutePath()); + + try { + // Now request a notification, but of modification, so the wrong type + mbean.notifyFileChanges(null, fileSet, null); + manualMonitor.scrapeLogsForChanges(); + // We shouldn't be told about anything, since we have the right file but the wrong type + assertNothingCreated(manualMonitor); + assertNothingDeleted(manualMonitor); + assertNothingModified(manualMonitor); + + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + /** + * In the externally triggered case, we need to be specific about what we think might have changed. + * If we have a recursive monitor, and we pass the parent folder as the parameter on the mbean call, + * we won't get told about things inside that folder which have changed. + */ + @Mode(TestMode.FULL) + @Test + public void testFileInFolderModificationIsNotNotifiedWhenWePassBackTheParentFolder() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderModificationIsNotNotifiedWhenWePassBackTheParentFolder"); + createFile(f); + + Collection folderSet = new HashSet(); + folderSet.add(monitoredFolder.getAbsolutePath()); + Collection created = new HashSet(); + created.add(monitoredFolder); + + try { + mbean.notifyFileChanges(folderSet, null, null); + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertNothingCreated(manualMonitor); + assertNothingDeleted(manualMonitor); + assertNothingModified(manualMonitor); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInFolderCreationIsNotifiedAfterRequest() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderCreationIsNotifiedAfterRequest"); + createFile(f); + + // Sanity check - the recursive monitor should have noticed + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + + try { + // Ok, let's actually get our notification now + mbean.notifyFileChanges(fileSet, null, null); + //manualMonitor.scrapeLogsForChanges(); + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, f); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInFolderModificationIsNotifiedAfterRequest() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderModificationIsNotifiedAfterRequest"); + createFile(f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection changed = new HashSet(); + changed.add(f); + + try { + // Setup for test + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(changed, null, null); + assertCreated(manualMonitor, f); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + + //////// Actual test + // Now let's make a change and get that notification + appendSomething(f); + mbean.notifyFileChanges(null, fileSet, null); + manualMonitor.scrapeLogsForExpectedChanges(null, changed, null); + assertModified(manualMonitor, f); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInFolderDeletionIsNotifiedAfterRequest() throws Throwable { + + File f = new File(monitoredFolder, "testFileInFolderDeletionIsNotifiedAfterRequest"); + createFile(f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection deleted = new HashSet(); + deleted.add(f); + + try { + // Setup for test + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(deleted, null, null); + assertCreated(manualMonitor, f); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + + // Now let's make a change and get that notification + deleteFile(f); + mbean.notifyFileChanges(null, null, fileSet); + manualMonitor.scrapeLogsForExpectedChanges(null, null, deleted); + assertDeleted(manualMonitor, f); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderCreationIsNotifiedAfterRequestAboutFolder() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderCreationIsNotifiedAfterRequestAboutFolder"); + createFolder(folder); + + File f = new File(folder, "childFile"); + createFile(f); + + // Sanity check - the recursive monitor should have noticed + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f, folder); + + Collection fileSet = new HashSet(); + fileSet.add(folder.getAbsolutePath()); + Collection created = new HashSet(); + created.add(folder); + + try { + // Ok, let's actually get our notification now + mbean.notifyFileChanges(fileSet, null, null); + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, folder); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderModificationIsNotNotifiedAfterRequestAboutFolder() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderModificationIsNotifiedAfterRequestAboutFolder"); + createFolder(folder); + + File f = new File(folder, "childFile"); + createFile(f); + + // Sanity check - the recursive monitor should have noticed + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f, folder); + + Collection fileSet = new HashSet(); + fileSet.add(folder.getAbsolutePath()); + + try { + flushNotifications(); + + // Now let's make a change and get that notification + appendSomething(f); + updateTimestamp(folder); + mbean.notifyFileChanges(null, fileSet, null); + manualMonitor.scrapeLogsForChanges(); + // We could only get told about the folder modification, and we don't tend to generate those + // events except for delete-create cycles + assertNothingModified(manualMonitor); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderDeletionIsNotifiedAfterRequestAboutFolder() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderDeletionIsNotifiedAfterRequestAboutFolder"); + + createFolder(folder); + Collection fileSet = new HashSet(); + Collection files = new HashSet(); + fileSet.add(folder.getAbsolutePath()); + files.add(folder); + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + + try { + + // Setup for test + // Create folder + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + // Create nested file + File f = new File(folder, "childFile"); + createFile(f); + Collection fileSet2 = new HashSet(); + fileSet2.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + mbean.notifyFileChanges(fileSet2, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, f); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + + // Now let's make a change and get that notification + deleteFile(folder); + mbean.notifyFileChanges(null, null, fileSet); + manualMonitor.scrapeLogsForExpectedChanges(null, null, created); + assertDeleted(manualMonitor, folder); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderCreationIsNotifiedAfterRequestAboutFile() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderCreationIsNotifiedAfterRequestAboutFile"); + createFolder(folder); + + File f = new File(folder, "childFile"); + createFile(f); + + // Sanity check - the recursive monitor should have noticed + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f, folder); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + created.add(folder); + + try { + // Ok, let's actually get our notification now + mbean.notifyFileChanges(fileSet, null, null); + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + // defect 87702 requires that we generate events for parent directories of paths that we found files for + // even if the external scan has not requested them. + assertCreated(manualMonitor, f, folder); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderModificationIsNotifiedAfterRequestAboutFile() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderModificationIsNotifiedAfterRequestAboutFile"); + createFolder(folder); + Collection fileSet = new HashSet(); + Collection files = new HashSet(); + fileSet.add(folder.getAbsolutePath()); + files.add(folder); + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + + try { + + // Setup for test + // Create folder + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + // Create nested file + File f = new File(folder, "childFile"); + createFile(f); + Collection fileSet2 = new HashSet(); + fileSet2.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + mbean.notifyFileChanges(fileSet2, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, f); + flushNotifications(recursiveMonitor); // Need to clear recursive monitor + + // Actual test + // Now let's make a change and get that notification + appendSomething(f); + updateTimestamp(folder); + mbean.notifyFileChanges(null, fileSet2, null); + manualMonitor.scrapeLogsForChanges(); + // defect 87702 requires that we generate events for parent directories of paths that we found files for + // even if the external scan has not requested them, but only for deletion and creation, not modification + assertModified(manualMonitor, f); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testFileInNestedFolderDeletionIsNotifiedAfterRequestAboutFile() throws Throwable { + + File folder = new File(monitoredFolder, "testFileInNestedFolderDeletionIsNotifiedAfterRequestAboutFile"); + createFolder(folder); + Collection fileSet = new HashSet(); + Collection files = new HashSet(); + fileSet.add(folder.getAbsolutePath()); + files.add(folder); + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + + try { + + // Setup for test + // Create folder + mbean.notifyFileChanges(fileSet, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(files, null, null); + assertCreated(manualMonitor, folder); + flushNotifications(); + // Create nested file + File f = new File(folder, "childFile"); + createFile(f); + + // We're only interested in changes to the file, not the folder + // This file: + Collection fileSet2 = new HashSet(); + fileSet2.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + mbean.notifyFileChanges(fileSet2, null, null); // Need to let them know we created a file that we are going to modify later + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, f); + flushNotifications(); + + // Now let's make a change and get that notification + deleteFile(folder); + mbean.notifyFileChanges(null, null, fileSet2); + manualMonitor.scrapeLogsForChanges(); + // defect 87702 requires that we generate events for parent directories of paths that we found files for + // even if the external scan has not requested them. + assertDeleted(manualMonitor, f, folder); + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + private void flushNotifications() throws Exception { + flushNotifications(manualMonitor); + } + + /* + * The FileNotificationMbean method for notifyFileChanges will now + * cache unrequested/unnotified file changes, so that they can be requested on + * later calls. However, this means that certain unrequested options + * can become invalid based on later filesystem changes. + */ + + // State change loop to track the status of changed files. + // D = Delete, C = Create, M = modified, - = not in any list, X = not possible + // Example, "CM = C" would mean create followed by a modify would + // result in the file being in the create list + // C = C + // D = D + // M = M + // CC = X + // CD = - // testPersistedNotificationCaseCD() + // CM = C // testPersistedNotificationCaseCM() + // DC = M // testPersistedNotificationCaseCM() + // DD = X + // DM = X + // MC = X + // MD = D // testPersistedNotificationCaseMD() + // MM = M + + @Test + public void testPersistedNotificationCaseCD() throws Throwable { + + File folder = new File(monitoredFolder, "testPersistedNotificationCaseCD"); + + try { + + createFolder(folder); + File f = new File(folder, "childFile1"); + createFile(f); + + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + created.add(folder); + + mbean.notifyFileChanges(null, null, null); // Does not notify of a new file create + assertNothingChanged(manualMonitor); + deleteFile(folder); // Now remove this new file from the filesystem + mbean.notifyFileChanges(fileSet, null, null); // Now ask to create the file, but its gone + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Test + public void testPersistedNotificationCaseCM() throws Throwable { + + File folder = new File(monitoredFolder, "testPersistedNotificationCaseCM"); + + try { + + createFolder(folder); + File f = new File(folder, "childFile1"); + createFile(f); + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + created.add(folder); + mbean.notifyFileChanges(null, null, null); // Does not notify of a new file create + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + appendSomething(f); // Modify this new file + mbean.notifyFileChanges(null, fileSet, null); // Notify of a modify, but we didn't request create yet + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + mbean.notifyFileChanges(fileSet, null, null); // Notify of a create now, this is valid + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, folder, f); // Should be shown as created now. + + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Mode(TestMode.FULL) + @Test + public void testPersistedNotificationCaseMD() throws Throwable { + + File folder = new File(monitoredFolder, "testPersistedNotificationCaseMD"); + + try { + + createFolder(folder); + File f = new File(folder, "childFile1"); + createFile(f); + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + created.add(folder); + mbean.notifyFileChanges(fileSet, null, null); // Create a new file + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, folder, f); // Should be shown as created now. + flushNotifications(); + appendSomething(f); // Modify this new file + mbean.notifyFileChanges(null, null, null); // Don't notify of the modify + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + flushNotifications(); + deleteFile(f); // Remove the file that has a pending create being stored in monitorholder + mbean.notifyFileChanges(fileSet, null, null); // Now try to notify of a create + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); // The create is no longer valid, so nothing should change + mbean.notifyFileChanges(null, null, fileSet); // Now ask for the delete + manualMonitor.scrapeLogsForExpectedChanges(null, null, created); + assertDeleted(manualMonitor, f); + + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + @Mode(TestMode.FULL) + @Test + public void testPersistedNotificationCaseDC() throws Throwable { + + File folder = new File(monitoredFolder, "testPersistedNotificationCaseDC"); + + try { + + createFolder(folder); + File f = new File(folder, "childFile1"); + createFile(f); + // Sanity check - the recursive monitor should have noticed + recursiveMonitor.scrapeLogsForChanges(); + assertCreated(recursiveMonitor, f, folder); + Collection fileSet = new HashSet(); + fileSet.add(f.getAbsolutePath()); + Collection created = new HashSet(); + created.add(f); + created.add(folder); + mbean.notifyFileChanges(fileSet, null, null); // Create a new file + manualMonitor.scrapeLogsForExpectedChanges(created, null, null); + assertCreated(manualMonitor, folder, f); // Should be shown as created now. + flushNotifications(); + deleteFile(f); // Remove the file that has a pending create being stored in monitorholder + mbean.notifyFileChanges(null, null, null); // Don't notify of the delete + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + flushNotifications(); + createFile(f); // Now recreate this file on the filesystem again + // Now try to notify of a create, but the only valid option + // is a modify, because we never notified of a delete + mbean.notifyFileChanges(fileSet, null, null); + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); // Nothing should have changed + // Let's ask for a delete too, this was once a valid option + mbean.notifyFileChanges(null, null, fileSet); + manualMonitor.scrapeLogsForChanges(); + assertNothingChanged(manualMonitor); + flushNotifications(); + // Now notify for a modify, this is the only valid option + mbean.notifyFileChanges(null, fileSet, null); + manualMonitor.scrapeLogsForExpectedChanges(null, created, null); + assertModified(manualMonitor, f); + + } catch (UndeclaredThrowableException e) { + // Unwrap the exception (but rethrow, so we get a nice stack trace in the failure report) + throw e.getCause(); + } + } + + /** + * @param manualMonitor + */ + private void assertNothingChanged(MonitorReader manualMonitor) { + assertNothingModified(manualMonitor); + assertNothingCreated(manualMonitor); + assertNothingDeleted(manualMonitor); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/MonitorReader.java b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/MonitorReader.java new file mode 100755 index 00000000000..b8836c047e0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/fat/src/com/ibm/ws/kernel/filemonitor/fat/MonitorReader.java @@ -0,0 +1,223 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +class MonitorReader { + /** + * The interval on the monitors is 150ms. Allow a big multiple of that, since we also have to wait + * for the LibertyServer to poll the log for changes, and it only checks every 300ms. As the number + * of monitors we have increases, it also takes longer for each notification to get into the log. + * (I've counted intervals of 1s from the first notification to the last one.) + * + * However, since we're waiting for updates to stop, we would prefer that this timeout not be too long, + * since it sets a minimum delay for the last "no more changes" cycle. We *could* add onScanStart() and + * onScanEnd() events, but by the design of the monitors there's no promise that all results come in + * during a single scan. + * + * Inherently fragile, if net or server runs slower than expected. + * + * Better solution is to avoid relying on it -- use scrapeLogsForExpectedChanges. + */ + static final int TIMEOUT = 2410; + + // Not thread-safe, but this code is unlikely to run multi-threaded, being a test helper + private static final DateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss:SSS"); + + final String name; + + final Collection baseline = new ArrayList(); + final List created = new ArrayList(); + final List modified = new ArrayList(); + final List deleted = new ArrayList(); + + // When we gave up scraping the log for a string + long lastSearchTime; + + private final String baselineMarker; + private final Pattern baselineRegexp; + private final String changeMarker; + private final Pattern changeRegexp; + + MonitorReader(String eyeCatcher, String name) { + this.name = name; + baselineMarker = eyeCatcher + "onBaseline"; + baselineRegexp = Pattern.compile(baselineMarker + "\\[(.*)\\]"); + changeMarker = eyeCatcher + "onChange"; + changeRegexp = Pattern.compile(changeMarker + "\\[(.*)\\]\\[(.*)\\]\\[(.*)\\]"); + } + + void clear() { + baseline.clear(); + created.clear(); + modified.clear(); + deleted.clear(); + } + + /** + * The only way we have of communicating with our monitor running in the server is by the logs. + * (Well, unless we write a restful API for it, but that introduces dependencies into the test + * that I don't think we want.) + * + * This method (unlike the scrapeLogsForChanges methods) will reset all marks to the + * beginning of the log, since that's where baselines live. + * + * It also assumes (and asserts) that a baseline will always be present. + */ + void scrapeLogsForBaseline() throws Exception { + + // Set the mark to the beginning of the log, since the baseline will happen at the beginning but + // the calling test could run in any order + // This will reset the marks, too + FileMonitorTest.server.resetLogOffsets(); + + int count = 0; + clear(); + + // Assume we'll only get one baseline + String line = FileMonitorTest.server.waitForStringInLogUsingMark(baselineMarker); + if (line != null) { + Matcher matcher = baselineRegexp.matcher(line); + boolean matches = matcher.find(); + if (matches) { + count++; + baseline.addAll(parseArray(matcher.group(1))); + } + } + assertTrue("A baseline should have been reported on the " + baselineMarker + " monitor. Stopped searching at " + DATE_FORMAT.format(System.currentTimeMillis()), count > 0); + assertEquals("A baseline should have been reported on the " + baselineMarker + " monitor.", 1, count); + } + + /** + * This method must *not* set marks since multiple readers may read the same log. + * + * @param whether a change is atomic. A large write or multi-stage changes are not atomic. + * Non-atomic changes may receive more than one notification, and we want to notice + * them all. + * @return Number of matched lines scraped from the log. Not really useful. + * @throws Exception + * @see scrapeLogsForExpectedChanges + */ + int scrapeLogsForChanges() throws Exception { + int count = 0; + clear(); + + // We are trying to test timeliness of notification, so do specify a timeout + // WARNING: That timeout may be overoptimistic on today's + String line = FileMonitorTest.server.waitForStringInLogUsingMark(changeMarker, TIMEOUT); + while (line != null) { + Matcher matcher = changeRegexp.matcher(line); + boolean matches = matcher.find(); + if (matches) { + count++; + created.addAll(parseArray(matcher.group(1))); + modified.addAll(parseArray(matcher.group(2))); + deleted.addAll(parseArray(matcher.group(3))); + } + + // If a change isn't atomic, a single change by a test could be split across two + // notifications, so give a chance for a straggling split notification to limp in + // Since we're waiting for "no more", this slows us down but avoids intermittent failures. + // See scrapeLogsForExpectedChanges(), which instead exits once conditions are met + line = FileMonitorTest.server.waitForStringInLogUsingLastOffset(changeMarker, TIMEOUT); + + } + lastSearchTime = FileMonitorTest.server.searchStopTime; + + return count; + } + + /** + * This method must *not* set marks since multiple readers may read the same log. + * + * Unlike scrapeLogsForChanges(), this method exits as soon as the "expected" file alterations have been detected. + * This avoids the "loop until no more changes seen" approach, which permits a longer wait (less sensitive to timing + * problems) without significantly slowing down the test except in the failure case. + * + * The main risk is that it may not report _unexpected_ changes which arrive late... but we don't seem to be doing + * a lot of "and only these" tests right now. It also won't report error if the response is slow, but given that + * our current test platform's performance is variable, and that this is supposed to be a functional test rather than + * a performance test, that should be acceptable. + * + * @param whether a change is atomic. A large write or multi-stage changes are not atomic. + * Non-atomic changes may receive more than one notification, and we want to notice + * them all. + * @return Number of matched lines scraped from the log. Not really useful. + * @throws Exception + * @see scrapeLogsForChanges + */ + int scrapeLogsForExpectedChanges(Collection expectedCreates, Collection expectedModifies, Collection expectedDeletes) throws Exception { + int count = 0; + clear(); + + // We were trying to test timeliness of notification, so we specified timeouts + // Unfortunately our current test platform sometimes introduces long delays + // Hence we've switched back to default (longish) timeouts for functional test, + // and advised that performance should be tested separately. + String line = FileMonitorTest.server.waitForStringInLogUsingMark(changeMarker); + while (line != null) { + Matcher matcher = changeRegexp.matcher(line); + boolean matches = matcher.find(); + if (matches) { + count++; + created.addAll(parseArray(matcher.group(1))); + modified.addAll(parseArray(matcher.group(2))); + deleted.addAll(parseArray(matcher.group(3))); + } + + if ((expectedCreates == null || created.containsAll(expectedCreates)) && + (expectedModifies == null || modified.containsAll(expectedModifies)) && + (expectedDeletes == null || deleted.containsAll(expectedDeletes))) + { + line = null; // We found what we expected. We really don't care if there's more. Stop scanning. + } + else + { + // If a change isn't atomic, a single change by a test could be split across two + // notifications, so give a chance for a straggling split notification to limp in + // (this shouldn't slow things down if the expected info DOES eventually arrive) + line = FileMonitorTest.server.waitForStringInLogUsingLastOffset(changeMarker); + } + } + lastSearchTime = FileMonitorTest.server.searchStopTime; + + return count; + } + + /** + * @param group + * @return + */ + private List parseArray(String group) { + List files = new ArrayList(); + String[] names = group.split(","); + for (String name : names) { + if (name.trim().length() > 0) { + files.add(new File(name.trim())); + } + } + + return files; + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/publish/.gitignore b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/.gitignore new file mode 100644 index 00000000000..0968b1bceb6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/publish/features/monitoringPrintingFeature-1.0.mf b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/features/monitoringPrintingFeature-1.0.mf new file mode 100755 index 00000000000..6c43b6a8132 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/features/monitoringPrintingFeature-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: monitoringPrintingFeature-1.0 +Subsystem-SymbolicName: com.ibm.ws.kernel.filemonitor.monitoringfeature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.kernel.filemonitor.monitor.test.bundle; version="[1,1.0.100)", +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/bootstrap.properties b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/server.xml b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/server.xml new file mode 100755 index 00000000000..8201a2072a5 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/publish/servers/com.ibm.ws.kernel.filemonitor.server/server.xml @@ -0,0 +1,15 @@ + + + + + + + usr:monitoringPrintingFeature-1.0 + restConnector-1.0 + + + + + + + diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/bnd.bnd b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/bnd.bnd new file mode 100755 index 00000000000..8b1b7f5d3a2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/bnd.bnd @@ -0,0 +1,14 @@ +Bundle-Vendor: IBM +bVersion=1.0.0 +Bundle-Version: 1.0.0 +Bundle-Name: Feature which uses the file monitor SPI +Bundle-SymbolicName: com.ibm.ws.kernel.filemonitor.monitor.test.bundle + +Private-Package: \ + com.ibm.ws.kernel.filemonitor.monitor.test + +Service-Component: \ + com.ibm.ws.kernel.filemonitor.test.bundle.monitor; \ + implementation:=com.ibm.ws.kernel.filemonitor.monitor.test.FileMonitorRegistrationHandler; \ + immediate:=true + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorPrintingImplementation.java b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorPrintingImplementation.java new file mode 100755 index 00000000000..3d84befc597 --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorPrintingImplementation.java @@ -0,0 +1,56 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.monitor.test; + +import java.io.File; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Collection; + +import com.ibm.wsspi.kernel.filemonitor.FileMonitor; + +public class FileMonitorPrintingImplementation implements FileMonitor { + // Not thread-safe, so keep as an instance variable + private final DateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss:SSS"); + + private static final String EOR = ""; + private final String eyecatcher; + + public FileMonitorPrintingImplementation(String eyecatcher) { + this.eyecatcher = eyecatcher; + } + + @Override + public void onBaseline(Collection baseline) { + System.out.println(timestamp() + "onBaseline" + toString(baseline) + EOR); + + } + + @Override + public void onChange(Collection createdFiles, + Collection modifiedFiles, Collection deletedFiles) { + System.out.println(timestamp() + "onChange" + toString(createdFiles) + toString(modifiedFiles) + toString(deletedFiles) + EOR); + } + + private String toString(Collection files) { + return Arrays.toString(files.toArray()); + } + + /** + * @return + */ + private String timestamp() { + return DATE_FORMAT.format(System.currentTimeMillis()) + eyecatcher; + } + +} diff --git a/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorRegistrationHandler.java b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorRegistrationHandler.java new file mode 100755 index 00000000000..d697f9b8b8a --- /dev/null +++ b/dev/com.ibm.ws.kernel.filemonitor_fat/test-bundles/com.ibm.ws.kernel.filemonitor.monitor.test.bundle/src/com/ibm/ws/kernel/filemonitor/monitor/test/FileMonitorRegistrationHandler.java @@ -0,0 +1,204 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.kernel.filemonitor.monitor.test; + +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.HashSet; +import java.util.Hashtable; + +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import com.ibm.wsspi.kernel.filemonitor.FileMonitor; + +public class FileMonitorRegistrationHandler { + + private final long monitorInterval = 150; + + public void activate(ComponentContext cc) throws IOException { + System.out.println("FAT test code is registering FileMonitor implementations."); + + File tmpFile = File.createTempFile(FileMonitorRegistrationHandler.class.getName(), "file"); + + // Make a temporary folder to monitor + File tmpFolder = File.createTempFile(FileMonitorRegistrationHandler.class.getName(), "folder"); + tmpFolder.delete(); + tmpFolder.mkdirs(); + + File nonExistentFile = File.createTempFile(FileMonitorRegistrationHandler.class.getName(), "nonexistentfile"); + nonExistentFile.delete(); + + // Make a temporary folder to monitor + File nonExistentFolder = File.createTempFile(FileMonitorRegistrationHandler.class.getName(), "nonexistentfolder"); + nonExistentFolder.delete(); + + // We need to make baseline files before we register + File baseline = new File(tmpFolder, "baseline"); + baseline.createNewFile(); + File baseline1 = new File(tmpFolder, "baseline1"); + baseline1.createNewFile(); + File nestedFolder = new File(tmpFolder, "nestedBaselineFolder"); + nestedFolder.mkdirs(); + File nestedFile = new File(nestedFolder, "nestedBaselineFile"); + nestedFile.createNewFile(); + + // This output is important to the FAT test + System.out.println("-MONITORED FOLDER-" + tmpFolder.getAbsolutePath()); + System.out.println("-MONITORED FILE-" + tmpFile.getAbsolutePath()); + System.out.println("-NONEXISTENT FOLDER-" + nonExistentFolder.getAbsolutePath()); + System.out.println("-NONEXISTENT FILE-" + nonExistentFile.getAbsolutePath()); + + BundleContext bundleContext = cc.getBundleContext(); + + Collection folderSet = new HashSet(); + folderSet.add(tmpFolder.getAbsolutePath()); + + Collection fileSet = new HashSet(); + fileSet.add(tmpFile.getAbsolutePath()); + + Collection nonExistentFolderSet = new HashSet(); + nonExistentFolderSet.add(nonExistentFolder.getAbsolutePath()); + + Collection nonExistentFileSet = new HashSet(); + nonExistentFileSet.add(nonExistentFile.getAbsolutePath()); + + registerRecursiveMonitor(bundleContext, "-RECURSIVETESTMONITOROUTPUT-", folderSet); + registerRecursiveMonitor(bundleContext, "-NONEXISTENTFOLDERTESTMONITOROUTPUT-", nonExistentFolderSet); + // Register something monitoring a directory, where there's actually a file in that spot + registerRecursiveMonitor(bundleContext, "-RECURSIVEBUTACTUALLYMONITORINGFILETESTMONITOROUTPUT-", fileSet); + + // Also register a monitor with filters + registerRegexFilteredFileMonitor(bundleContext, folderSet); + registerFileFilteredFileMonitor(bundleContext, folderSet); + registerDirectoryFilteredFileMonitor(bundleContext, folderSet); + + // Also register a non-recursive monitor + registerNonRecursiveMonitor(bundleContext, folderSet); + + // Also register a monitor which isn't watching its own folder + registerMonitorSelfMonitor(bundleContext, folderSet); + registerNonRecursiveMonitorSelfMonitor(bundleContext, folderSet); + + // Also register a monitor watching a file + registerFileMonitor(bundleContext, "-FILETESTMONITOROUTPUT-", fileSet); + registerFileMonitor(bundleContext, "-FILENONEXISTENTTESTMONITOROUTPUT-", nonExistentFileSet); + // Register something monitoring a directory, where there's actually a file in that spot + registerFileMonitor(bundleContext, "-FILEBUTACTUALLYMONITORINGDIRECTORYTESTMONITOROUTPUT-", folderSet); + + // Register an externally driven monitor watching a folder + registerManualMonitor(bundleContext, folderSet); + + } + + /** + * A monitor which really is of file-type to monitor just files (not folders). + */ + private void registerFileMonitor(BundleContext bundleContext, String fileEyecatcher, Collection fileSet) { + final Hashtable fileMonitorProps = new Hashtable(); + fileMonitorProps.put(FileMonitor.MONITOR_FILES, fileSet); + fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(fileEyecatcher), fileMonitorProps); + } + + private void registerMonitorSelfMonitor(BundleContext bundleContext, Collection folderSet) { + String monitorSelfEyecatcher = "-MONITORSELFTESTMONITOROUTPUT-"; + final Hashtable monitorSelfFileMonitorProps = new Hashtable(); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, folderSet); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, true); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_RECURSE, true); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(monitorSelfEyecatcher), monitorSelfFileMonitorProps); + } + + private void registerNonRecursiveMonitorSelfMonitor(BundleContext bundleContext, Collection folderSet) { + String monitorSelfEyecatcher = "-NONRECURSEMONITORSELFTESTMONITOROUTPUT-"; + final Hashtable monitorSelfFileMonitorProps = new Hashtable(); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, folderSet); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, true); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_RECURSE, false); + monitorSelfFileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(monitorSelfEyecatcher), monitorSelfFileMonitorProps); + } + + private void registerNonRecursiveMonitor(BundleContext bundleContext, Collection folderSet) { + // Avoid overlap with the eyecatcher for the recursive monitor to avoid regexp horribleness + String nonRecursiveEyecatcher = "-NONRECURSINGTESTMONITOROUTPUT-"; + final Hashtable nonRecursiveFileMonitorProps = new Hashtable(); + nonRecursiveFileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, folderSet); + nonRecursiveFileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, false); + nonRecursiveFileMonitorProps.put(FileMonitor.MONITOR_RECURSE, false); + nonRecursiveFileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(nonRecursiveEyecatcher), nonRecursiveFileMonitorProps); + } + + /** + * A monitor which monitors a folder recursively (but doesn't include itself). + */ + private void registerRecursiveMonitor(BundleContext bundleContext, String recursiveEyecatcher, Collection fileSet) { + final Hashtable recursiveFileMonitorProps = new Hashtable(); + recursiveFileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, fileSet); + recursiveFileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, false); + recursiveFileMonitorProps.put(FileMonitor.MONITOR_RECURSE, true); + recursiveFileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(recursiveEyecatcher), recursiveFileMonitorProps); + } + + private void registerRegexFilteredFileMonitor(BundleContext bundleContext, Collection fileSet) { + final Hashtable fileMonitorProps = new Hashtable(); + fileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, fileSet); + fileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, false); + fileMonitorProps.put(FileMonitor.MONITOR_RECURSE, true); + fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + // Use the middle of the file's name as a filter + String filter = ".*include.*"; + fileMonitorProps.put(FileMonitor.MONITOR_FILTER, filter); + String eyecatcher = "-FILTEREDTESTMONITOROUTPUT-"; + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(eyecatcher), fileMonitorProps); + } + + private void registerFileFilteredFileMonitor(BundleContext bundleContext, Collection fileSet) { + final Hashtable fileMonitorProps = new Hashtable(); + fileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, fileSet); + fileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, false); + fileMonitorProps.put(FileMonitor.MONITOR_RECURSE, true); + fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + fileMonitorProps.put(FileMonitor.MONITOR_FILTER, FileMonitor.MONITOR_FILTER_FILES_ONLY); + String eyecatcher = "-FILEFILTERTESTMONITOROUTPUT-"; + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(eyecatcher), fileMonitorProps); + } + + private void registerDirectoryFilteredFileMonitor(BundleContext bundleContext, Collection fileSet) { + final Hashtable fileMonitorProps = new Hashtable(); + fileMonitorProps.put(FileMonitor.MONITOR_DIRECTORIES, fileSet); + fileMonitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, true); + fileMonitorProps.put(FileMonitor.MONITOR_RECURSE, true); + fileMonitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + fileMonitorProps.put(FileMonitor.MONITOR_FILTER, FileMonitor.MONITOR_FILTER_DIRECTORIES_ONLY); + String eyecatcher = "-DIRECTORYFILTERTESTMONITOROUTPUT-"; + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(eyecatcher), fileMonitorProps); + } + + private void registerManualMonitor(BundleContext bundleContext, Collection fileSet) { + final Hashtable monitorProps = new Hashtable(); + monitorProps.put(FileMonitor.MONITOR_DIRECTORIES, fileSet); + monitorProps.put(FileMonitor.MONITOR_INCLUDE_SELF, true); + monitorProps.put(FileMonitor.MONITOR_RECURSE, true); + monitorProps.put(FileMonitor.MONITOR_INTERVAL, monitorInterval); + monitorProps.put(FileMonitor.MONITOR_TYPE, FileMonitor.MONITOR_TYPE_EXTERNAL); + + String eyecatcher = "-MANUALMONITOROUTPUT-"; + bundleContext.registerService(FileMonitor.class, new FileMonitorPrintingImplementation(eyecatcher), monitorProps); + } + +} diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath b/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath new file mode 100755 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath.gradle b/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.gitignore b/dev/com.ibm.ws.kernel.metatype.helper_fat/.gitignore new file mode 100644 index 00000000000..5d00910f3a6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.gitignore @@ -0,0 +1 @@ +/coverage.ec diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.project b/dev/com.ibm.ws.kernel.metatype.helper_fat/.project new file mode 100755 index 00000000000..c91b986c5aa --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.metatype.helper_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..72a0b4c067c --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,281 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c92277a371a --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd b/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd new file mode 100644 index 00000000000..0822f646bcf --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd @@ -0,0 +1,12 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.kernel.metatype.helper;version=latest diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..0822f646bcf --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/bnd.bnd.gradle @@ -0,0 +1,12 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.kernel.metatype.helper;version=latest diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/build-test.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/build-test.xml new file mode 100755 index 00000000000..c82e346aeec --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/build-test.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/build.gradle b/dev/com.ibm.ws.kernel.metatype.helper_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/delivery.sets b/dev/com.ibm.ws.kernel.metatype.helper_fat/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/fat/src/com/ibm/ws/kernel/metatype/helper/fat/FATTest.java b/dev/com.ibm.ws.kernel.metatype.helper_fat/fat/src/com/ibm/ws/kernel/metatype/helper/fat/FATTest.java new file mode 100755 index 00000000000..144ab84c85b --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/fat/src/com/ibm/ws/kernel/metatype/helper/fat/FATTest.java @@ -0,0 +1,370 @@ +package com.ibm.ws.kernel.metatype.helper.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.LibertyServerUtils; + +public class FATTest { + + private static final LibertyServer server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.kernel.metatype.helperServer"); + private static final String baseURL = "http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + + "/fileset"; + private final Class c = FATTest.class; + + // Servlet Strings + private static final String BASE = "This is Fileset servlet."; + private static final String BASE_ERROR = "The servlet was not available or did not return the expected content"; + private static final String SERVICE = "Found 1 fileset service."; + private static final String SERVICE_ERROR = "The Fileset service was not found, or too many were found."; + private static final String FILES = "Fileset contained file: "; + private static final String FILES_ERROR = "The fileset retrieved by the servlet did not match that expected."; + + private static final String TEST_FOLDER = "usr/shared/resources/fileset_test_bundles"; + private static final String GEN_JAR_NAME = "test3.jar"; + private static final String GEN_JAR_PATH = TEST_FOLDER + "/" + GEN_JAR_NAME; + + private static final String INIT_MSG_RE = "FileMonitor init completed for fileset"; + private static final String SCAN_MSG_RE = "FileMonitor scan completed for fileset"; + + // default to timeout after 5 seconds for the servlet content to be what we expect + // and for log/trace messages we are waiting for to appear + private static final int CONTENT_TIMEOUT = 5; + + @BeforeClass + public static void setUp() throws Exception { + // clean up from any failed runs + cleanUpGeneratedFiles(); + } + + @Rule + public TestName name = new TestName(); + + public String testName = ""; + public String currentLog = ""; + + @Before + public void setServerConfig() throws Exception { + // set the current test name + testName = name.getMethodName(); + + Log.info(c, testName, "=== Preparing for test " + testName + " ==="); + server.copyFileToLibertyInstallRoot("lib/features", "internalFeatureForFat/filesetfatlibertyinternals-1.0.mf"); + + server.startServer(testName + "_console.log"); + Log.info(c, testName, "===== Starting test " + testName + " ====="); + } + + @After + public void cleanUpAfter() throws Exception { + Log.info(c, testName, "=== Cleaning up from test " + testName + " ==="); + + cleanUpGeneratedFiles(); + + //stop the server and collect the logs + server.stopServer(true); + + // switch back to the monitored_fileset/server.xml after each test + setConfigurationFile("monitored_fileset"); + } + + private static void cleanUpGeneratedFiles() throws Exception { + server.deleteFileFromLibertyInstallRoot(GEN_JAR_PATH); + } + + @AfterClass + public static void cleanUpSharedFolder() throws Exception { + server.deleteFileFromLibertyInstallRoot(TEST_FOLDER); + } + + @Test + public void testServlet() throws Exception { + String[] expected = new String[] { BASE }; + + verifyContent("", expected, BASE_ERROR); + } + + @Test + public void testFilesetService() throws Exception { + String[] expected = new String[] { BASE, SERVICE }; + + verifyContent("Service", expected, SERVICE_ERROR); + } + + @Test + public void testFilesetFiles() throws Exception { + + verifyJarsOneAndTwo(); + } + + @Test + public void testFilesetFilesUpdatedByMonitor() throws Exception { + + // check the fileset has only one and two + verifyJarsOneAndTwo(); + + // now copy three into place + copyTestJar(); + + // wait for the scan complete message + waitForTraceMessage(SCAN_MSG_RE); + + // verify that the fileset has jars one, two and three + verifyJarsOneTwoThree(); + } + + @Test + public void testFilesetFilesMonitorDisabled() throws Exception { + + // hack to give time for setup to copy files over since monitor will be disabled. This + // should ensure the server gets a snapshot of the directory after the setup copy + // has completed. Ideally it would be good to have some mechanism to detect when setup has + // completed but since the problem is occurring frequently the tactical hack + // was opted for to try and keep the builds green. + try { + Thread.sleep(1000); + } catch (Exception ex) { + } + + // change the configuration to disable monitoring and wait for the + // update trace + setConfigurationFileAndWait("unmonitored_fileset"); + + // verify that the fileset contains jars one and two + verifyJarsOneAndTwo(); + + // move the test3.jar into the fileset location + copyTestJar(); + + // check that the test3.jar has not appeared in the list of fileset + // files because we are not monitoring + verifyJarsOneAndTwo(); + + // since we are not scanning there aren't really any messages we can + // check for + // instead we'll just verify again that the third jar hasn't appeared + verifyJarsOneAndTwo(); + } + + @Test + public void testFilesetFilesMonitorReenabled() throws Exception { + + // disable the monitor and check for jars one and two + setConfigurationFileAndWait("unmonitored_fileset"); + verifyJarsOneAndTwo(); + + // update the config to re-enable the monitor + setConfigurationFileAndWait("monitored_fileset"); + + // move the test3.jar into the fileset location + copyTestJar(); + + //we should see two init complete messages, one from when the server came up + //and a second for when monitoring was re-enabled. + waitForTraceToMatchExpression(".*" + INIT_MSG_RE + ".*" + INIT_MSG_RE + ".*"); + + // check that the fileset has been updated + verifyJarsOneTwoThree(); + + } + + @Test + public void testCommaSeparatedFiles() throws Exception { + + // move the test3.jar into the fileset location + copyTestJar(); + + //verify that fileset can be specified with comma separated jar files + setConfigurationFileAndWait("fileset_list"); + verifyJarsOneTwoThree(); + } + + @Test + // recursion is no longer supported + @Ignore + public void testFilesetFilesUpdatedByConfig() throws Exception { + + // set the modified server.xml to be the server configuraiton + setConfigurationFileAndWait("config_change_fileset"); + + // now check that the fileset returns jars one, two and four + String[] expected = new String[] { BASE, FILES + "test1.jar", FILES + "test2.jar", FILES + "test4.jar" }; + + verifyContent("Files", expected, FILES_ERROR); + } + + private void copyTestJar() throws Exception { + // process to get a new jar into the resource folder + // use the FAT utility to copy the test3.jar to the install root + server.copyFileToLibertyInstallRoot(GEN_JAR_NAME); + // copy form the install root to the resources location + RemoteFile jarDest = new RemoteFile(server.getMachine(), LibertyServerUtils.makeJavaCompatible(server + .getInstallRoot() + + "/" + GEN_JAR_PATH)); + RemoteFile rootJar = server.getFileFromLibertyInstallRoot(GEN_JAR_NAME); + assertTrue("Copy of the generated jar file failed, the test will fail.", rootJar.copyToDest(jarDest)); + // now delete the original in the install root + if (rootJar.exists()) + rootJar.delete(); + + // now sleep for a second to allow the FileMonitor to run (it is set to + // run every 500ms) + Thread.sleep(1000); + } + + private List getContent(String urlQuerySuffix) throws Exception { + String logMsg = "getContent - " + testName; + String suffix = ("".equals(urlQuerySuffix)) ? "" : "?" + urlQuerySuffix; + URL url = new URL(baseURL + suffix); + Log.info(c, logMsg, "Calling servlet URL=" + url.toString()); + + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + + // read the page contents + String line = br.readLine(); + List lines = new ArrayList(); + while (line != null) { + lines.add(line); + line = br.readLine(); + } + con.disconnect(); + Log.info(c, logMsg, "Retrieved content: " + lines); + return lines; + } + + private void verifyContent(String urlQuerySuffix, String[] expect, String message) throws Exception { + + List actualContent = null; + Collection expectedContent = Arrays.asList(expect); + + long timeout = System.currentTimeMillis() + (CONTENT_TIMEOUT * 1000); + while (!!!expectedContent.equals(actualContent) && System.currentTimeMillis() < timeout) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + /* ignore */ + } + actualContent = getContent(urlQuerySuffix); + } + + assertEquals(message, expectedContent, actualContent); + } + + private void verifyJarsOneAndTwo() throws Exception { + String[] expected = new String[] { BASE, FILES + "test1.jar", FILES + "test2.jar" }; + + verifyContent("Files", expected, FILES_ERROR); + } + + private void verifyJarsOneTwoThree() throws Exception { + String[] expected = new String[] { BASE, FILES + "test1.jar", FILES + "test2.jar", FILES + "test3.jar" }; + + verifyContent("Files", expected, FILES_ERROR); + } + + private void setConfigurationFile(String serverxmlPathPrefix) throws Exception { + // set the server configuration file + server.setServerConfigurationFile(serverxmlPathPrefix + "/server.xml"); + } + + private void setConfigurationFileAndWait(String serverxmlPathPrefix) throws Exception { + setConfigurationFile(serverxmlPathPrefix); + + //wait 5 seconds for the config updated or config didn't change messages + server.waitForStringInLog("CWWKG0017|CWWKG0018", 5000); + } + + private RemoteFile getTraceFile() throws Exception { + // first wait up to 5 seconds for the log file to appear + RemoteFile logFile = null; + long timeout = System.currentTimeMillis() + 5000; + while (logFile == null && System.currentTimeMillis() < timeout) { + logFile = server.getMatchingLogFile("trace.*"); + if (logFile == null) { + Thread.sleep(500); + } + } + return logFile; + } + + private void waitForTraceMessage(String msgToWaitFor) throws Exception { + // search the trace log to check for the update + String found = server.waitForStringInLog(msgToWaitFor, 5000, getTraceFile()); + if (found == null) { + Log.warning(c, "Did not find the string \"" + msgToWaitFor + "\" in the log"); + } else { + Log.info(c, "waitForTraceMessage", "Found message " + msgToWaitFor); + } + } + + private void waitForTraceToMatchExpression(String regEx) throws Exception { + + RemoteFile traceFile = getTraceFile(); + + StringBuilder traceContent = new StringBuilder(); + + BufferedReader reader = new BufferedReader(new InputStreamReader(traceFile.openForReading())); + try { + long timeout = System.currentTimeMillis() + (CONTENT_TIMEOUT * 1000); + boolean matched = false; + Pattern p = Pattern.compile(regEx); + while (System.currentTimeMillis() < timeout) { + String nextLine = reader.readLine(); + if (nextLine != null) { + traceContent.append(nextLine); + } else { + //if we reached the end of the file we should wait a while before looping again + Thread.sleep(100); + } + Matcher m = p.matcher(traceContent.toString()); + if (m.matches()) { + matched = true; + break; + } + } + + // search the trace log to check for the update + if (!!!matched) { + Log.warning(c, "Did not find the expression \"" + regEx + "\" in the log"); + } else { + Log.info(c, "waitForTraceMessages", "Found expression " + regEx); + } + } finally { + reader.close(); + } + } + +} diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/config_change_fileset/server.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/config_change_fileset/server.xml new file mode 100755 index 00000000000..8b6fbc0f317 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/config_change_fileset/server.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/fileset_list/server.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/fileset_list/server.xml new file mode 100755 index 00000000000..f8402002d66 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/fileset_list/server.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/internalFeatureForFat/filesetfatlibertyinternals-1.0.mf b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/internalFeatureForFat/filesetfatlibertyinternals-1.0.mf new file mode 100755 index 00000000000..1cf06cdf6f4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/internalFeatureForFat/filesetfatlibertyinternals-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: filesetfatlibertyinternals-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Type: osgi.subsystem.feature +IBM-API-Package: com.ibm.wsspi.config; type="internal", + org.osgi.framework; type="spec" +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/monitored_fileset/server.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/monitored_fileset/server.xml new file mode 100755 index 00000000000..c599ced1ecc --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/monitored_fileset/server.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/test3.jar b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/test3.jar new file mode 100755 index 00000000000..1e1ca9e87dd Binary files /dev/null and b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/test3.jar differ diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/unmonitored_fileset/server.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/unmonitored_fileset/server.xml new file mode 100755 index 00000000000..4e3f3950ad2 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/files/unmonitored_fileset/server.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/.gitignore b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/.gitignore new file mode 100644 index 00000000000..383c36189fb --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/.gitignore @@ -0,0 +1,2 @@ +/dropins +/server.xml diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/bootstrap.properties b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/bootstrap.properties new file mode 100755 index 00000000000..9af719cbc7a --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/servers/com.ibm.ws.kernel.metatype.helperServer/bootstrap.properties @@ -0,0 +1,5 @@ +bootstrap.include=../testports.properties +# Trace format (basic or enhanced or advanced) +com.ibm.ws.logging.trace.format=advanced +# Trace settings string - this string enables all trace +com.ibm.ws.logging.trace.specification=*=info:com.ibm.ws.kernel.metatype.helper.internal.FilesetImpl=all=enabled:com.ibm.ws.kernel.filemonitor.internal.CoreServiceImpl=all=enabled:com.ibm.ws.kernel.filemonitor.internal.MonitorHolder=all=enabled:logservice=all=enabled \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/config/com.ibm.ws.kernel.metatype.helperServer.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/config/com.ibm.ws.kernel.metatype.helperServer.xml new file mode 100755 index 00000000000..2a8534bc0a4 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/config/com.ibm.ws.kernel.metatype.helperServer.xml @@ -0,0 +1,12 @@ + + + + + + servlet-3.0 + filesetfatlibertyinternals-1.0 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/repo.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/repo.xml new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test.txt b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test.txt new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test1.jar b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test1.jar new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test2.jar b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test2.jar new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test_subfolder/test4.jar b/dev/com.ibm.ws.kernel.metatype.helper_fat/publish/shared/resources/fileset_test_bundles/test_subfolder/test4.jar new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/resources/WEB-INF/web.xml b/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..b942041fd65 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/resources/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + + fileset + This is a servlet designed to exercise Fileset functionality. + + + + Fileset Servlet + Fileset Servlet + + com.ibm.ws.kernel.metatype.helper.test.app.FilesetTestServlet + + + + + + Fileset Servlet + /* + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/src/com/ibm/ws/kernel/metatype/helper/test/app/FilesetTestServlet.java b/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/src/com/ibm/ws/kernel/metatype/helper/test/app/FilesetTestServlet.java new file mode 100755 index 00000000000..737225d9434 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_fat/test-applications/fileset/src/com/ibm/ws/kernel/metatype/helper/test/app/FilesetTestServlet.java @@ -0,0 +1,82 @@ +package com.ibm.ws.kernel.metatype.helper.test.app; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; + +import javax.servlet.Servlet; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; + +import com.ibm.wsspi.config.Fileset; + +public class FilesetTestServlet extends HttpServlet { + + private static final long serialVersionUID = 2268417347748420049L; + + // Hacky way to get a BundleContext so we can check and use services... ick! + BundleContext context = FrameworkUtil.getBundle(Servlet.class).getBundleContext(); + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + PrintWriter writer = resp.getWriter(); + resp.setStatus(HttpServletResponse.SC_OK); + resp.setContentType("text/plain"); + writer.println("This is Fileset servlet."); + + String test = req.getQueryString(); + + try { + if (test != null) { + if (test.equals("Service")) { + testFilesetServiceRegistered(writer); + } else if (test.equals("Files")) { + printFilesetFiles(writer); + } + } + } catch (Exception e) { + e.printStackTrace(writer); + } finally { + writer.flush(); + writer.close(); + } + } + + private void testFilesetServiceRegistered(PrintWriter writer) throws Exception { + Collection> filesets = context.getServiceReferences(Fileset.class, "(id=testFileset)"); + + // output how many filesets we found + writer.println("Found " + filesets.size() + " fileset service."); + } + + private void printFilesetFiles(PrintWriter writer) throws Exception { + Collection> filesets = context.getServiceReferences(Fileset.class, "(id=testFileset)"); + for (ServiceReference filesetRef : filesets) { + Fileset fset = null; + try { + fset = context.getService(filesetRef); + Collection files = fset.getFileset(); + ArrayList sortedFileNames = new ArrayList(files.size()); + for (File f : files) { + sortedFileNames.add(f.getName()); + } + Collections.sort(sortedFileNames); + for (String name : sortedFileNames) { + writer.println("Fileset contained file: " + name); + } + } finally { + if (fset != null) + context.ungetService(filesetRef); + } + } + } +} diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath b/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath new file mode 100644 index 00000000000..bd880329225 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath.gradle b/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath.gradle new file mode 100644 index 00000000000..bd880329225 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.gitignore b/dev/com.ibm.ws.kernel.metatype.helper_test/.gitignore new file mode 100644 index 00000000000..5d00910f3a6 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.gitignore @@ -0,0 +1 @@ +/coverage.ec diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.project b/dev/com.ibm.ws.kernel.metatype.helper_test/.project new file mode 100755 index 00000000000..b4e6457ec4d --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.kernel.metatype.helper_test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..72a0b4c067c --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,281 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c92277a371a --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd b/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd new file mode 100755 index 00000000000..3d59e7ca35f --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest, \ + com.ibm.websphere.appserver.spi.kernel.filemonitor;version=latest,\ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.ws.kernel.metatype.helper;version=latest diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd.gradle b/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd.gradle new file mode 100755 index 00000000000..3d59e7ca35f --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/bnd.bnd.gradle @@ -0,0 +1,20 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest, \ + com.ibm.websphere.appserver.spi.kernel.filemonitor;version=latest,\ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.ws.kernel.metatype.helper;version=latest diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/build-unittest.xml b/dev/com.ibm.ws.kernel.metatype.helper_test/build-unittest.xml new file mode 100755 index 00000000000..20cf72888c1 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/build-unittest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/build.gradle b/dev/com.ibm.ws.kernel.metatype.helper_test/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/delivery.sets b/dev/com.ibm.ws.kernel.metatype.helper_test/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/AbstractFilesetTestHelper.java b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/AbstractFilesetTestHelper.java new file mode 100755 index 00000000000..2bfb468024f --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/AbstractFilesetTestHelper.java @@ -0,0 +1,187 @@ +package com.ibm.wsspi.config.internal; + +import java.io.File; +import java.net.URI; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import junit.framework.Assert; + +import com.ibm.wsspi.config.Fileset; +import com.ibm.wsspi.config.internal.FilesetImpl; +import com.ibm.wsspi.config.internal.ConfigTypeConstants.FilesetAttribute; +import com.ibm.wsspi.kernel.filemonitor.FileMonitor; +import com.ibm.wsspi.kernel.service.location.WsLocationAdmin; +import com.ibm.wsspi.kernel.service.location.WsResource; + +public class AbstractFilesetTestHelper { + + static protected void setLocationService(FilesetImpl fset) { + fset.setLocationAdmin(new WsLocationAdmin() { + + @Override + public WsResource addLocation(String fileName, String symbolicName) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource asResource(File file, boolean isFile) { + // TODO Auto-generated method stub + return null; + } + + @Override + public File getBundleFile(Object caller, String relativeBundlePath) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource getRuntimeResource(String relativeRuntimePath) { + // TODO Auto-generated method stub + return null; + } + + @Override + public UUID getServerId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getServerName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource getServerOutputResource(String relativeServerPath) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource getServerResource(String relativeServerPath) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource getServerWorkareaResource(String relativeServerWorkareaPath) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Iterator matchResource(String resourceGroupName, String resourceRegex, int limit) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String printLocations(boolean useLineBreaks) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource resolveResource(String resourceURI) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WsResource resolveResource(URI resourceURI) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String resolveString(String string) { + // TODO Auto-generated method stub + return ""; + } + + }); + } + + static Map getDefaultAttributes() { + return getAttributes(null, null, null, null, null); + } + + protected static Map getAttributes(String dir, Boolean sensitive, String includes, + String excludes, Long scanInterval) { + Map attrs = new HashMap(); + attrs.put("id", "FilesetID"); + if (dir == null) + dir = "."; + attrs.put(FilesetAttribute.dir.toString(), dir); + if (sensitive == null) + sensitive = true; + attrs.put(FilesetAttribute.caseSensitive.toString(), sensitive); + if (includes == null) + includes = "*"; + attrs.put(FilesetAttribute.includes.toString(), includes); + if (excludes == null) + excludes = ""; + attrs.put(FilesetAttribute.excludes.toString(), excludes); + + if (scanInterval != null) { + attrs.put(FilesetAttribute.scanInterval.toString(), scanInterval); + } + return attrs; + } + + static void setAttributes(FilesetImpl fset, String dir, Boolean sensitive, String includes, String excludes) { + setAttributes(fset, dir, sensitive, includes, excludes, null); + } + + static void setAttributes(FilesetImpl fset, String dir, Boolean sensitive, String includes, String excludes, Long scanInterval) { + Map props = fset.modified(getAttributes(dir, sensitive, includes, excludes, scanInterval)); + Collection dirs = (Collection) props.get(FileMonitor.MONITOR_DIRECTORIES); + Assert.assertEquals("wrong size", 1, dirs.size()); + Assert.assertEquals("wrong dir", fset.getDir(), dirs.iterator().next()); + + Object interval = props.get(FileMonitor.MONITOR_INTERVAL); + if (scanInterval == null || scanInterval.equals(FilesetImpl.MONITOR_OFF)) { + Assert.assertNull("interval present: " + interval, interval); + } else { + Assert.assertEquals("wrong interval", scanInterval, interval); + } + + Collection files = Collections.emptyList(); + Collection emptyFiles = Collections.emptyList(); + fset.onBaseline(emptyFiles); + File dirFile = new File(dir); + if (dirFile.exists()) { + files = recursivelyListFiles(dirFile); + } + // mock the effect of the FileMonitor + // call initComplete with the + // files we found in the dir + fset.onBaseline(files); + } + + static void setDefaultAttributes(Fileset fset) { + ((FilesetImpl) fset).modified(getDefaultAttributes()); + } + + static Collection recursivelyListFiles(File dir) { + Collection files = new ArrayList(); + for (File f : dir.listFiles()) { + if (f.isDirectory()) { + files.addAll(recursivelyListFiles(f)); + } else { + files.add(f); + } + } + return files; + } + +} diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetNameFilterTest.java b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetNameFilterTest.java new file mode 100755 index 00000000000..1ac27653088 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetNameFilterTest.java @@ -0,0 +1,346 @@ +package com.ibm.wsspi.config.internal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FilenameFilter; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import com.ibm.wsspi.config.internal.FilesetImpl; +import com.ibm.wsspi.config.internal.FilesetImpl.FilterType; + +/** + * The fileset configuration element uses include and exclude filters to provide + * a set of file names. This class provides tests to check the behaviour of the + * filters is correct for many different cases. + * + * The implementation of the {@link FilenameFilter} is a private class inside + * the {@link FilesetImpl} so reflection is used to access the methods required + * to test them, primarily the accept method. + */ +public class FilesetNameFilterTest extends AbstractFilesetTestHelper { + + // the basedir we will use + private static final File DIR = new File("test" + File.separator + "path"); + // a sub directory of basedir + private static final File SUB_DIR = new File(DIR, "sub"); + // another level of sub directory + private static final File SUB2_DIR = new File(SUB_DIR, "sub2"); + // an alternate dir to test files from a different dir + private static final File ALT_DIR = new File("some" + File.separator + "otherpath"); + + // create a Fileset with the default attributes as we will set them as + // required in the tests + static FilesetImpl fset = new FilesetImpl(); + + // The reflective filter which delegates to the real (private) object + // inside the FilesetImpl + private static ReflectiveFilter filter; + + private final Mockery context = new JUnit4Mockery(); + private ComponentContext mockComponentContext; + + @BeforeClass + public static void setupReflectiveFields() throws Exception { + Field filterField = fset.getClass().getDeclaredField("filter"); + filterField.setAccessible(true); + filter = new ReflectiveFilter(filterField.get(fset)); + + } + + @Before + public void setup() throws Exception { + setLocationService(fset); + // clear the filters before each test + filter.clearFilters(); + // set the dir on the fileset + mockComponentContext = context.mock(ComponentContext.class); + fset.activate(mockComponentContext, getAttributes(DIR.toString(), null, null, null, null)); + + final BundleContext mockBundleContext = context.mock(BundleContext.class); + context.checking(new Expectations() { + { + allowing(mockComponentContext).getBundleContext(); + will(returnValue(mockBundleContext)); + allowing(mockComponentContext).getProperties(); + ignoring(mockBundleContext); + } + }); + + } + + @Test + public void testDefaultAccept() throws Exception { + // the default include is "*" which applies to anything in the same + // directory, we have to add it here even though it is the default, + // because we are just testing a filter object not a Fileset one + filter.addFilter(FilterType.INCLUDE, "*"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(DIR, "testFile2")); + assertTrue(filter.accept(DIR, "anything")); + // if the directory is different it shouldn't be included + assertFalse(filter.accept(ALT_DIR, "anything")); + // even a sub folder shouldn't be accepted + assertFalse(filter.accept(SUB_DIR, "anything")); + } + + @Test + public void testDotEscape() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile.txt"); + // check that we get true for a file name with a . + assertTrue(filter.accept(DIR, "testFile.txt")); + // check that we get false for a file name with another + // character in place of the . (because regex . is any character) + assertFalse(filter.accept(DIR, "testFile,txt")); + } + + @Test + public void testCaseSensitiveDefault() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testfile"); + // lower case OK + assertTrue(filter.accept(DIR, "testfile")); + // upper case F should fail + assertFalse(filter.accept(DIR, "testFile")); + } + + @Test + public void testCaseInsensitive() throws Exception { + try { + setAttributes(fset, DIR.toString(), false, null, null); + filter.addFilter(FilterType.INCLUDE, "testfile"); + // lower case OK + assertTrue(filter.accept(DIR, "testfile")); + // upper case F should pass + assertTrue(filter.accept(DIR, "testFile")); + } finally { + // return back to the default for other tests + setAttributes(fset, DIR.toString(), true, null, null); + } + } + + @Test + public void testWildcardIncludeAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "*"); + // should get anything in the dir + assertTrue(filter.accept(DIR, "testFile")); + // should not get a file from the sub dir + assertFalse(filter.accept(SUB_DIR, "testFile")); + } + + @Test + public void testNameIncludeAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile"); + assertTrue(filter.accept(DIR, "testFile")); + } + + @Test + public void testFullpathIncludeAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "sub/testFile"); + assertTrue(filter.accept(SUB_DIR, "testFile")); + } + + @Test + public void testWildcardExcludeAccept() throws Exception { + filter.addFilter(FilterType.EXCLUDE, "*"); + assertFalse(filter.accept(DIR, "testFile")); + } + + @Test + public void testNameExcludeAccept() throws Exception { + filter.addFilter(FilterType.EXCLUDE, "testFile"); + assertFalse(filter.accept(DIR, "testFile")); + } + + @Test + public void testFullpathExcludeAccept() throws Exception { + filter.addFilter(FilterType.EXCLUDE, "sub/testFile"); + assertFalse(filter.accept(SUB_DIR, "testFile")); + } + + @Test + public void testSpaceSeparatedAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile testFile2"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(DIR, "testFile2")); + } + + @Test + public void testCommaSeparatedAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile,testFile2"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(DIR, "testFile2")); + } + + @Test + public void testCommaAndSpaceSeparatedAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile , testFile2"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(DIR, "testFile2")); + } + + @Test + public void testCommaAndSpaceSeparatedAccept2() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile , testFile2"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(DIR, "testFile2")); + } + + @Test + public void testExcessSpacesAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, " testFile "); + assertTrue(filter.accept(DIR, "testFile")); + } + + @Test + public void testIncludeAndExcludeAccept() throws Exception { + filter.addFilter(FilterType.INCLUDE, "testFile"); + filter.addFilter(FilterType.EXCLUDE, "testFile2"); + assertTrue(filter.accept(DIR, "testFile")); + assertFalse(filter.accept(DIR, "testFile2")); + } + + @Test + public void testNameEmbeddedWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "test*"); + assertTrue(filter.accept(DIR, "testFile")); + assertFalse(filter.accept(DIR, "filetestFile")); + assertFalse(filter.accept(DIR, "")); + } + + @Test + public void testNameLeadingWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "*TestFile"); + assertTrue(filter.accept(DIR, "fileTestFile")); + // require at least one character for star + assertFalse(filter.accept(DIR, "TestFile")); + // check that path boundaries aren't crossed + assertFalse(filter.accept(SUB_DIR, "fileTestFile")); + assertFalse(filter.accept(SUB2_DIR, "fileTestFile")); + assertFalse(filter.accept(DIR, "filetestFile")); + } + + @Test + public void testPathEmbeddedWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "./*/testFile"); + // /test/path/testFile (will be false because there is no folder between + // . and testFile + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + assertFalse(filter.accept(SUB2_DIR, "testFile")); + } + + @Test + public void testLeadingPathEmbeddedWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "*/testFile"); + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + assertFalse(filter.accept(SUB2_DIR, "testFile")); + } + + @Test + public void testMultiplePathEmbeddedWildCards() throws Exception { + filter.addFilter(FilterType.INCLUDE, "./*/*/testFile"); + assertFalse(filter.accept(DIR, "testFile")); + assertFalse(filter.accept(SUB_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + assertTrue(filter.accept(SUB2_DIR, "testFile")); + } + + @Test + public void testPathAndNameEmbeddedWildCards() throws Exception { + filter.addFilter(FilterType.INCLUDE, "./*/test*"); + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertFalse(filter.accept(DIR, "filetestFile")); + assertFalse(filter.accept(SUB_DIR, "filetestFile")); + } + + @Test + public void testRecursiveWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "./**/testFile"); + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertTrue(filter.accept(SUB2_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + } + + @Test + public void testLeadingRecursiveWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "**/testFile"); + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertTrue(filter.accept(SUB2_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + } + + @Test + public void testOnlyRecursiveWildCard() throws Exception { + filter.addFilter(FilterType.INCLUDE, "**"); + assertTrue(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(SUB_DIR, "testFile")); + assertTrue(filter.accept(SUB2_DIR, "testFile")); + assertFalse(filter.accept(ALT_DIR, "testFile")); + } + + @Test + public void testComplexWildCards() throws Exception { + filter.addFilter(FilterType.INCLUDE, "**/some/**/path/*/*test*.*"); + assertFalse(filter.accept(DIR, "testFile")); + assertTrue(filter.accept(new File("test/path/sub1/sub2/some/sub3/sub4/sub5/path/dir"), "AtestfileB.txt")); + assertFalse(filter.accept(new File("test/path/sub1/sub2/some/sub3/sub4/sub5/path/dir"), "testfileB")); + assertFalse(filter.accept(new File("test/path/sub1/sub2/some/sub3/sub4/sub5/path/dir"), "AtestfileB")); + assertFalse(filter.accept(new File("some/path/dir"), "AtestfileB.txt")); + assertFalse(filter.accept(new File("test/path/sub1/sub2/some/sub3/sub4/sub5/path"), "AtestfileB.txt")); + } + + /** + * This class uses reflection to delegate to the real filter Object which is + * privately constructed and used inside the FilesetImpl. + * + */ + private static final class ReflectiveFilter { + private final Object realFilter; + private final Method clearFiltersMethod; + private final Method addFilterMethod; + private final Method acceptMethod; + + ReflectiveFilter(Object realFilter) throws SecurityException, NoSuchMethodException { + this.realFilter = realFilter; + clearFiltersMethod = realFilter.getClass().getDeclaredMethod("clearFilters", new Class[0]); + clearFiltersMethod.setAccessible(true); + addFilterMethod = realFilter.getClass().getDeclaredMethod("addFilter", FilterType.class, String.class); + addFilterMethod.setAccessible(true); + acceptMethod = realFilter.getClass().getDeclaredMethod("accept", File.class, String.class); + acceptMethod.setAccessible(true); + + } + + public void clearFilters() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { + clearFiltersMethod.invoke(realFilter, new Object[0]); + } + + public void addFilter(FilterType type, String filter) throws IllegalArgumentException, IllegalAccessException, + InvocationTargetException { + addFilterMethod.invoke(realFilter, type, filter); + } + + public boolean accept(File dir, String name) throws IllegalArgumentException, IllegalAccessException, + InvocationTargetException { + return (Boolean) acceptMethod.invoke(realFilter, dir, name); + } + } +} diff --git a/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetTest.java b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetTest.java new file mode 100755 index 00000000000..527753b9b49 --- /dev/null +++ b/dev/com.ibm.ws.kernel.metatype.helper_test/unittest/src/com/ibm/wsspi/config/internal/FilesetTest.java @@ -0,0 +1,238 @@ +package com.ibm.wsspi.config.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; + +import com.ibm.wsspi.config.internal.FilesetImpl; + +public class FilesetTest extends AbstractFilesetTestHelper { + + // the basedir we will use + private static final File DIR = new File("./test"); + private static final File NODIR = new File("./notADir"); + private static final File TEST_FILE = new File(DIR, "testfile.txt"); + private static final File TEST_FILE_2 = new File(DIR, "testfile2"); + private static final Collection TEST_FILES = new ArrayList(); + private static final Collection EMPTY_FILESET = Collections.emptySet(); + + static { + TEST_FILES.add(TEST_FILE); + TEST_FILES.add(TEST_FILE_2); + } + + // create a Fileset with no attributes as we will set them as required in + // the tests + FilesetImpl fset; + + private final Mockery context = new JUnit4Mockery(); + private ComponentContext mockComponentContext; + + private static void recursiveDelete(File dir) { + if (dir.exists()) { + for (File f : dir.listFiles()) { + if (f.isDirectory()) { + recursiveDelete(f); + } else { + f.delete(); + } + } + dir.delete(); + } + } + + @BeforeClass + public static void setUpFiles() throws Exception { + // clean up first, just in case clean up failed + // or was interrupted previously + cleanUpFiles(); + // set up a directory with some test files in + DIR.mkdir(); + for (File test_file : TEST_FILES) { + test_file.createNewFile(); + } + } + + @AfterClass + public static void cleanUpFiles() throws Exception { + // recursively remove the test directory + recursiveDelete(DIR); + } + + @Before + public void setUp() throws Exception { + fset = new FilesetImpl(); + setLocationService(fset); + mockComponentContext = context.mock(ComponentContext.class); + final BundleContext mockBundleContext = context.mock(BundleContext.class); + context.checking(new Expectations() { + { + allowing(mockComponentContext).getBundleContext(); + will(returnValue(mockBundleContext)); + allowing(mockComponentContext).getProperties(); + ignoring(mockBundleContext); + } + }); + + fset.activate(mockComponentContext, getAttributes(DIR.getName(), null, null, null, null)); + setAttributes(fset, DIR.getName(), null, null, null); +// fset.initComplete(Collections.singleton(DIR)); + } + + private String getFilterFromCollection(Collection collection) { + Collection names = new ArrayList(collection.size()); + for (File f : collection) { + names.add(f.getName()); + } + + // turn the names collection into a ", " separated String + String filter = names.toString(); + // trim the [ and ] from the String + filter = filter.substring(1, filter.length() - 1); + return filter; + } + + private Collection getResolvedAndSortedNames(Collection files) throws Exception { + List fileAbsolutePaths = new ArrayList(files.size()); + for (File f : files) { + fileAbsolutePaths.add(f.getCanonicalPath()); + } + Collections.sort(fileAbsolutePaths); + return fileAbsolutePaths; + } + + private void assertFilesetsEqual(String msg, File expected, Collection actual) throws Exception { + assertFilesetsEqual(msg, Arrays.asList(new File[] { expected }), actual); + } + + private void assertFilesetsEqual(String msg, Collection expected, Collection actual) throws Exception { + assertEquals("Unexpected files returned", getResolvedAndSortedNames(expected), + getResolvedAndSortedNames(actual)); + } + + @Test + public void testSetDir() throws Exception { + // check that setDir has an effect and returns the expected files + setAttributes(fset, DIR.getName(), null, null, null); + assertFilesetsEqual("Unexpected files returned", TEST_FILES, fset.getFileset()); + // check that changing setDir changes the returned collection + setAttributes(fset, NODIR.getName(), null, null, null); + assertFilesetsEqual("Unexpected files returned", EMPTY_FILESET, fset.getFileset()); + } + + @Test + public void testSetCaseSensitive() throws Exception { + // the default filter is *, which isn't going to be case sensitive + // either way + // so set the includes filter to be the list of TEST_FILES + setAttributes(fset, DIR.getName(), true, getFilterFromCollection(TEST_FILES), null); + // check that it works as is + assertFilesetsEqual("Unexpected files returned", TEST_FILES, fset.getFileset()); + Collection wrongcaseFiles = Arrays.asList(new File[] { new File(DIR, "testFile.txt"), + new File(DIR, "testFile2") }); + // apply the wrong case filter + setAttributes(fset, DIR.getName(), true, getFilterFromCollection(wrongcaseFiles), null); + // check that no files come back for the wrong case + assertFilesetsEqual("Was not case sensitive when should have been", EMPTY_FILESET, fset.getFileset()); + // make it insensitive and check result + setAttributes(fset, DIR.getName(), false, getFilterFromCollection(wrongcaseFiles), null); + assertFilesetsEqual("Was case sensitive when should not have been", TEST_FILES, fset.getFileset()); + // return to sensitive and check + setAttributes(fset, DIR.getName(), true, getFilterFromCollection(wrongcaseFiles), null); + assertFilesetsEqual("Was not case sensitive when should have been", EMPTY_FILESET, fset.getFileset()); + } + + @Test + public void testSetIncludesAttribute() throws Exception { + setAttributes(fset, DIR.getName(), null, TEST_FILE.getName(), null); + assertFilesetsEqual("Inlcude filter was incorrectly applied", TEST_FILE, fset.getFileset()); + } + + @Test + public void testSetExcludesAttribute() throws Exception { + setAttributes(fset, DIR.getName(), null, null, TEST_FILE.getName()); + assertFilesetsEqual("Exlcude filter was incorrectly applied", TEST_FILE_2, fset.getFileset()); + } + + @Test + public void testGetFileset() throws Exception { + Collection files = fset.getFileset(); + assertNotNull(files); + assertFilesetsEqual("Unexpected files returned", TEST_FILES, fset.getFileset()); + } + + @Test + public void testNotifyFileChanged() throws Exception { + // check that nothing is returned for testfile3 + setAttributes(fset, DIR.getName(), null, "testfile3", null); + Collection retrieved = fset.getFileset(); + assertFilesetsEqual("No files should have been returned", EMPTY_FILESET, retrieved); + // change the contents of the DIR and notify that it was changed + File testFile3 = new File(DIR, "testfile3"); + testFile3.createNewFile(); + // when the disk contents change the FileMonitor service will call + // scanComplete(...) + // mock that call here with a new listing of the files in the DIR and + // remove the existing retrieved files + fset.onChange(recursivelyListFiles(new File(DIR.getName())), retrieved, EMPTY_FILESET); + // check that the fileset now contains the new file + /* + * assertNotSame("The cached fileset should have been refreshed", + * EMPTY_FILESET, fset.getFileset()); + */ + retrieved = fset.getFileset(); + assertFilesetsEqual("The new file should have been returned", testFile3, retrieved); + + testFile3.setLastModified(testFile3.lastModified() + 5000); + fset.onChange(EMPTY_FILESET, retrieved, EMPTY_FILESET); + retrieved = fset.getFileset(); + assertFilesetsEqual("The same file should have been returned", testFile3, retrieved); + + testFile3.delete(); + fset.onChange(EMPTY_FILESET, EMPTY_FILESET, retrieved); + retrieved = fset.getFileset(); + assertFilesetsEqual("No files should have been returned", EMPTY_FILESET, retrieved); + } + + @Test + public void testRecursion() throws Exception { + try { + File sub = new File(DIR, "some/sub/dir"); + sub.mkdirs(); + File subFile = new File(sub, "subfile.txt"); + subFile.createNewFile(); + + setAttributes(fset, DIR.getName(), null, "**/subfile.txt", null); + + assertFilesetsEqual("The sub directory file should have been returned", subFile, fset.getFileset()); + + } finally { + // delete the file we made so it doesn't influence + // other tests + recursiveDelete(new File(DIR, "some")); + } + } + + @Test + public void verifyProperties() { + setAttributes(fset, DIR.getName(), null, null, null, 0L); + setAttributes(fset, DIR.getName(), null, null, null, 1L); + setAttributes(fset, DIR.getName(), null, null, null, -5L); + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/.classpath b/dev/com.ibm.ws.logging.hpel_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/.classpath.gradle b/dev/com.ibm.ws.logging.hpel_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/.gitignore b/dev/com.ibm.ws.logging.hpel_fat/.gitignore new file mode 100644 index 00000000000..27e131e35a6 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.logging.hpel_fat/.project b/dev/com.ibm.ws.logging.hpel_fat/.project new file mode 100755 index 00000000000..ff567ad067e --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.logging.hpel_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..f48ecd6cc60 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c92277a371a --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd b/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd new file mode 100644 index 00000000000..fd6aab88c9d --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/httpunit/1.7/lib/httpunit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + lib/fat.harness.jar;version=file, \ + lib/phased.junit.jar;version=file, \ + com.ibm.ws.logging.hpel;version=latest diff --git a/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd.gradle b/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..fd6aab88c9d --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/bnd.bnd.gradle @@ -0,0 +1,15 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/httpunit/1.7/lib/httpunit.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + lib/fat.harness.jar;version=file, \ + lib/phased.junit.jar;version=file, \ + com.ibm.ws.logging.hpel;version=latest diff --git a/dev/com.ibm.ws.logging.hpel_fat/build-test.xml b/dev/com.ibm.ws.logging.hpel_fat/build-test.xml new file mode 100755 index 00000000000..600e17237a6 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/build-test.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/build.gradle b/dev/com.ibm.ws.logging.hpel_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.logging.hpel_fat/delivery.sets b/dev/com.ibm.ws.logging.hpel_fat/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/setup/HpelSetup.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/setup/HpelSetup.java new file mode 100755 index 00000000000..7972cd831c0 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/setup/HpelSetup.java @@ -0,0 +1,281 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * -------------------------------------------------------------------------------- + * F000896.23216 8.0 06/11/2010 shighbar Add in removal of excess servers in topology to conserve resources & keep more legacy log history for legacy test cases PD. + * 681388 8.0 12/07/2010 shighbar Override startup of server resources to correct issues seen in z/OS and make bucket efficient. + */ +package com.ibm.ws.fat.hpel.setup; + +import java.util.List; +import java.util.Vector; + +import junit.framework.Test; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Cell; +import com.ibm.websphere.simplicity.Node; +import com.ibm.websphere.simplicity.Server; +import com.ibm.websphere.simplicity.Topology; +import com.ibm.websphere.simplicity.WebSphereVersion; +import com.ibm.ws.fat.ExpensiveTestSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; +import com.ibm.ws.fat.util.CommonActions; + +/** + * Setups key resources for HPEL test cases. + * + * @author Scott Highbarger + * + */ +public class HpelSetup extends ExpensiveTestSetup { + + /** + * The name of the server configured by this fixture + */ + public static final String SERVER_NAME = "HpelServer"; + public static final String SERVER2_NAME = "HpelServer2"; + + /** + * The name of the application configured by this fixture + */ + public static final String APP_NAME = "HpelFat"; + + /** + * The name of the EAR file for the application. + */ + public static final String EAR_NAME = "HpelFatEAR.ear"; + + /** + * Required for compatibility with JUnit/Phased JUnit/command-line invocation of TestSetup. + * + * @param test + * The Test or TestSuite to enclose with this test fixture + */ + public HpelSetup(Test test) { + super(test); + } + + /** + * The amount of nodes the the cell must have for this test bucket to execute. + * + */ + @Override + public int requiredNodesPerCell() { + return 1; + } + + /** + * Provides the amount of time that the harness waits before starting tests. The harness will wait this long to allow the environment to settle. + * + */ + @Override + public long getStartUpWaitTime() { + return TWENTY_SECONDS; + } + + /** + * Setup resources which the test bucket requires, including the creation of application servers and installation of test applications. + * + */ + @Override + public void setUpResources() throws Exception { + // Simplicity in Liberty at the moment sets up just one server located in publish/servers + Topology.init(); + +// // initialize common variables +// WsadminLib wsadminlib = new WsadminLib(getCellUnderTest()); +// +// ApplicationServer server = CommonActions.removeAndCreateApplicationServer(wsadminlib, getNodeUnderTest(), SERVER_NAME); +// SimpleApplication hpelApp = new SimpleApplication(); +// hpelApp.setName(APP_NAME); +// hpelApp.setEar(new File(Props.getProperty(Props.DIR_BUILD_EARS), EAR_NAME)); +// hpelApp.install(server); +// +// //Some test cases will require two servers. +// ApplicationServer server2 = CommonActions.removeAndCreateApplicationServer(wsadminlib, getNodeUnderTest(), SERVER2_NAME); +// SimpleApplication hpelApp2 = new SimpleApplication(); +// hpelApp2.setName(APP_NAME + "2"); +// hpelApp2.setEar(new File(Props.getProperty(Props.DIR_BUILD_EARS), EAR_NAME)); +// hpelApp2.install(server2); +// +// // Remove other servers in topology to conserve resources. +// Set keepServers = new HashSet(); +// keepServers.add(server); +// keepServers.add(server2); +// CommonTasks.removeUnusedServers(getCellUnderTest(), keepServers); +// +// //Expand the number of historical logs to keep for legacy server side tests. +// wsadminlib.setServerSysout(server.getNodeName(), server.getName(), 5, 25); +// +// // save and synchronize changes +// wsadminlib.save(); + } + + /** + * Intended to return a list of all the servers which are being tested. At this time this method will only return a + * single server, and it equivalent to calling the getServerUnderTest() method. + * + */ + @Override + public List getServersUnderTest() throws Exception { + Vector myServers = new Vector(0, 1); + myServers.addElement(getServerUnderTest()); + Server secondServer = getServer2UnderTest(); + if (secondServer != null) { + myServers.addElement(secondServer); // the 2nd server configured by setUpResources + } + return myServers; + } + + /** + * Clean up resources created by the test bucket. + * + */ + @Override + public void tearDownResources() throws Exception { + super.tearDownResources(); + // WsadminLib wsadminlib = new WsadminLib(getCellUnderTest()); + // CommonActions.deleteServer(wsadminlib, getNodeUnderTest(), SERVER_NAME); + // wsadminlib.save(); + } + + /** + * Override the default requiredWebSphereVersion as HPEL currently requires and is only supported on WAS version 8. + * + */ + @Override + public WebSphereVersion requiredWebSphereVersion() { + return new WebSphereVersion("8.0"); + } + + /** + * Retrieve a reference to the Cell configured by this test fixture. + * + * @return a reference to the Cell chosen for configuration of this test fixture + * @throws Exception + * if a Simplicity error occurs + */ + public static Cell getCellUnderTest() throws Exception { + return Topology.getCells().get(0); // first cell in bootstrapping.properties + } + + /** + * Retrieve a reference to the Node configured by this test fixture. + * + * @return a reference to the Node chosen for configuration of this test fixture + * @throws Exception + * if a Simplicity error occurs + */ + public static Node getNodeUnderTest() throws Exception { + Cell cell = getCellUnderTest(); + return CommonActions.getSortedDefaultNodes(cell).get(0); // first Node by alphabetized name + } + + /** + * Retrieve a reference to the ApplicationServer configured by this test fixture. + * + * @return a reference to the server named SERVER_NAME + * @throws Exception + * if a Simplicity error occurs + */ + public static ApplicationServer getServerUnderTest() throws Exception { + Node node = getNodeUnderTest(); + Server server = node.getServerByName(SERVER_NAME); + return server == null ? null : new HPELApplicationServer(server); // the server configured by setUpResources + } + + /** + * Retrieve a reference to the ApplicationServer configured by this test fixture. + * + * @return a reference to the server named SERVER_NAME + * @throws Exception + * if a Simplicity error occurs + */ + public static ApplicationServer getServer2UnderTest() throws Exception { + Node node = getNodeUnderTest(); + Server server = node.getServerByName(SERVER2_NAME); + return server == null ? null : new HPELApplicationServer(server); // the 2nd server configured by setUpResources + } + + @Override + public boolean skipTest() { + /* + * May want to look into using this method, or calling super.skipTest() and overriding some of these methods: + * requiredCells() requiredNodesPerCells() requiredWebSphereVersion() requiredWebSphereEdition() + * requiredOperatingSystems() + * + * etc. so that certain tests are only ran on z/OS or certain levels etc. as needed. + */ + // There's not MixedCell topologies in Liberty yet. + return false; + +// // HpelSetup is not able to work on MixedCell topologies at this time. +// CommonTasks.writeLogMsg(Level.INFO, "Checking if we should skip HpelSetup or not."); +// try { +// return MixedCellTopologyHelper.isTopologyMixed(); +// } catch (Exception e) { +// e.printStackTrace(); +// return true; // Don't execute if we can't tell what topology we are on. +// } + } + + /** + * Ensures that all the resources needed by your test fixture are running. + * This step typically involves starting a series of servers, so the + * "getServersUnderTest" method aims to accommodate this step. By default, + * the startResources method calls getServersUnderTest to find a list of + * servers, and then it starts that list of servers. + * + * @throws Exception If a anything goes wrong + */ + @Override + public void startResources() throws Exception { + // We don't want to start resources, they will need to be bounced in legacy setup anyways. + // Also see issues trying to start both back to back using standard harness framework methods on slower z/OS + // systems. + } + + /** + * Version of HPELApplicationServer which copies log records into logs/messages.log file to + * be recognized as a started server. + */ + private static class HPELApplicationServer extends ApplicationServer { + + protected HPELApplicationServer(Server delegate) throws Exception { + super(delegate.getBackend(), delegate.getNode()); + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.ApplicationServer#start() + */ + @Override + public void start() throws Exception { + // If HPEL is enabled we need start a thread copying log messages from repository into messages.log + if (CommonTasks.isHpelEnabled(this)) { + //88513 - Reading HPEL logs (HpelSetup.TextCopyThread code) get intermixed with the thread deleting 'logs' directory + //before starting the server (LibertyServer.preStartServerLogsTidy() code executed when we call super.start() in HpelSetup.start() method). + //To avoid such problem its better to delete 'logs' directory ourself in HpelSetup.start() method before starting our reading thread. + //This way LibertyServer.preStartServerLogsTidy() will notice that 'logs' directory is gone already and won't do anything at all. + getBackend().deleteFileFromLibertyServerRoot("logs"); + } + super.start(); + } + + /* + * (non-Javadoc) + * + * @see com.ibm.websphere.simplicity.ApplicationServer#start(int) + */ + @Override + public void start(int mbeanWaitDuration) throws Exception { + this.start(); + } + + } + +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/suites/FATSuite.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/suites/FATSuite.java new file mode 100755 index 00000000000..6949534ad29 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/suites/FATSuite.java @@ -0,0 +1,105 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------------------------------- + * F017049-21927 8.0 01/28/2010 shighbar Add testcase for trace to memory buffer by wsadmin + * 635940 8.0 01/25/2010 spaungam Add testcase for testing *=all + * F017049-19395 8.0 07/21/2010 shighbar Add remote reader test on HPEL mBean via JMX. + * F017049-33795 8.0 11/02/2010 shighbar Add SSFAT test HpelClassificationOnlyTraceSSFAT. + * F004749-35525 8.0 12/07/2010 shighbar Add SSFAT test HpelRawTraceListSSFAT. + * 682506 8.0 12/15/2010 shighbar Add RAS Raw Trace Filter test cases. + * 688984 8.0 02/10/2011 shighbar Add HpelMBeanOp tests. + * F017049-41948 8.0 03/30/2011 shighbar Add VerifyServiceLogConfig test case. + * 699970 8.0 04/05/2011 shighbar Add HpelInternalTrace test case. + * 711532 8.0 07/21/2011 shighbar Remove StartServerWithVerboseLogging from DR suite. + * 703214 8.0 07/22/2011 shighbar Add Internal trace guard RawTraceSpecVerifier / MBeanOpTest test. + * 714823 8.0 08/29/2011 shighbar Reorder to avoid logViewer monitor hang from impacting follow on tests. + * 702533 8.0 09/03/2011 olteamh Add HpelDeleteEmptyDirectories test case. + * PM48157 8.0 10/03/2011 shighbar HPEL TextLog retention policy does not remove previous server instances logs. + * F1344-49496 8.0 10/29/2011 belyi Add TestLogRecordContextSSFAT test + * F1344-56880 8.5 01/14/2012 belyi Add VerifyJmxLogNotification test + * 95518 8.5.5 03/07/2012 dbourne remove text log tests + */ +package com.ibm.ws.fat.hpel.suites; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.hpel.tests.BinaryLogExec; +import com.ibm.ws.fat.hpel.tests.BinaryLogRecordContextTest; +import com.ibm.ws.fat.hpel.tests.ConcurrentLoggingAccuracyTest; +import com.ibm.ws.fat.hpel.tests.HpelDeleteEmptyDirectories; +import com.ibm.ws.fat.hpel.tests.TraceSpecificationSetToAllTest; +import com.ibm.ws.fat.hpel.tests.VerifyRepositoryAccuracy; + +/** + * Packages all our HPEL FAT tests + */ +public class FATSuite { + + /** + * Builds a TestSuite of HPEL Functional Acceptance tests + * + * @return a JUnit TestSuite + */ + public static Test suite() { + TestSuite suite = new TestSuite("Hpel FAT suite"); + +/* + * The RasServerSideUnitTestSuite is not really related to HPEL at all, but had to be included here in the HPEL + * suite instead of being called directly by the Full Regression because it makes use of FAT resources such as + * HpelSetup.getServerUnderTest(). Until we refactor the setup of the servers etc. out of HpelSetup and into + * RASSetup etc. It must be called from here. + */ + // server side ras legacy test suite +// suite.addTest(RasServerSideUnitTestSuite.suite()); +// +// // ========== RAS FAT test cases ======== +// suite.addTestSuite(com.ibm.ws.fat.ras.tests.AttributeSetTestingByWsadmin.class); +// suite.addTestSuite(com.ibm.ws.fat.ras.tests.TraceServiceTestingByWsAdmin.class); +// suite.addTestSuite(MBeanOpTest.class); +// suite.addTestSuite(VerifyServiceLogConfig.class); +// +// // ========== FAT test cases ============ +// suite.addTestSuite(EnableHPELByWsadmin.class); + suite.addTestSuite(BinaryLogRecordContextTest.class); + suite.addTestSuite(VerifyRepositoryAccuracy.class); + suite.addTestSuite(BinaryLogExec.class); +// suite.addTestSuite(EnableTextLogByWsadmin.class); +// suite.addTestSuite(EnableRuntimeTraceSpecByWsadmin.class); +// suite.addTestSuite(ChangeRepositoryDirectoryByWsAdmin.class); + suite.addTestSuite(ConcurrentLoggingAccuracyTest.class); +// suite.addTestSuite(LogViewerFormatValidation.class); +// suite.addTestSuite(MergedRepositories.class); +// suite.addTestSuite(com.ibm.ws.fat.hpel.tests.AttributeSetTestingByWsadmin.class); +// suite.addTestSuite(ControlTraceMemoryByWsadmin.class); +// suite.addTestSuite(DisableHPELByWsadmin.class); +// suite.addTestSuite(HpelRemoteReaderMBeanByJMX.class); +// suite.addTestSuite(VerifyJmxLogNotification.class); +// suite.addTestSuite(TestOwnershipVerification.class); +// suite.addTestSuite(RawTraceSpecVerifier.class); + suite.addTestSuite(HpelDeleteEmptyDirectories.class); +// suite.addTestSuite(HpelTextLogRetention.class); +// +// // =========== FAT Server Side test cases ========== +// suite.addTestSuite(HpelMBeanOpSSFAT.class); +// suite.addTestSuite(HpelLogEventNotificationsSSFAT.class); +// suite.addTestSuite(HpelMemoryBufferSSFAT.class); +// suite.addTestSuite(HpelReadWriteSSFAT.class); +// suite.addTestSuite(HpelClassificationOnlyTraceSSFAT.class); +// suite.addTestSuite(HpelRetentionSSFAT.class); +// suite.addTestSuite(HpelLogManResetSSFAT.class); +// suite.addTestSuite(HpelRawTraceListSSFAT.class); +// suite.addTestSuite(HpelInternalTraceSSFAT.class); +// suite.addTestSuite(TestLogRecordContextSSFAT.class); +// suite.addTestSuite(LogViewerSSFAT.class); + suite.addTestSuite(TraceSpecificationSetToAllTest.class); +// removing temporarily for defect 158844 suite.addTestSuite(HpelPurgeMaxSizeIgnoreTest_2.class); +// removing temporarily for defect 158844 suite.addTestSuite(HpelPurgeMaxSizeIgnoreTest_1.class); + + return new HpelSetup(suite); + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogExec.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogExec.java new file mode 100755 index 00000000000..9b53db127cd --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogExec.java @@ -0,0 +1,496 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * + * IBM Confidential OCO Source Material + * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 2002 + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 95263 8.5.5 06/13/2013 sumam Fixed the test case for binaryLog utility command + * + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Random; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Node; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; +import com.ibm.ws.logging.hpel.FormatSet; + +public class BinaryLogExec extends VerboseTestCase { + + private static final Logger thisLogger = Logger.getLogger(BinaryLogExec.class.getName()); + private final String outFileName = this.getName() + "_" + new Date().getTime() + ".lv_out.log"; + RemoteFile rOutLog = null; + RemoteFile rProfRootDir = null; + RemoteFile rProfBinFile = null; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public BinaryLogExec(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.restart(); + this.logStepCompleted(); + } + + // Liberty profile root is the install root. + rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getServerUnderTest().getBackend().getInstallRoot()); +// rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getNodeUnderTest().getProfileDir()); + rProfBinFile = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), rProfRootDir, "bin"); + // Setting the bootstrap with trace specification to get the trace logs. + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.logging.trace.specification", "*=fine=enabled"); + appServ.stop(); + appServ.start(); + + } + + /** + * Tests that binaryLog correctly report an invalid option when one is passed to it. e.g. binaryLog -invalidAction + * + * @throws Exception + */ + public void testbinaryLogInvalidOption() throws Exception { + this.logStep("executing binaryLog on " + HpelSetup.getNodeUnderTest().getProfileName()); + // generate a random option that is between 3 and 15 characters long starting with "bad". + String alphabet = "abcdefghijklmnopqrstuvwxyz"; + StringBuffer invalidOption = new StringBuffer(); + invalidOption.append("-bad"); // need the option flag first. + Random rnd = new Random(); + for (int i = 1; i <= rnd.nextInt(12); i++) { + invalidOption.append(alphabet.charAt(rnd.nextInt(alphabet.length()))); + } + + StringBuffer expectedResponse = new StringBuffer(); + // (WI 234118) We cannot check for message text that gets translated, because it causes the test to fail in non-English locales. + // Updating this match to only use the non-translated words and argument in the message text. + // expectedResponse.append("The specified action "); + // expectedResponse.append(invalidOption); + // expectedResponse.append(" is not valid."); + // expectedResponse.append("\\s+"); //match as a regular expression + // expectedResponse.append("For usage information use binaryLog help."); + expectedResponse.append(".*" + invalidOption + ".*\\s+"); + expectedResponse.append(".*binaryLog help.*"); + ProgramOutput lvPrgmOut = exeBinaryLog(new String[] { invalidOption.toString() }); + this.logVerificationPoint("Verifying binaryLog std out/err and status return code."); + logMsg(" === BinaryLog's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLogs's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + + assertTrue("Failed assertion that logViewer exited with an error return code", (lvPrgmOut.getReturnCode() != 0)); + assertTrue("Failed assertion that logViewer reported invalid option. Where //s is any number of spaces, expected=" + + expectedResponse.toString().trim() + ". result=" + lvPrgmOut.getStdout().trim(), + Pattern.matches(expectedResponse.toString(), lvPrgmOut.getStdout().trim())); + + this.logVerificationPassed(); + this.logStepCompleted(); + } + + /** + * Tests that binaryLog copy action works as expected. + * Steps: + * 1. Create log entries and than use copy action to move the logs file to new location with minDate and maxDate specified. + * 2. view the log entries again with minDate and maxDate specified + * 3. Both isoDateFormat and the default dateFormat are tested for minDate and maxDate + * + * @throws Exception + */ + public void testbinaryLogCopyExecutes() throws Exception { + // need to have messages for the binaryLog to process. + long entry1Time = System.currentTimeMillis(); + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), BinaryLogExec.class.getName(), "Some Msg goes here", null, 50, CommonTasks.LOGS, -1); + long entry2Time = System.currentTimeMillis(); + + Date minDate = new Date(entry1Time); + Date maxDate = new Date(entry2Time); + + DateFormat formatterISO = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); + DateFormat formatterDefault = FormatSet.customizeDateFormat(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM)); + + Node node = HpelSetup.getNodeUnderTest(); + rOutLog = new RemoteFile(node.getMachine(), node.getMachine().getTempDir(), outFileName); + + this.logStep("executing binaryLog on " + node.getProfileName()); + + String arg1 = "copy"; + String arg2 = rOutLog.getAbsolutePath(); + String arg3 = "--minDate=" + formatterDefault.format(minDate); + String arg4 = "--maxDate=" + formatterISO.format(maxDate); + + ProgramOutput lvPrgmOut; + + lvPrgmOut = exeBinaryLog(new String[] { arg1, CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath(), arg2, arg3, arg4 }); + this.logVerificationPoint("Verifying binaryLog std out/err and status return code."); + logMsg(" === BinaryLog's stdout: === return code is : " + lvPrgmOut.getReturnCode()); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLog's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); // Test that output returns Success Code (0) + assertTrue("Failed assertion that binaryLog did produce an output file", rOutLog.exists()); // Test output repository exists + + ProgramOutput lvPrgmOut2 = exeBinaryLog(new String[] { "view", arg2, arg3, arg4 }); + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut2.getReturnCode() == 0)); + assertTrue("Failed assertion that binaryLog did produce an output file", lvPrgmOut2.getStdout().contains("Some Msg goes here")); + this.logVerificationPassed(); + this.logStepCompleted(); + + } + + /** + * Tests that binaryLog view action works as expected. + * Steps: + * 1. Create log entries and than use view action to view the contents of log in text format. + * 2. View the log entries again using --isoDateFormat option + * + * @throws Exception + */ + public void testbinaryLogViewExecutes() throws Exception { + // need to have messages for the binaryLog to process. + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), BinaryLogExec.class.getName(), "Some Msg goes here", null, 25, CommonTasks.LOGS, -1); + + Node node = HpelSetup.getNodeUnderTest(); + rOutLog = new RemoteFile(node.getMachine(), node.getMachine().getTempDir(), outFileName); + + this.logStep("executing binaryLog on " + node.getProfileName()); + + String arg1 = "view"; + String arg2 = "--isoDateFormat"; + + ProgramOutput lvPrgmOut; + + lvPrgmOut = exeBinaryLog(new String[] { arg1, CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() + "/logdata" }); + + this.logVerificationPoint("Verifying binaryLog std out/err and status return code."); + logMsg(" === BinaryLog's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLog's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + + Pattern p1 = Pattern.compile("\\d{1,2}/\\d{1,2}/\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}:\\d\\d\\d"); + Matcher m1 = p1.matcher(lvPrgmOut.getStdout()); + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); + assertTrue("Failed assertion that binaryLog did produce an output file", lvPrgmOut.getStdout().contains("Some Msg goes here")); + assertTrue("Failed assertion that binaryLog displayed default date format", m1.find()); + + lvPrgmOut = exeBinaryLog(new String[] { arg1, CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() + "/logdata", arg2 }); + logMsg(" === BinaryLog's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLog's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + + Pattern p2 = Pattern.compile("\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d\\d\\d"); + Matcher m2 = p2.matcher(lvPrgmOut.getStdout()); + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); + assertTrue("Failed assertion that binaryLog did produce an output file", lvPrgmOut.getStdout().contains("Some Msg goes here")); + assertTrue("Failed assertion that binaryLog displayed default date format", m2.find()); + this.logVerificationPassed(); + this.logStepCompleted(); + + } + + /** + * Tests that binaryLog view action works as expected. + * Steps: + * 1.Create log entries and then use listInstances action to view instances of the binary logs. + * 2.use listInstances again with --isoDateFormat option + * + * @throws Exception + */ + public void testbinaryLogListInstancesExecutes() throws Exception { + // need to have messages for the binaryLog to process. + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), BinaryLogExec.class.getName(), "Some Msg goes here", null, 25, CommonTasks.LOGS, -1); + + Node node = HpelSetup.getNodeUnderTest(); + rOutLog = new RemoteFile(node.getMachine(), node.getMachine().getTempDir(), outFileName); + + this.logStep("executing binaryLog on " + node.getProfileName()); + + String arg1 = "listInstances"; + String arg2 = "--isoDateFormat"; + + ProgramOutput lvPrgmOut; + + lvPrgmOut = exeBinaryLog(new String[] { arg1, CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() + "/logdata" }); + + this.logVerificationPoint("Verifying binaryLog std out/err and status return code."); + logMsg(" === BinaryLog's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLog's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + + Pattern p1 = Pattern.compile("\\d{1,2}/\\d{1,2}/\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}:\\d\\d\\d"); + Matcher m1 = p1.matcher(lvPrgmOut.getStdout()); + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); + // (WI 234118) We cannot perform this check because "Instance ID" is translated, which causes the test to fail in non-English locales. There is no ID or + // non-translated portion of the message to even try to match. + // assertTrue("Failed assertion that binaryLog did produce an output file", lvPrgmOut.getStdout().contains("Instance ID ")); + assertTrue("Failed assertion that binaryLog displayed default date format", m1.find()); + + lvPrgmOut = exeBinaryLog(new String[] { arg1, CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() + "/logdata", arg2 }); + logMsg(" === BinaryLog's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === BinaryLog's std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + Pattern p2 = Pattern.compile("\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d\\d\\d"); + Matcher m2 = p2.matcher(lvPrgmOut.getStdout()); + assertTrue("Failed assertion that binaryLog exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); + // (WI 234118) We cannot perform this check because "Instance ID" is translated, which causes the test to fail in non-English locales. There is no ID or + // non-translated portion of the message to even try to match. + // assertTrue("Failed assertion that binaryLog did produce an output file", lvPrgmOut.getStdout().contains("Instance ID ")); + assertTrue("Failed assertion that binaryLog displayed default date format", m2.find()); + this.logVerificationPassed(); + this.logStepCompleted(); + + } + + /** + * Testing the listInstances action of BinaryLog command. Also testing --includeInstance Filter option of View. + * + * @throws Exception + */ + public void testHeaderProcessName() throws Exception { + this.logStep("get instance list from " + HpelSetup.getNodeUnderTest().getProfileName()); + + ProgramOutput lvPrgmOut = exeBinaryLog(new String[] { "listInstances", CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() }); + String out = lvPrgmOut.getStdout(); + + // (WI 234118) We cannot rely on matching "Instance ID" as the header because that message is translated when running in non-English locales, causing this + // test to fail. Instead, match the lines starting with a number assuming those are the instance IDs. + // Collect IDs belonging to the current instance run. + int indx; + String controllerID = null; + ArrayList ids = new ArrayList(); + for (String outLine : out.split("\\r?\\n")) { + Pattern p = Pattern.compile("^\\s*(\\d+(?:/\\S+)?)\\s"); + Matcher m = p.matcher(outLine); + if (m.find()) { + String newID = m.group(1); + logMsg("Processing instance id " + newID); + indx = newID.indexOf('/'); + String newControllerID = indx < 0 ? newID : newID.substring(0, indx); + logMsg("It belongs to controller " + newControllerID); + if (controllerID == null || !controllerID.equals(newControllerID)) { + // It's a new controller's instance, reset the list of IDs. + logMsg("It's a new controller, reset list of instances"); + ids.clear(); + controllerID = newControllerID; + } + ids.add(newID); + } + } + + assertFalse("No instance IDs found", ids.isEmpty()); + this.logStepCompleted(); + + this.logStep("Verify procName and procId for each retrieved instance"); + + boolean isZOS = HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS); + boolean hasController = false; + boolean hasServant = false; + ApplicationServer server = HpelSetup.getServerUnderTest(); + for (String id : ids) { + this.logVerificationPoint("Verifying instance " + id); + + // c:\sumam\Liberty\workspace3\build.image\wlp\bin>binaryLog view server1 --includeInstance=latest + + lvPrgmOut = exeBinaryLog(new String[] { "view", CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath(), "--includeInstance=" + id }); + + out = lvPrgmOut.getStdout(); + this.logMsg("id ouptut : " + out); + // Should be okay matching the English text here because this is not a translated message. + int indx1 = out.indexOf(" running with process name "); + int indx2 = out.indexOf(" and process id ", indx1); + assertTrue("Instance with ID " + id + " does not have proper header", indx1 > 0 && indx2 > indx1); + String procName = out.substring(indx1 + 27, indx2); + String procId = out.substring(indx2 + 16).split("\\s*\\n\\s*", 2)[0]; + String expProcName; + String expProcId; + if (isZOS) { + indx = id.indexOf("/"); + if (indx < 0) { + // This is controller, take name values from Simplicity, can't verify jobID this way though + expProcName = server.getShortName(); + hasController = true; + } else { + // This is servant, take values from instance ID. + indx1 = id.indexOf("-", indx); + indx2 = id.indexOf("_", indx1); + assertTrue("Instance ID " + id + " is incorrectly formatted", indx1 > indx && indx2 > indx1); + expProcName = id.substring(indx1 + 1, indx2); + expProcId = id.substring(indx2 + 1); + hasServant = true; + assertEquals("Process ID is incorrect", expProcId, procId); + } + } else { + // On Liberty procName is just the server name. + expProcName = server.getBackend().getServerName(); +// expProcName = server.getCellName() + "\\" + server.getNodeName() + "\\" + server.getName(); + // Don't verify process Id since it is not available in Liberty FAT +// expProcId = server.getProcessIdString(); +// assertEquals("Process ID is incorrect", expProcId, procId); + } + assertEquals("Process Name is incorrect", expProcName, procName); + + this.logVerificationPassed(); + } + + this.logVerificationPoint("Verifying completeness of the test"); + if (isZOS) { + if (!hasController && !hasServant) { + fail("Test on zOS is missing both controller and servant instances"); + } + if (!hasController) { + fail("Test on zOS is missing controller instance"); + } + if (!hasServant) { + fail("Test on zOS is missing at least one servant instance"); + } + } else if (ids.size() == 0) { + fail("Test on distributed has no instances to verify"); + } + this.logVerificationPassed(); + + this.logStepCompleted(); + } + + /** + * A method to drive the execution of the binaryLog tool on the remote machine/server that is being tested. + * + * @throws Exception + */ + private ProgramOutput exeBinaryLog(String[] cmdLineOptions) throws Exception { + // make platform agnostic to handle .sh and .bat + String exeExt = ""; + final String BINARY_LOG = "binaryLog"; + + //if non-iSeries +// if (!HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ISERIES)){ + if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.WINDOWS)) { + exeExt = ".bat"; +// } else { +// exeExt = ".sh"; + } + + StringBuilder cmd = new StringBuilder(100); + cmd.append(rProfBinFile.getAbsolutePath()).append(HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator()); + cmd.append(BINARY_LOG).append(exeExt).append(" "); + + for (String cmdOption : cmdLineOptions) { + if (!cmdOption.isEmpty()) { + cmd.append("\"" + cmdOption + "\" "); + } + } + + logMsg("executing: " + cmd.toString()); +// logMsg("executing: " + rProfBinFile.getAbsolutePath() + HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator() + cmd.toString()); +// return HpelSetup.getNodeUnderTest().getMachine().execute(LOG_VIEWER + exeExt, cmdLineOptions, rProfBinFile.getAbsolutePath()); + return HpelSetup.getNodeUnderTest().getMachine().execute(cmd.toString(), rProfBinFile.getAbsolutePath()); + +// } +// //iSeries LogViewer needs to be executed in the shell qsh +// else{ +// return HpelSetup.getNodeUnderTest().getMachine().executeQSH(LOG_VIEWER, cmdLineOptions, rProfBinFile.getAbsolutePath(), null); +// } + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + + /** + * Determine if we should or should not execute this test. Returns true if the test should NOT be ran. + **/ + @Override + public boolean skipTest() { + // Test does not do any good on z/OS since TextLog is for Controller only - so we can't generate logs to fill up + // TextLog repository. This may need to be revisited if we implement TextLog for servant. + try { + return HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS); + } catch (Exception e) { + CommonTasks.writeLogMsg(Level.SEVERE, "Unable to determine if we are on z/OS or not. Not skipping test"); + e.printStackTrace(System.err); + } + return false; + } + + /** + * A simple method used to log messages from this test case to the test case's logs + */ + public void logMsg(String msg) { + if (thisLogger.isLoggable(Level.INFO)) { + thisLogger.info(msg); + } + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogRecordContextTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogRecordContextTest.java new file mode 100755 index 00000000000..53770950096 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/BinaryLogRecordContextTest.java @@ -0,0 +1,151 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.ProtocolException; +import java.net.URL; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * + */ +public class BinaryLogRecordContextTest extends VerboseTestCase { + private ApplicationServer appServ = null; + RemoteFile rProfRootDir = null; + RemoteFile rProfBinFile = null; + String localLogsRepositoryPath = null; + String extension1 = "userName=[hpel]"; + String extension2 = "productId=[liberty]"; + + /** + * @param name + */ + public BinaryLogRecordContextTest(String name) { + super(name); + // TODO Auto-generated constructor stub + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.restart(); + this.logStepCompleted(); + } + + // Liberty profile root is the install root. + rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getServerUnderTest().getBackend().getInstallRoot()); +// rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getNodeUnderTest().getProfileDir()); + rProfBinFile = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), rProfRootDir, "bin"); + // Setting the bootstrap with trace specification to get the trace logs. + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.test", "*=all=enabled"); + appServ.stop(); + appServ.start(); + + } + + /** + * This method creates a connection to a webpage and then reutrns the connection + * + * @param url The Http Address to connect to + * @return The connection to the http address + */ + private HttpURLConnection getHttpConnection(URL url) throws IOException, ProtocolException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + return con; + } + + public void testBinaryLogRecordExtension() throws Exception { + System.out.println("----------testLogRecordServer starts 2-------------"); + String arg1 = "view"; + + //Access the application + URL url = new URL("http://" + appServ.getBackend().getHostname() + ":" + appServ.getBackend().getHttpDefaultPort() + "/LogFat?userName=hpel&productId=liberty"); + System.out.println("appServ.getBackend().getHttpDefaultPort() :" + appServ.getBackend().getHttpDefaultPort()); + HttpURLConnection con = getHttpConnection(url); + System.out.println("URL :" + url); + System.out.println("Response Code :" + con.getResponseCode()); + Thread.sleep(TWENTY_SECONDS); + ProgramOutput lvPrgmOut = exeBinaryLog(new String[] { arg1, appServ.getBackend().getServerName(), "--format=advanced", "--includeInstance=latest" }); + System.out.println("appServ.getBackend().getServerName() :" + appServ.getBackend().getServerName()); + String out = lvPrgmOut.getStdout(); + System.out.println("Log view server --format=advanced :" + out); + assertTrue("Extensions are added to LogRecordContext", out.contains(extension1) && out.contains(extension2)); + } + + /** + * A method to drive the execution of the binaryLog tool on the remote machine/server that is being tested. + * + * @throws Exception + */ + private ProgramOutput exeBinaryLog(String[] cmdLineOptions) throws Exception { + // make platform agnostic to handle .sh and .bat + String exeExt = ""; + final String BINARY_LOG = "binaryLog"; + + //if non-iSeries +// if (!HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ISERIES)){ + if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.WINDOWS)) { + exeExt = ".bat"; +// } else { +// exeExt = ".sh"; + } + rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getServerUnderTest().getBackend().getInstallRoot()); +// rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getNodeUnderTest().getProfileDir()); + rProfBinFile = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), rProfRootDir, "bin"); + StringBuilder cmd = new StringBuilder(100); + cmd.append(rProfBinFile.getAbsolutePath()).append(HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator()); + cmd.append(BINARY_LOG).append(exeExt).append(" "); + + for (String cmdOption : cmdLineOptions) { + if (!cmdOption.isEmpty()) { + cmd.append("\"" + cmdOption + "\" "); + } + } + + System.out.println("executing: " + cmd.toString()); +// logMsg("executing: " + rProfBinFile.getAbsolutePath() + HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator() + cmd.toString()); +// return HpelSetup.getNodeUnderTest().getMachine().execute(LOG_VIEWER + exeExt, cmdLineOptions, rProfBinFile.getAbsolutePath()); + return HpelSetup.getNodeUnderTest().getMachine().execute(cmd.toString(), rProfBinFile.getAbsolutePath()); + +// } +// //iSeries LogViewer needs to be executed in the shell qsh +// else{ +// return HpelSetup.getNodeUnderTest().getMachine().executeQSH(LOG_VIEWER, cmdLineOptions, rProfBinFile.getAbsolutePath(), null); +// } + } + + @Override + public void tearDown() throws Exception { + super.tearDown(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/ConcurrentLoggingAccuracyTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/ConcurrentLoggingAccuracyTest.java new file mode 100755 index 00000000000..2eec3c51676 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/ConcurrentLoggingAccuracyTest.java @@ -0,0 +1,277 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * F017049-18796.1 8.0 01/08/2010 spaungam Update test to support subdirectories + * F000896.23216 1.6 06/14/2010 shighbar Update test case for z/OS support. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.util.Date; +import java.util.logging.Level; + +import com.ibm.websphere.logging.hpel.reader.RepositoryLogRecord; +import com.ibm.websphere.logging.hpel.reader.RepositoryReaderImpl; +import com.ibm.websphere.logging.hpel.reader.ServerInstanceLogRecordList; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.Props; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Tests that more than one thread can correctly write to a single repository at the same time. + * + */ +public class ConcurrentLoggingAccuracyTest extends VerboseTestCase { + int loggerCount = 40; + int iterations = 40; + int secondsToSleep = 169; // milliseconds + int totalCount = loggerCount * iterations; + private final String[] loggers = new String[loggerCount]; + String localLogsRepositoryPath = null; + String localTraceRepositoryPath = null; + String uniqueLoggerID_Tag; + String loggerName = "ConAccLogger"; + final String TRACE_SPECIFICATION = "ConAccLogger*=all"; // trace spec needed for this test case. + + public ConcurrentLoggingAccuracyTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(HpelSetup.getServerUnderTest())) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + HpelSetup.getServerUnderTest().getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(HpelSetup.getServerUnderTest(), true); + // if HPEL was not enabled, make sure trace spec is not valid to ensure restart below. + CommonTasks.setHpelTraceSpec(HpelSetup.getServerUnderTest(), null); + this.logStepCompleted(); + } + + /* + * Since we have multiple test methods in this test case, we will only restart if the spec is not already set to + * what we need. This will avoid extra server restarts which adds to the bucket execution time. + */ + this.logStep("Checking the HPEL trace spec for " + this.getName()); + if (!CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest()).equals(TRACE_SPECIFICATION)) { + // The current spec is not what we need for this test - update spec and bounce server to take effect + this.logStep("Updating the hpel trace spec to " + TRACE_SPECIFICATION + " as part of setup for " + this.getName()); + CommonTasks.setHpelTraceSpec(HpelSetup.getServerUnderTest(), TRACE_SPECIFICATION); + + // need to restart the application server now + // Stop Server first. + this.logStep("Bouncing server for new spec to take effect. Stopping application server"); + HpelSetup.getServerUnderTest().stop(); + this.logStepCompleted(); + + Thread.sleep(10000); // stop operation blocks, but want short pause before restarting. + + // Start Server + this.logStep("Restarting the application server"); + HpelSetup.getServerUnderTest().start(); + + this.logStep("Checking the trace spec post app server restart: " + + CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest())); + assertTrue("Failed assertion that HPEL trace specification is set to " + TRACE_SPECIFICATION, TRACE_SPECIFICATION + .equals(CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest()))); + this.logStepCompleted(); + } + } + + private void setupLoggers() { + // setup a new unique identifier for the logger name + Date d = new Date(); + for (int i = 0; i < loggers.length; i++) { + loggers[i] = loggerName + d + "_" + i; + } + } + + /** + * A utility method to get all of the repository logs as well as the trace logs. + */ + private void getLogsFromServer() throws Exception { + RemoteFile remoteLogsDir = CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()); + RemoteFile localLogsResultsDir = new RemoteFile(Machine.getLocalMachine(), Props.getFileProperty(Props.DIR_LOG) + .getCanonicalPath() + + File.separator + ConcurrentLoggingAccuracyTest.class.getSimpleName()); + + // Save off the path of the repository log files directory + localLogsRepositoryPath = localLogsResultsDir.getAbsolutePath(); + + localLogsResultsDir.copyFromSource(remoteLogsDir, true, true); + } + + /** + * Tests that HPEL accurately reports the number of logs records entered. Assumes that HPEL is enabled on the active + * server + */ + public void testConcurrentLoggingAccuracyCheck() throws Exception { + this.logStep("Creating logger name"); + setupLoggers(); + this.logStepCompleted(); + + this.logStep("Creating the log entries"); + createLogEntries(); + this.logStepCompleted(); + + Thread.sleep(10000); // wait to ensure logs are written out. Default flash is 10 secs. + + // Get the logs from the server to check what is in them + this.logStep("Getting the message logs from the server"); + getLogsFromServer(); + this.logStepCompleted(); + + // Go read the repository and see if it has what we are looking for + this.logStep("Use API to read HPEL repository"); + + // Go read the repository and see if it has what we are looking for + RepositoryReaderImpl logRepository = new RepositoryReaderImpl(localLogsRepositoryPath); + ServerInstanceLogRecordList CurrentProcessLogList = logRepository.getLogListForCurrentServerInstance(); + // record list is the list of records we will compare against. Assume it's the currentServerInstance list by + // default. + Iterable recordList = CurrentProcessLogList; + + /* + * Note, if we are on z/OS the CurrentProcessLogList represents only the controller's logs. Our test log entries + * will be written by servant though. Will setup a Merged repository to include all the logs from sub-process + * instances. + */ + //The problem is with how test counts records on zOS. HPEL allows server to have a parent process (controller) with a set of child processes (servants). + //For such servers result for a server instance has none empty result from getChildren() call. The test problem is that it assumes that logs recorded by an application on zOS can be found _only_ in children processes. + //On Liberty that is not the case since even on zOS server consists of a single process processing all the requests. + + //The problem can be solved in two ways. 1. Remove 'if zOS' condition since the test is maintained separately on Liberty. + //2. Adjust test to do merge between parent and children logs for all OSs. Following the first solution here. + + //if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS)) { + //this.logStep("Since this is z/OS - using a MergedRepository representing all the servant and adjunct sub-processes"); + //recordList = new MergedRepository(CurrentProcessLogList.getChildren().values()); + //} + + this.logStep("Counting log records by level"); + int severe = 0; + int warning = 0; + int info = 0; + int fine = 0; + int finer = 0; + int finest = 0; + for (RepositoryLogRecord record : recordList) { + // process a record + if (record.getLoggerName().startsWith((loggerName))) { + switch (record.getLevel().intValue()) { + case 1000: // SEVERE == 1000 + severe++; + break; + case 900: // WARNING == 900 + warning++; + break; + case 800: // INFO == 800 + info++; + break; + case 500: // FINE == 500 + fine++; + break; + case 400: // FINER == 400 + finer++; + break; + case 300: // FINEST == 300 + finest++; + break; + } + } + } + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository log (Level.SEVERE) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.SEVERE {counted:wrote} {" + severe + + ":" + totalCount + "}", severe == totalCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository log (Level.WARNING) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.WARNING {counted:wrote} {" + warning + + ":" + totalCount + "}", warning == totalCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository log (Level.INFO) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.INFO {counted:wrote} {" + info + ":" + + totalCount + "}", info == totalCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository trace count (Level.FINE) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINE {counted:wrote} {" + fine + ":" + + totalCount + "}", fine == totalCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository trace count (Level.FINER) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINER {counted:wrote} {" + finer + + ":" + totalCount + "}", finer == totalCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository trace count (Level.FINEST) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINEST {counted:wrote} {" + finest + + ":" + totalCount + "}", finest == totalCount); + this.logVerificationPassed(); + } + + /** + * Driver method for executing all the LoggerThread instances. This method will not return until all the Loggers + * have completed writing their records. + * + */ + public void createLogEntries() throws Exception { + LoggerThread[] lt = new LoggerThread[loggerCount]; + + for (int i = 0; i < loggers.length; i++) { + lt[i] = new LoggerThread(loggers[i]); + } + + for (int i = 0; i < lt.length; i++) { + lt[i].start(); + } + + // cycle thru all the threads until each one has finished + for (int i = 0; i < lt.length; i++) { + while (lt[i].isAlive()) { + try { + Thread.sleep(500); + } catch (InterruptedException ie) { + // do nothing in this case. + } + } + } + } + + /** + * Thread definition that will be writing to the repository. + * + * @author schleus + * + */ + class LoggerThread extends Thread { + private String loggerName = null; + + public LoggerThread(String name) { + this.loggerName = name; + } + + @Override + public void run() { + try { + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), loggerName, "Hi from logger " + loggerName + " in this thread", Level.ALL, iterations, + CommonTasks.LOGS_TRACE, secondsToSleep); + } catch (Exception e) { + // nothing for now + } + } + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELDataDirFalsePositiveWarningTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELDataDirFalsePositiveWarningTest.java new file mode 100755 index 00000000000..992733943df --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELDataDirFalsePositiveWarningTest.java @@ -0,0 +1,129 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 91932 8.5.5 13/06/2013 sumam Test case for defect 91932. + * + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.util.List; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 91932: HPEL gives false positive warning on disk space after changing dataDirectory + * Test Scenario: Start the server by logDirectory as logs → modify it to logX and delete the old directory (logs) , no warning message should be generated. + * + */ + +public class HPELDataDirFalsePositiveWarningTest extends VerboseTestCase { + + private final static String loggerName = HPELDataDirFalsePositiveWarningTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static String MESSAGE_LOG = "logs/console.log"; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HPELDataDirFalsePositiveWarningTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELDeleteLogDirectory_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test that HPEL's logDirectory change does not give any warning message. + * Start the server with logDirectory as "LogX1", during the runtime change the logDirectory to "logX2" and delete the old directory i.e. logX1, + * No warning message should be created for deleting the old unused directory + * + **/ + public void testLogDirectoryChange() throws Exception { + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELDeleteLogDirectory_2.xml")); + this.logStepCompleted(); + + // Deleting the old directory and checking for the warning message. + + this.logStep(" Deleting the logs directory to check the warning message"); + appServ.getBackend().deleteFileFromLibertyServerRoot("logX1"); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying no warning message generated for old log directory deleted ."); + logger.info("The console.log should not have a error message HPEL0161W "); + checkWarningMessageForDirectoryDelete(); + this.logVerificationPassed(); + + } + + //Check we dont have any warning message for old directory deleted. + protected void checkWarningMessageForDirectoryDelete() throws Exception { + List lines = appServ.getBackend().findStringsInFileInLibertyServerRoot("HPEL0161W", MESSAGE_LOG); + assertEquals("Message HPEL0161W appeared in the console file", 0, lines.size()); + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELLogDirectoryPurgeMaxSizeTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELLogDirectoryPurgeMaxSizeTest.java new file mode 100755 index 00000000000..d592d005992 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELLogDirectoryPurgeMaxSizeTest.java @@ -0,0 +1,146 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 91930 8.5.5 13/06/2013 sumam Test case for defect 91930. + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 91930: HPEL log ignores purgeMaxSize after dataDirectory is changed. + * While changing the path of logDirectory to new location it should use the should follow the same purgeMaxSize property. + * Testing scenario: Start the server with logDirectory as logs and purgeMaxSize = 29 → during runtime change the logDirectory as logX and check for the purgeMaxSize property for + * the new repository, it should not exceed 29 MB. + * + */ + +public class HPELLogDirectoryPurgeMaxSizeTest extends VerboseTestCase { + + private final static String loggerName = HpelLogDirectoryChangeTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 30; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HPELLogDirectoryPurgeMaxSizeTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelDirChangePurgeMaxTest_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test that logs generated are retaining the purgeMaxSize value for new location. + * Start the server with logDirectory as logs and purgeMaxSize as 29 MB, during runtime change the logDirectory to logx and run quick log + * the new repository should not exceed size more than 29 MB. + **/ + public void testLogDirectoryChange() throws Exception { + RemoteFile binaryLogDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelDirChangePurgeMaxTest_2.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS, 0); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size for new location is same as old"); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logx/logdata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 29 MB ", + binaryLogSize < (29 * 1024 * 1024) && binaryLogSize > ((MAX_DEFAULT_PURGE_SIZE - 5) * 1024 * 1024)); + this.logVerificationPassed(); + + } + + /** + * Returns the total size of log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + long totalgRepositorySize = 0; + RemoteFile[] allLogFiles = dirToCheck.list(true); + for (RemoteFile i : allLogFiles) { + totalgRepositorySize += i.length(); + } + return totalgRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELPurgeMaxSizeErrorTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELPurgeMaxSizeErrorTest.java new file mode 100755 index 00000000000..c871f8af582 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HPELPurgeMaxSizeErrorTest.java @@ -0,0 +1,116 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 91947 8.5.5 13/06/2013 sumam Test case for defect 91947. + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.util.List; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 91947 : HPEL purgeMaxSize/purgeMinTime should follow convention for min value from logging + * Test scenario: Set the server.xml purgeMaxSize = -1 and start the server warning message should be generated + */ + +public class HPELPurgeMaxSizeErrorTest extends VerboseTestCase { + + private final static String loggerName = HPELPurgeMaxSizeErrorTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static String MESSAGE_LOG = "logs/console.log"; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HPELPurgeMaxSizeErrorTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + // Setting the server.xml with purgeMaxSize = -1 + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeInvalid.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test that server gives error message for setting purgeMaxSize = -1 + * Set the purgeMaxSize property = -1 in server.xml for both and , start the server and check for the warning message for invalid purgeMaxSize. + **/ + public void testPurgeMaxSizeProperty() throws Exception { + + this.logVerificationPoint(" Verifying the console.log should have a error message for invalid purgeMaxSize property "); + logger.info(" The console.log should have a error message CWWKG0075E for setting purgeMaxSize property to -1 "); + checkErrorMessageForInvalidPurgeMaxSizeExists(); + this.logVerificationPassed(); + + } + + //Check if we have one Error Message for invalid purgeMaxSize property. + protected void checkErrorMessageForInvalidPurgeMaxSizeExists() throws Exception { + List lines = appServ.getBackend().findStringsInFileInLibertyServerRoot("CWWKG0075E", MESSAGE_LOG); + assertTrue(" Message CWWKG0075E did not appear in console.log ", lines.size() > 0); + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelDeleteEmptyDirectories.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelDeleteEmptyDirectories.java new file mode 100755 index 00000000000..8a2ed23cac2 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelDeleteEmptyDirectories.java @@ -0,0 +1,312 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * COMPONENT_NAME: WAS.ras.fvt + * + * ORIGINS: 27 (used for IBM originated files) + * + * IBM Confidential OCO Source Material + * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 2002 + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * @author olteamh + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 702533 8.0 09/01/2011 olteamh Check that empty hpel instance directories are deleted. + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.util.ArrayList; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 702533: Hpel leaves empty instance repositories behind + * + * @author olteamh + * + */ + +public class HpelDeleteEmptyDirectories extends VerboseTestCase { + + private final static String loggerName = HpelDeleteEmptyDirectories.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static String tempTraceSpec = "*=info:" + loggerName + "*=all"; // trace spec needed for this test case. + String defaultTraceSpec = null; // original trace spec + boolean defaultLogPurgeEnabled; // original purgeBySize + boolean defaultTracePurgeEnabled; // original purgeBySize + int defaultLogPurgeSize; + int defaultTracePurgeSize; + + RemoteFile backup = null; + + public HpelDeleteEmptyDirectories(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + ApplicationServer appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelDeleteEmptyDirectories.xml")); + +// ConfigObject logChild = CommonTasks.getBinaryLogChild(appServ); +// defaultLogPurgeEnabled = logChild.getAttributeByName("purgeBySizeEnabled").getValueAsBoolean(); +// // Test requires that purgeBySize be enabled. +// logChild.getAttributeByName("purgeBySizeEnabled").setValue(true); +// defaultLogPurgeSize = logChild.getAttributeByName("purgeMaxSize").getValueAsInt(); +// // Speed up test by setting purge size to minimum possible +// logChild.getAttributeByName("purgeMaxSize").setValue(10); +// +// ConfigObject traceChild = CommonTasks.getBinaryTraceChild(appServ); +// defaultTracePurgeEnabled = traceChild.getAttributeByName("purgeBySizeEnabled").getValueAsBoolean(); +// // Test requires that purgeBySize be enabled. +// traceChild.getAttributeByName("purgeBySizeEnabled").setValue(true); +// defaultTracePurgeSize = traceChild.getAttributeByName("purgeMaxSize").getValueAsInt(); +// // Speed up test by setting purge size to minimum possible +// traceChild.getAttributeByName("purgeMaxSize").setValue(10); + + defaultTraceSpec = CommonTasks.getHpelTraceSpec(appServ); + CommonTasks.setHpelTraceSpec(appServ, tempTraceSpec); + + // Sync changes before restarting the server. + HpelSetup.getCellUnderTest().getWorkspace().saveAndSync(); + + // stop the server + if (appServ.getBackend().isStarted()) { +// if (appServ.getServerStatus().equals(ProcessStatus.RUNNING)) { + // The server is running. + this.logStep("The server is running, attempting to stop."); + appServ.stop(); + this.logStepCompleted(); + } + + // restart the server + if (!appServ.getBackend().isStarted()) { +// if (!appServ.getServerStatus().equals(ProcessStatus.RUNNING)) { + // The server is not running. + this.logStep("The server is not running, attempting to start."); + appServ.start(); + this.logStepCompleted(); + } + } + + /** + * This test writes enough entries to cause HPEL to delete the .wbl files from the + * previous server instance and checks that the parent directories are deleted when empty + **/ + public void testHPELDeleteEmptyInstanceDirectories() throws Exception { + String repositoryDirString = null; + int logPurgeMaxSize = 0; + int tracePurgeMaxSize = 0; + int logLoopsToDo = 0; + int traceLoopsToDo = 0; + ApplicationServer appServ = null; + RemoteFile serverLogdataDir = null; + RemoteFile serverTracedataDir = null; + Machine remoteMachine = null; + + this.logStep("Building parameters"); + appServ = HpelSetup.getServerUnderTest(); + remoteMachine = appServ.getNode().getMachine(); + + RemoteFile repositoryDir = CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()); + repositoryDirString = repositoryDir.getAbsolutePath(); + + serverLogdataDir = new RemoteFile(remoteMachine, repositoryDir, "logdata"); + serverTracedataDir = new RemoteFile(remoteMachine, repositoryDir, "tracedata"); + + logPurgeMaxSize = 10; //CommonTasks.getBinaryLogChild(appServ).getAttributeByName("purgeMaxSize").getValueAsInt(); + tracePurgeMaxSize = 10; //CommonTasks.getBinaryTraceChild(appServ).getAttributeByName("purgeMaxSize").getValueAsInt(); + logger.log(Level.INFO, "HPEL trace spec is: " + CommonTasks.getHpelTraceSpec(appServ)); + logger.log(Level.INFO, "Running the test case for repository directory: " + repositoryDirString); + logger.log(Level.INFO, "Running the test case for logdata directory: " + serverLogdataDir); + logger.log(Level.INFO, "Running the test case for tracedata directory: " + serverTracedataDir); + logger.log(Level.INFO, "Running the test case with trace purge size: " + tracePurgeMaxSize); + logger.log(Level.INFO, "Running the test case with log purge size: " + logPurgeMaxSize); + logger.log(Level.INFO, "Application server is named: " + appServ.getName()); + + //Make sure the arguments are valid + assertNotNull("The repository directory is null", repositoryDirString); + assertNotNull("The repository log directory is null", serverLogdataDir); + assertNotNull("The repository tracedirectory is null", serverTracedataDir); + + //Get list of all directories in repository before the test starts + RemoteFile[] preLogDirs = listInstanceDirectories(serverLogdataDir); + RemoteFile[] preTraceDirs = listInstanceDirectories(serverTracedataDir); + + //all empty instance repository dirs should have been deleted when the server starts + for (int m = 0; m < preLogDirs.length; m++) { + assertTrue("An empty log instance directory " + preLogDirs[m] + " has been found after server start up", preLogDirs[m].list(true).length != 0); + } + + for (int m = 0; m < preTraceDirs.length; m++) { + assertTrue("An empty trace instance directory " + preTraceDirs[m] + " has been found after server start up", preTraceDirs[m].list(true).length != 0); + } + + // Calculate number of loops of logging to perform + int logBytesToGo = (logPurgeMaxSize * 1024 * 1024); // bytes remaining before max + int traceBytesToGo = (tracePurgeMaxSize * 1024 * 1024); + logLoopsToDo = (logBytesToGo / 100); + traceLoopsToDo = (traceBytesToGo / 100); + logger.log(Level.INFO, "Maximum log iterations: " + logLoopsToDo); + logger.log(Level.INFO, "Maximum trace iterations: " + traceLoopsToDo); + + // Log messages on application server. + this.logStep("Creating log messages."); + + // Write some log records to have a reference point for the big loop bellow. + CommonTasks.createLogEntries(appServ, loggerName, "Initial log record for delete empty instance repositories test.", + null, 10, CommonTasks.LOGS, 0); + + RemoteFile logFile = getMostRecentLog(serverLogdataDir); + assertNotNull("Did not find any WBL files in log directory " + serverLogdataDir, logFile); + for (int i = 0; i < logLoopsToDo; i += 100) { + CommonTasks.createLogEntries(appServ, loggerName, "Log record for delete empty instance repositories test.", + null, 100, CommonTasks.LOGS, 0); + // Keep logging until all files we had before the test are purged + if (!logFile.exists()) { + logger.log(Level.INFO, "Exiting writting log records after {0} loops", i); + break; + } + } + + // Write some trace records to have a reference point for the big loop bellow. + CommonTasks.createLogEntries(appServ, loggerName, "Initial trace record for delete empty instance repositories test.", + null, 10, CommonTasks.TRACE, 0); + + RemoteFile traceFile = getMostRecentLog(serverTracedataDir); + assertNotNull("Did not find any WBL files in trace directory " + serverTracedataDir, traceFile); + for (int i = 0; i < traceLoopsToDo; i += 100) { + CommonTasks.createLogEntries(appServ, loggerName, "Trace record for delete empty instance repositories test.", + null, 100, CommonTasks.TRACE, 0); + // Keep logging until all files we had before the test are purged + if (!traceFile.exists()) { + logger.log(Level.INFO, "Exiting writting trace records after {0} loops", i); + break; + } + } + + this.logStepCompleted(); + + // Short pause to ensure that any deletes HPEL did are processed before we recalculate. + Thread.sleep(2500); + + RemoteFile[] postLogDirs = listInstanceDirectories(serverLogdataDir); + RemoteFile[] postTraceDirs = listInstanceDirectories(serverTracedataDir); + + //Check that there are no empty instance directories at the end of the test + for (int m = 0; m < postLogDirs.length; m++) { + assertTrue("An empty log instance directory has been found", postLogDirs[m].list(true).length != 0); + + } + for (int m = 0; m < postTraceDirs.length; m++) { + assertTrue("An empty trace instance directory has been found", postTraceDirs[m].list(true).length != 0); + } + + } + + @Override + public void tearDown() throws Exception { + ApplicationServer appServ = HpelSetup.getServerUnderTest(); + + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + +// ConfigObject logChild = CommonTasks.getBinaryTraceChild(appServ); +// logChild.getAttributeByName("purgeBySizeEnabled").setValue(defaultLogPurgeEnabled); +// logChild.getAttributeByName("purgeMaxSize").setValue(defaultLogPurgeSize); +// +// ConfigObject traceChild = CommonTasks.getBinaryTraceChild(appServ); +// traceChild.getAttributeByName("purgeBySizeEnabled").setValue(defaultTracePurgeEnabled); +// traceChild.getAttributeByName("purgeMaxSize").setValue(defaultTracePurgeSize); + + CommonTasks.setHpelTraceSpec(appServ, defaultTraceSpec); + + HpelSetup.getCellUnderTest().getWorkspace().saveAndSync(); + + // No need to restart server in Liberty if it's not bootstrap.properties changes. +// this.logStep("Restarting server " + appServ.getName() + " to enable settings available before the test."); +// appServ.stop(); +// appServ.start(); +// this.logStepCompleted(); + + // call the super + super.tearDown(); + } + + // Find most recent WBL file in the repository + private RemoteFile getMostRecentLog(RemoteFile repositoryBase) throws Exception { + assertNotNull("RepositoryBase was unexpectedly null", repositoryBase); + assertTrue(repositoryBase + " does not exist", repositoryBase.exists()); + assertTrue(repositoryBase + " is not a directory", repositoryBase.isDirectory()); + RemoteFile[] fileArray = repositoryBase.list(true); + assertNotNull("Failed to list files in " + repositoryBase, fileArray); + RemoteFile result = null; + long timestamp = -1; + for (RemoteFile curFile : fileArray) { + String name = curFile.getName(); + if (curFile.isFile() && name.endsWith(".wbl")) { + long otherTimestamp = Long.parseLong(name.substring(0, name.length() - 4)); + if (otherTimestamp > timestamp) { + result = curFile; + timestamp = otherTimestamp; + } + } + } + return result; + } + + private RemoteFile[] listInstanceDirectories(RemoteFile repositoryBase) throws Exception { + assertNotNull("RepositoryBase was unexpectedly null", repositoryBase); + ArrayList curFiles = new ArrayList(); + + assertTrue(repositoryBase + " does not exist", repositoryBase.exists()); + assertTrue(repositoryBase + " is not a directory", repositoryBase.isDirectory()); + RemoteFile[] fileArray = repositoryBase.list(true); + assertNotNull("Failed to list files in " + repositoryBase, fileArray); + // recursive=true cause all files and directories return from the call, so no need to make calls in subdirectories. + for (RemoteFile curFile : fileArray) { + if (curFile.isDirectory()) { + curFiles.add(curFile); + } + } + + logger.log(Level.INFO, "Listing " + repositoryBase + " found " + curFiles.size() + " directories"); + return curFiles.toArray(new RemoteFile[curFiles.size()]); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLogDirectoryChangeTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLogDirectoryChangeTest.java new file mode 100755 index 00000000000..29fb3485132 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLogDirectoryChangeTest.java @@ -0,0 +1,149 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 98216 8.5.5 13/06/2013 sumam Test case for defect 98216. + * + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 98216 : HPEL doesn't change location of logdata/tracedata when logDirectory changes. + * While changing the logDirectory attribute of element, the new logs were going inside the old directory. + * Test Scenario -> Start the server with logDirectory as logs → during runtime change the logDirectory to logX and run quick log, new logs should be generated under the logx + * repository. + * + */ + +public class HpelLogDirectoryChangeTest extends VerboseTestCase { + + private final static String loggerName = HpelLogDirectoryChangeTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 30; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HpelLogDirectoryChangeTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + + this.logStepCompleted(); + } + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + // Setting the log directory of logs + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogDirectoryChange_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Testing the logDirectory attribute by changing to new location and running the quick logs. + * Start the server with logDirectory as logs, during runtime change the value of logDirectory to logx, run quick logs + * and check the location where logs are getting stored. + **/ + public void testLogDirectoryChange() throws Exception { + RemoteFile binaryLogDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + this.logStep("Configuring server for test case by setting the logDirectory to logx"); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogDirectoryChange_2.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository used for log is new location (logx)."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logx/logdata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository should be the new location logx ", + binaryLogSize > ((MAX_DEFAULT_PURGE_SIZE - 5) * 1024 * 1024) && binaryLogSize < (50 * 1024 * 1024)); + this.logVerificationPassed(); + + } + + /** + * Returns the total size of log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + long totalgRepositorySize = 0; + RemoteFile[] allLogFiles = dirToCheck.list(true); + for (RemoteFile i : allLogFiles) { + totalgRepositorySize += i.length(); + } + return totalgRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLoggingElementDeleteTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLoggingElementDeleteTest.java new file mode 100755 index 00000000000..4140ca33ba3 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelLoggingElementDeleteTest.java @@ -0,0 +1,212 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 91946 8.5.5 13/06/2013 sumam Test case for defect 91946. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 91946 : HPEL configuration value doesn't revert to default when cleared from server.xml + * While deleting the element purgeMaxSize property is not set to default value. + * Test scenario + * 1. Bootstrap = 91 , server.xml= 201 for Trace remove the entire element Trace = 91 and Log = 50 + * 2. server.xml= 201 for Trace remove the entire element Trace = 50 and Log = 50 + */ + +public class HpelLoggingElementDeleteTest extends VerboseTestCase { + + private final static String loggerName = HpelLoggingElementDeleteTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 100; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HpelLoggingElementDeleteTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + // Setting the bootstrap with trace specification to get the trace logs. + + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.logging.trace.specification", "*=fine=enabled"); + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogElementDelete_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test 1. Set server.xml Trace = 201, during runtime remove the entire element, + * run quick log and check for the repository size, both logdata and tracedata should not exceed more than 50 MB. + **/ + + public void testLoggingElementDelete_1() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + + NumberFormat nf = NumberFormat.getInstance(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogElementDelete_2.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size after deleting the logging element."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize > (45 * 1024 * 1024) && binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should be less than 50 MB ", + binaryTraceSize > (45 * 1024 * 1024) && binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Test 1. Bootstrap Trace = 91 ,in server.xml Trace = 201, during runtime remove the entire element + * and run quick log, check the size of the repository it should not exceed more than 91 MB for trace data and 50 MB for log data. + **/ + public void testLoggingElementDelete_2() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + CommonTasks.addBootstrapProperty(appServ, "com.ibm.hpel.trace.purgeMaxSize", "90"); + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogElementDelete_1.xml")); + this.logStepCompleted(); + + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogElementDelete_2.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size after deleting the logging element ."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize > (45 * 1024 * 1024) && binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should be less than 91 MB ", + binaryTraceSize > (85 * 1024 * 1024) && binaryTraceSize < (91 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Returns the total size of log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + + long totalBinaryLogRepositorySize = 0; + RemoteFile[] allBinaryLogFiles = dirToCheck.list(true); + for (RemoteFile i : allBinaryLogFiles) { + totalBinaryLogRepositorySize += i.length(); +// } + } + return totalBinaryLogRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeBackupFileTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeBackupFileTest.java new file mode 100755 index 00000000000..7f87628208b --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeBackupFileTest.java @@ -0,0 +1,195 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 98078 8.5.5 13/06/2013 sumam Test case for defect 98078. + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 98078 : HPEL purgeMinTime default setting causes all backup log/trace files to be deleted + * Test scenario + * 1. Start the server with purgeMaxSize as 0 for Trace and Log, run quick log Log directory size should be unlimited + * 2. Change the size of purgeMaxSize to 10 for Log and Trace Log directory should be purged to 10MB + * 3. Run quick log again Log directory should remain within 10 MB + */ + +public class HpelPurgeMaxSizeBackupFileTest extends VerboseTestCase { + + private final static String loggerName = HpelLogDirectoryChangeTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 50; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HpelPurgeMaxSizeBackupFileTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + // Setting the bootstrap with trace specification to get the trace logs. + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.logging.trace.specification", "*=fine=enabled"); + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMinTimeTest_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test that HPEL's TextLog size based retention policy works. Both within a single server instance and across + * server restarts. + **/ + public void testPurgeMinTime() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + // write enough records to log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should have logs created", + binaryLogSize > ((MAX_DEFAULT_PURGE_SIZE - 2) * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should have logs created", + binaryTraceSize > ((MAX_DEFAULT_PURGE_SIZE - 2) * 1024 * 1024)); + + this.logVerificationPassed(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMinTimeTest_2.xml")); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository used for log is new location."); + binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should have logs created", + binaryLogSize > (5 * 1024 * 1024) && binaryLogSize < (10 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should have logs created", + binaryTraceSize > (5 * 1024 * 1024) && binaryTraceSize < (10 * 1024 * 1024)); + + this.logVerificationPassed(); + + this.logStep("Writting log records to fill binary log repository."); + loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 600; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size for new logs generated"); + binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should have logs created", + binaryLogSize > (5 * 1024 * 1024) && binaryLogSize < (10 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should have logs created", + binaryTraceSize > (5 * 1024 * 1024) && binaryTraceSize < (10 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Returns the total size of log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + + long totalBinaryLogRepositorySize = 0; + RemoteFile[] allBinaryLogFiles = dirToCheck.list(true); + for (RemoteFile i : allBinaryLogFiles) { + totalBinaryLogRepositorySize += i.length(); +// } + } + return totalBinaryLogRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_1.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_1.java new file mode 100755 index 00000000000..61c4d34b02d --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_1.java @@ -0,0 +1,501 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 97932 8.5.5 13/06/2013 sumam Test case for defect 97932. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 97932 : HPEL ignores purgeMaxSize + * Test scenario + * 1. Bootstrap = 91 , server.xml= 201 for Trace Trace = 201, Log = 50 + * 2. No Config specified Trace = 50, Log = 50 + * 3. Bootstrap = 91 for Trace Trace = 91 and Log = 50 + * 4. Server.xml= 55 for Log Trace = 50 and Log = 55 + * 5. Server.xml= 1024 for Trace ( Used 200 for trace instead of 1024 ) Trace = 1024 and Log = 50 + * 6. Server start without any settings -> during run time, add purgeMaxSize for log to 100 Trace = 50 and Log = 100 + * 7. Server start with log settings as 100 -> during run time, remove the attribute Trace = 50 and Log = 50 + * 8. Server start with log settings as 100 -> during run time, remove entire element (binaryLog) Trace = 50 and Log = 50 + * 9. Server start with log settings as 100 -> during run time, remove entire element (logging) Trace = 50 and Log = 50 + * + */ + +public class HpelPurgeMaxSizeIgnoreTest_1 extends VerboseTestCase { + + private final static String loggerName = HpelLogDirectoryChangeTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 50; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HpelPurgeMaxSizeIgnoreTest_1(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + // Setting the bootstrap with trace specification to get the trace logs. + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.logging.trace.specification", "*=fine=enabled"); + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); +// backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); +// if (!backup.exists()) { +// backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); +// } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogDirectoryChange_1.xml")); + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } + + this.logStepCompleted(); + + } + + /** + * Test No config specified. Run quick log and check the size of repository. Both Tracedata and Logdata should not exceed 50 MB. + **/ + + public void testPurgeMaxSize_1() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + this.logStep("Setting server configuration to default.."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogDirectoryChange_1.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Test In Server.xml set log = 55. Run quick log and check the size of repository. + * Trace data should not exceed more than 50 MB and Log data should not exceed more than 55 MB. + **/ + + public void testPurgeMaxSize_2() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_1.xml")); + appServ.stop(); + appServ.start();; + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 55 MB ", + binaryLogSize < (55 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Test In server.xml set Trace = 200MB. Start the server and run quick log and check the repository size. + * Trace data size should not exceed more than 200 MB and log data size should not exceed more than 50 MB. + **/ + public void testPurgeMaxSize_3() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_2.xml")); + appServ.stop(); + appServ.start(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (200 * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + 200 + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 200 MB ", + binaryTraceSize < (200 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Server start without any setting -> during runtime add purgeMaxSize for log to 100 and run the quick log. + * Check the size of repository, it should not exceed 100 MB for log and 50 MB for trace. + */ + + public void testPurgeMaxSize_4() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_3.xml")); + appServ.stop(); + appServ.start(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_4.xml")); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (100 * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + 100 + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 100 MB ", + binaryLogSize < (100 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + + } + + /** + * Server start with log settings as 100 -> during run time, remove the attribute "purgeMaxSize" from element. + * Run the quick log and check the size of the repository, it should not exceed 50 MB for tracedata and logdata. + **/ + public void testPurgeMaxSize_5() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_4.xml")); + appServ.stop(); + appServ.start(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_5.xml")); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Server start with log settings as 100 -> during run time, remove entire element (binaryLog) from server.xml + * run the quick log and check the size of the repository it should not exceed 50 MB for both logdata and tracedata. + **/ + public void testPurgeMaxSize_6() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_4.xml")); + appServ.stop(); + appServ.start(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_6.xml")); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (50 * 1024 * 1024) / 50; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Server start with log settings as 100 -> during run time, remove entire element (logging) + * Run the quick log and check the size of the repository, it should not exceed 50 MB for both logdata and tracedata. + **/ + public void testPurgeMaxSize_7() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_4.xml")); + appServ.stop(); + appServ.start(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_7.xml")); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (50 * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + 50 + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (50 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (50 * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Set Bootstrap Trace = 91 , server.xml Trace = 201, run the quick log and check the size of the repository. + * It should not exceed 201 MB for tracedata and 50 MB for logdata. + **/ + public void testPurgeMaxSize_8() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + CommonTasks.addBootstrapProperty(appServ, "com.ibm.hpel.trace.purgeMaxSize", "91"); + appServ.stop(); + appServ.start(); + + this.logStep("Configuring server for test case."); + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelLogElementDelete_1.xml")); + this.logStepCompleted(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (201 * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + 201 + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size ."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB", + binaryLogSize > (45 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should be less than 201 MB", + binaryTraceSize > (190 * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Set Bootstrap Trace = 91 and run the quick log and check the size of the repository. + * It should not exceed 91 MB for tracedata and 50 MB for logdata + **/ + public void testPurgeMaxSize_9() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + CommonTasks.addBootstrapProperty(appServ, "com.ibm.hpel.trace.purgeMaxSize", "91"); + appServ.stop(); + appServ.start(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (91 * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + 91 + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size ."); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB", + binaryLogSize > (45 * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("BinaryTrace Repository size should be less than 91 MB", + binaryTraceSize > (85 * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Returns the total size of Log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + + long totalBinaryLogRepositorySize = 0; + RemoteFile[] allBinaryLogFiles = dirToCheck.list(true); + for (RemoteFile i : allBinaryLogFiles) { + totalBinaryLogRepositorySize += i.length(); +// } + } + return totalBinaryLogRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() +// this.logStep("Resetting configuration to pre test values."); +// if (backup != null && backup.exists()) { +// appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); +// } +// this.logStepCompleted(); + + // call the super + super.tearDown(); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_2.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_2.java new file mode 100755 index 00000000000..25153140f84 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelPurgeMaxSizeIgnoreTest_2.java @@ -0,0 +1,168 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * 97932 8.5.5 13/06/2013 sumam Test case for defect 97932. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect 97932 : HPEL ignores purgeMaxSize + * Test scenario + * 10. Server start without any settings -> during run time, add purgeMaxSize for log to 100, stop server, remove purgeMaxSize attribute, start server --> expect output: trace=50, + * log=50 + * + */ + +public class HpelPurgeMaxSizeIgnoreTest_2 extends VerboseTestCase { + + private final static String loggerName = HpelLogDirectoryChangeTest.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_DEFAULT_PURGE_SIZE = 50; + + private ApplicationServer appServ = null; + + RemoteFile backup = null; + + public HpelPurgeMaxSizeIgnoreTest_2(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.stop(); + appServ.start(); + this.logStepCompleted(); + } + + // Setting the bootstrap with trace specification to get the trace logs. + CommonTasks.addBootstrapProperty(appServ, "com.ibm.ws.logging.trace.specification", "*=fine=enabled"); + appServ.stop(); + appServ.start(); + + } + + /** + * Test Server start without any settings -> during run time, add purgeMaxSize for log to 100, stop server, remove purgeMaxSize attribute, start server --> expect output: + * trace=50, + * log=50 + **/ + public void testPurgeMaxSize_10() throws Exception { + RemoteFile binaryLogDir = null; + RemoteFile binaryTraceDir = null; + NumberFormat nf = NumberFormat.getInstance(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_4.xml")); + appServ.stop(); + + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HPELPurgeMaxSizeTest_5.xml")); + appServ.start(); + + // write enough records to new log repository updated. + this.logStep("Writting log records to fill binary log repository."); + long loopsPerFullRepository = (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_DEFAULT_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS_TRACE, 0); + + this.logStepCompleted(); + + this.logVerificationPoint("Verifying the repository size "); + binaryLogDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/logdata"); + binaryTraceDir = appServ.getBackend().getFileFromLibertyServerRoot("logs/tracedata"); + + long binaryLogSize = getSizeOfBinaryLogs(binaryLogDir); + long binaryTraceSize = getSizeOfBinaryLogs(binaryTraceDir); + + logger.info("The current size of BinaryLog files in " + binaryLogDir.getAbsolutePath() + " is " + nf.format(binaryLogSize)); + assertTrue("BinaryLog Repository size should be less than 50 MB ", + binaryLogSize < (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024)); + logger.info("The current size of BinaryTrace files in " + binaryTraceDir.getAbsolutePath() + " is " + nf.format(binaryTraceSize)); + assertTrue("Binarytrace Repository size should be less than 50 MB ", + binaryTraceSize < (MAX_DEFAULT_PURGE_SIZE * 1024 * 1024)); + + this.logVerificationPassed(); + } + + /** + * Returns the total size of log files in the given directory + * + * @throws Exception + **/ + private long getSizeOfBinaryLogs(RemoteFile dirToCheck) throws Exception { + + long totalBinaryLogRepositorySize = 0; + RemoteFile[] allBinaryLogFiles = dirToCheck.list(true); + for (RemoteFile i : allBinaryLogFiles) { + totalBinaryLogRepositorySize += i.length(); +// } + } + return totalBinaryLogRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } + this.logStepCompleted(); + + // call the super + super.tearDown(); + } + + /** + * Determine if we should or should not execute this test. Returns true if the test should NOT be ran. + * **/ + @Override + public boolean skipTest() { + // Test does not do any good on z/OS since TextLog is for Controller only - so we can't generate logs to fill up + // TextLog repository. This may need to be revisited if we implement TextLog for servant. + try { + return HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS); + } catch (Exception e) { + CommonTasks.writeLogMsg(Level.SEVERE, "Unable to determine if we are on z/OS or not. Not skipping test"); + e.printStackTrace(System.err); + } + return false; + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelTextLogRetention.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelTextLogRetention.java new file mode 100755 index 00000000000..517a1f5cf1d --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/HpelTextLogRetention.java @@ -0,0 +1,213 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/** + * COMPONENT_NAME: WAS.ras.fvt + * + * ORIGINS: 27 (used for IBM originated files) + * + * IBM Confidential OCO Source Material + * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 2002 + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + * + * + * DESCRIPTION: + * + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * PM48157 8.0 10/03/2011 shighbar HPEL TextLog retention policy does not remove previous server instances logs. + */ + +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.text.NumberFormat; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * Test case for defect PM48157 : Hpel TextLog files retention policy not working. The retention policy was previously + * working per server instance but not across multiple instances. As a result the size of the total TextLogs was able to + * grow by up to purgeMaxSize each time there was a new instance (server bounce). Test case needs to check for retention + * not only in a single run but across multiple runs to cover this case. + * + */ + +public class HpelTextLogRetention extends VerboseTestCase { + + private final static String loggerName = HpelTextLogRetention.class.getName(); + private final static Logger logger = Logger.getLogger(loggerName); + private final static int MAX_TEXTLOG_PURGE_SIZE = 10; + private ApplicationServer appServ = null; + + boolean default_TextPurgeEnabled; // original purgeBySize for TextLog + int default_TextPurgeSize; + String default_outOfSpaceAction; + + RemoteFile backup = null; + + public HpelTextLogRetention(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + appServ = HpelSetup.getServerUnderTest(); + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(appServ)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + appServ.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(appServ, true); + // Restart now to complete switching to HPEL + appServ.restart(); + this.logStepCompleted(); + } + + this.logStep("Configuring server for test case."); + backup = new RemoteFile(appServ.getBackend().getMachine(), new File(appServ.getBackend().getServerRoot(), "server-backup.xml").getPath()); + if (!backup.exists()) { + backup.copyFromSource(appServ.getBackend().getServerConfigurationFile()); + } + appServ.getBackend().updateServerConfiguration(new File(appServ.getBackend().pathToAutoFVTTestFiles, "server-HpelTextLogRetention.xml")); + + if (!appServ.getBackend().isStarted()) { + appServ.start(); + } +// ConfigObject textChild = CommonTasks.getTextLogChild(appServ); +// default_TextPurgeEnabled = textChild.getAttributeByName("purgeBySizeEnabled").getValueAsBoolean(); +// // Test requires that purgeBySize be enabled. +// textChild.getAttributeByName("purgeBySizeEnabled").setValue(true); +// default_TextPurgeSize = textChild.getAttributeByName("purgeMaxSize").getValueAsInt(); +// // Speed up test by setting purge size to minimum possible +// textChild.getAttributeByName("purgeMaxSize").setValue(MAX_TEXTLOG_PURGE_SIZE); +// // Check that outOfSpaceAction is set to PurgeOld +// default_outOfSpaceAction = textChild.getAttributeByName("outOfSpaceAction").getValueAsString(); +// textChild.getAttributeByName("outOfSpaceAction").setValue("PurgeOld"); +// +// // Sync changes before restarting the server. +// HpelSetup.getCellUnderTest().getWorkspace().saveAndSync(); + this.logStepCompleted(); + + // restart the server +// this.logStep("Starting/restarting application server to apply config changes."); +// appServ.stop(); +// appServ.start(); +// this.logStepCompleted(); + + } + + /** + * Test that HPEL's TextLog size based retention policy works. Both within a single server instance and across + * server restarts. + **/ + public void testHPELTextLogSizeRetention() throws Exception { + RemoteFile TextLogDir = CommonTasks.getTextLogDir(appServ); + NumberFormat nf = NumberFormat.getInstance(); + + // write enough records to force size based retention policy to kick in. + // there is ~600 bytes per log record. Using 200 to allow buffer. + this.logStep("Writting log records to fill TextLog repository."); + long loopsPerFullRepository = (MAX_TEXTLOG_PURGE_SIZE * 1024 * 1024) / 200; + logger.info("writting " + nf.format(loopsPerFullRepository) + " log loops to produce " + MAX_TEXTLOG_PURGE_SIZE + + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) loopsPerFullRepository, CommonTasks.LOGS, 0); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying that repository has not grown above max purge size."); + long logsSize = getSizeOfTextLogs(TextLogDir); + logger.info("The current size of TextLog files in " + TextLogDir.getAbsolutePath() + " is " + nf.format(logsSize)); + assertTrue("TextLog Repository size shouldn't be larger than purgeMaxSize", + logsSize <= (MAX_TEXTLOG_PURGE_SIZE * 1024 * 1024)); + this.logVerificationPassed(); + + this.logStep("Restarting Server in preperation to check that retention policy spans server instances"); + appServ.stop(); + appServ.start(); + + this.logStep("Writting log records to repository"); + // We don't have to fill the repository - half the repository size will work fine. + logger.info("writting " + nf.format((int) (loopsPerFullRepository / 2)) + " log loops to produce " + MAX_TEXTLOG_PURGE_SIZE + / 2 + " MB of data."); + CommonTasks.createLogEntries(appServ, loggerName, "Sample log record for the test case " + this.getName() + ".", null, + (int) (loopsPerFullRepository / 2), CommonTasks.LOGS, 0); + this.logStepCompleted(); + + this.logVerificationPoint("Verifying that the repository size is still below max purge size."); + logsSize = getSizeOfTextLogs(TextLogDir); + logger.info("The current size of TextLog files in " + TextLogDir.getAbsolutePath() + " is " + nf.format(logsSize)); + assertTrue("TextLog Repository size shouldn't be larger than purgeMaxSize after server restart.", + logsSize <= (MAX_TEXTLOG_PURGE_SIZE * 1024 * 1024)); + this.logVerificationPassed(); + } + + /** + * Returns the total size of TextLog files in the given directory + * + * @throws Exception + **/ + private long getSizeOfTextLogs(RemoteFile dirToCheck) throws Exception { + long TotalTextRepositorySize = 0; + RemoteFile[] AllTextLogFiles = dirToCheck.list(false); + for (RemoteFile i : AllTextLogFiles) { + if (i.getName().startsWith("TextLog_")) { + // counting this as a valid TextLog log file. + TotalTextRepositorySize += i.length(); + } + } + return TotalTextRepositorySize; + } + + @Override + public void tearDown() throws Exception { + // Restore values we saw before changing them in setUp() + this.logStep("Resetting configuration to pre test values."); + if (backup != null && backup.exists()) { + appServ.getBackend().getServerConfigurationFile().copyFromSource(backup); + } +// ConfigObject textChild = CommonTasks.getTextLogChild(appServ); +// textChild.getAttributeByName("purgeBySizeEnabled").setValue(default_TextPurgeEnabled); +// textChild.getAttributeByName("purgeMaxSize").setValue(default_TextPurgeSize); +// textChild.getAttributeByName("outOfSpaceAction").setValue(default_outOfSpaceAction); +// +// HpelSetup.getCellUnderTest().getWorkspace().saveAndSync(); + this.logStepCompleted(); + + // No need to restart server in Liberty if it's not bootstrap.properties changes. +// this.logStep("Restarting server " + appServ.getName() + " to enable settings available before the test."); +// appServ.stop(); +// appServ.start(); +// this.logStepCompleted(); + + // call the super + super.tearDown(); + } + + /** + * Determine if we should or should not execute this test. Returns true if the test should NOT be ran. + * **/ + @Override + public boolean skipTest() { + // Test does not do any good on z/OS since TextLog is for Controller only - so we can't generate logs to fill up + // TextLog repository. This may need to be revisited if we implement TextLog for servant. + try { + return HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS); + } catch (Exception e) { + CommonTasks.writeLogMsg(Level.SEVERE, "Unable to determine if we are on z/OS or not. Not skipping test"); + e.printStackTrace(System.err); + } + return false; + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/LogViewerExec.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/LogViewerExec.java new file mode 100755 index 00000000000..9ff6ce72bb1 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/LogViewerExec.java @@ -0,0 +1,347 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * F000896.23216 8.0 08/25/2010 shighbar Update test case for z/OS support. + * 653858 8.0 09/08/2010 spaungam Invalid option test doesn't work in CT + * 677722 8.0 11/05/2010 mcasile msgid key removed from logviewer nls + * 677210 8.0 11/05/2010 spaungam logviewer script is missing from iSeries + * 690576 8.0 02/16/2011 spaungam use qsh shell on iSeries with new simplicity + * 695788 8.0 03/09/2011 shighbar Always set repositoryDir param to avoid LV hang on user input. + * 712273 8.0 09/16/2011 belyi Add test for process name in the header. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.util.ArrayList; +import java.util.Random; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.Node; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.Props; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * This task is to read from an active servers HPEL repository in basic format and to verify there are no errors and to + * check for key output. + * + * + */ +public class LogViewerExec extends VerboseTestCase { + + private static final Logger thisLogger = Logger.getLogger(LogViewerExec.class.getName()); + private final String outFileName = this.getName() + ".lv_out.log"; + RemoteFile rOutLog = null; + RemoteFile rProfRootDir = null; + RemoteFile rProfBinFile = null; + + /** + * Constructs a single instance of this Test (one test method). + * + * @param name + * The name of the test method to run + */ + public LogViewerExec(String name) { + super(name); + } + + /** + * Configures instance resources to initialize this TestCase. + * + * @throws Exception + * if a problem happens while configuring the test fixture. + */ + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(HpelSetup.getServerUnderTest())) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + HpelSetup.getServerUnderTest().getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(HpelSetup.getServerUnderTest(), true); + // HpelSetup.getServerUnderTest().restart(); Bug# 17199 + HpelSetup.getServerUnderTest().stop(); + HpelSetup.getServerUnderTest().start(); + this.logStepCompleted(); + } + + assertTrue("Failed assertion that HPEL is enabled", CommonTasks.isHpelEnabled(HpelSetup.getServerUnderTest())); + + // Liberty profile root is the install root. + rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getServerUnderTest().getBackend().getInstallRoot()); +// rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getNodeUnderTest().getProfileDir()); + rProfBinFile = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), rProfRootDir, "bin"); + + } + + /** + * A method to drive the execution of the logViewer tool on the remote machine/server that is being tested. + * + * @throws Exception + */ + private ProgramOutput exeLogViewer(String[] cmdLineOptions) throws Exception { + // make platform agnostic to handle .sh and .bat + String exeExt = ""; + final String LOG_VIEWER = "logViewer"; + + //if non-iSeries +// if (!HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ISERIES)){ + if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.WINDOWS)) { + exeExt = ".bat"; +// } else { +// exeExt = ".sh"; + } + + StringBuilder cmd = new StringBuilder(100); + cmd.append(rProfBinFile.getAbsolutePath()).append(HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator()); + cmd.append(LOG_VIEWER).append(exeExt).append(" "); + + for (String cmdOption : cmdLineOptions) { + if (!cmdOption.isEmpty()) { + cmd.append("\"" + cmdOption + "\" "); + } + } + logMsg("executing: " + cmd.toString()); +// logMsg("executing: " + rProfBinFile.getAbsolutePath() + HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator() + cmd.toString()); +// return HpelSetup.getNodeUnderTest().getMachine().execute(LOG_VIEWER + exeExt, cmdLineOptions, rProfBinFile.getAbsolutePath()); + return HpelSetup.getNodeUnderTest().getMachine().execute(cmd.toString(), rProfBinFile.getAbsolutePath()); +// } +// //iSeries LogViewer needs to be executed in the shell qsh +// else{ +// return HpelSetup.getNodeUnderTest().getMachine().executeQSH(LOG_VIEWER, cmdLineOptions, rProfBinFile.getAbsolutePath(), null); +// } + } + + /** + * Tests that LogViewer can be executed on the target machine and that no error's are thrown. If the repositories + * are in the default location - logViewer will execute against default values; i.e. against the log and trace data + * located in the profile's log directory etc. If the configuration shows that the logdata is being written to + * another location; that location will be passed to logViewer. In the case where the log data is being written to + * another location, only the log data will be ran against. + * + * @throws Exception + */ + public void testLogViewerExecutes() throws Exception { + // need to have messages for the logViewer to process. + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), LogViewerExec.class.getName(), "Some Msg goes here", null, 25, CommonTasks.LOGS, -1); + + Node node = HpelSetup.getNodeUnderTest(); + rOutLog = new RemoteFile(node.getMachine(), node.getMachine().getTempDir(), outFileName); + + this.logStep("executing logViewer on " + node.getProfileName()); + + String arg1 = "-outLog"; + String arg2 = rOutLog.getAbsolutePath(); + + ProgramOutput lvPrgmOut; + + lvPrgmOut = exeLogViewer(new String[] { arg1, arg2, "-repositoryDir", CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() }); + + this.logVerificationPoint("Verifying logViewer std out/err and status return code."); + logMsg(" === LogViewer's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === LogViewer std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + assertTrue("Failed assertion that logViewer exited with successful return code", (lvPrgmOut.getReturnCode() == 0)); + + assertTrue("Failed assertion that logViewer did produce an output file", rOutLog.exists()); + this.logVerificationPassed(); + this.logStepCompleted(); + + // pull the resulting text based log over to test machine. + this.logStep("Pulling logViewer output file ( " + outFileName + " ) to results dir"); + RemoteFile lResultsDir = new RemoteFile(Machine.getLocalMachine(), Props.getFileProperty(Props.DIR_LOG).getCanonicalPath()); + RemoteFile lOutLog = new RemoteFile(Machine.getLocalMachine(), lResultsDir, outFileName); + + lOutLog.copyFromSource(rOutLog, true); // Even though file is text we are getting transfer exceptions that + // appear to be because logViewer output is UTF8 or contains other + // special characters. Transferring in binary seems to correct this. + this.logStepCompleted(); + } + + /** + * Tests that logViewer correctly report an invalid option when one is passed to it. + * + * @throws Exception + */ + public void testLogViewerInvalidOption() throws Exception { + this.logStep("executing logViewer on " + HpelSetup.getNodeUnderTest().getProfileName()); + // generate a random option that is between 3 and 15 characters long starting with "bad". + String alphabet = "abcdefghijklmnopqrstuvwxyz"; + StringBuffer invalidOption = new StringBuffer(); + invalidOption.append("-bad"); // need the option flag first. + Random rnd = new Random(); + for (int i = 1; i <= rnd.nextInt(12); i++) { + invalidOption.append(alphabet.charAt(rnd.nextInt(alphabet.length()))); + } + + StringBuffer expectedResponse = new StringBuffer(); + expectedResponse.append("Unknown Argument: "); + expectedResponse.append(invalidOption); + expectedResponse.append("\\s+"); //match as a regular expression + expectedResponse.append("Use option -help for usage information."); + + ProgramOutput lvPrgmOut = exeLogViewer(new String[] { invalidOption.toString() }); + this.logVerificationPoint("Verifying logViewer std out/err and status return code."); + logMsg(" === LogViewer's stdout: === "); + logMsg(lvPrgmOut.getStdout()); + logMsg(" "); + if (lvPrgmOut.getStderr().length() > 0) { + // LogViewer reported some errors. + logMsg(" === LogViewer std.err: ==="); + logMsg(lvPrgmOut.getStderr()); + } + + assertTrue("Failed assertion that logViewer exited with an error return code", (lvPrgmOut.getReturnCode() != 0)); + assertTrue("Failed assertion that logViewer reported invalid option. Where //s is any number of spaces, expected=" + + expectedResponse.toString().trim() + ". result=" + lvPrgmOut.getStdout().trim(), + Pattern.matches(expectedResponse.toString(), lvPrgmOut.getStdout().trim())); + + this.logVerificationPassed(); + this.logStepCompleted(); + } + + public void testHeaderProcessName() throws Exception { + this.logStep("get instance list from " + HpelSetup.getNodeUnderTest().getProfileName()); + + ProgramOutput lvPrgmOut = exeLogViewer(new String[] { "-listInstances", "-repositoryDir", CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() }); + String out = lvPrgmOut.getStdout(); + + // (WI 234118) We cannot rely on matching "Instance ID" as the header because that message is translated when running in non-English locales, causing this + // test to fail. Instead, match the lines starting with a number assuming those are the instance IDs. + // Collect IDs belonging to the current instance run. + int indx; + String controllerID = null; + ArrayList ids = new ArrayList(); + for (String outLine : out.split("\\r?\\n")) { + Pattern p = Pattern.compile("^\\s*(\\d+(?:/\\S+)?)\\s"); + Matcher m = p.matcher(outLine); + if (m.find()) { + String newID = m.group(1); + logMsg("Processing instance id " + newID); + indx = newID.indexOf('/'); + String newControllerID = indx < 0 ? newID : newID.substring(0, indx); + logMsg("It belongs to controller " + newControllerID); + if (controllerID == null || !controllerID.equals(newControllerID)) { + // It's a new controller's instance, reset the list of IDs. + logMsg("It's a new controller, reset list of instances"); + ids.clear(); + controllerID = newControllerID; + } + ids.add(newID); + } + } + + assertFalse("No instance IDs found", ids.isEmpty()); + this.logStepCompleted(); + + this.logStep("Verify procName and procId for each retrieved instance"); + + boolean isZOS = HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS); + boolean hasController = false; + boolean hasServant = false; + ApplicationServer server = HpelSetup.getServerUnderTest(); + for (String id : ids) { + this.logVerificationPoint("Verifying instance " + id); + + lvPrgmOut = exeLogViewer(new String[] { "-instance", id, "-repositoryDir", CommonTasks.getBinaryLogDir(HpelSetup.getServerUnderTest()).getAbsolutePath() }); + out = lvPrgmOut.getStdout(); + // Should be okay matching the English text here because this is not a translated message. + int indx1 = out.indexOf(" running with process name "); + int indx2 = out.indexOf(" and process id ", indx1); + assertTrue("Instance with ID " + id + " does not have proper header", indx1 > 0 && indx2 > indx1); + String procName = out.substring(indx1 + 27, indx2); + String procId = out.substring(indx2 + 16).split("\\s*\\n\\s*", 2)[0]; + String expProcName; + String expProcId; + if (isZOS) { + indx = id.indexOf("/"); + if (indx < 0) { + // This is controller, take name values from Simplicity, can't verify jobID this way though + expProcName = server.getShortName(); + hasController = true; + } else { + // This is servant, take values from instance ID. + indx1 = id.indexOf("-", indx); + indx2 = id.indexOf("_", indx1); + assertTrue("Instance ID " + id + " is incorrectly formatted", indx1 > indx && indx2 > indx1); + expProcName = id.substring(indx1 + 1, indx2); + expProcId = id.substring(indx2 + 1); + hasServant = true; + assertEquals("Process ID is incorrect", expProcId, procId); + } + } else { + // On Liberty procName is just the server name. + expProcName = server.getBackend().getServerName(); +// expProcName = server.getCellName() + "\\" + server.getNodeName() + "\\" + server.getName(); + // Don't verify process Id since it is not available in Liberty FAT +// expProcId = server.getProcessIdString(); +// assertEquals("Process ID is incorrect", expProcId, procId); + } + assertEquals("Process Name is incorrect", expProcName, procName); + + this.logVerificationPassed(); + } + + this.logVerificationPoint("Verifying completeness of the test"); + if (isZOS) { + if (!hasController && !hasServant) { + fail("Test on zOS is missing both controller and servant instances"); + } + if (!hasController) { + fail("Test on zOS is missing controller instance"); + } + if (!hasServant) { + fail("Test on zOS is missing at least one servant instance"); + } + } else if (ids.size() == 0) { + fail("Test on distributed has no instances to verify"); + } + this.logVerificationPassed(); + + this.logStepCompleted(); + } + + /** + * Clean up instance resources to initialize this TestCase. + * + * @throws Exception + * if a problem happens while configuring the test fixture. + */ + @Override + public void tearDown() throws Exception { + // delete the output log on the remote machine. + if ((rOutLog != null) && (rOutLog.exists())) + rOutLog.delete(); + + // call the super + super.tearDown(); + } + + /** + * A simple method used to log messages from this test case to the test case's logs + */ + public void logMsg(String msg) { + if (thisLogger.isLoggable(Level.INFO)) { + thisLogger.info(msg); + } + } + +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/TraceSpecificationSetToAllTest.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/TraceSpecificationSetToAllTest.java new file mode 100755 index 00000000000..28cc7a15ea1 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/TraceSpecificationSetToAllTest.java @@ -0,0 +1,150 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.BufferedReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.OperatingSystem; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; +import componenttest.topology.utils.HttpUtils; + +/** + * This FAT test is written against RTC defect 137645 and 99171 + */ +public class TraceSpecificationSetToAllTest extends VerboseTestCase { + +// private static LibertyServer server = LibertyServerFactory.getLibertyServer("HpelServer"); + private ApplicationServer server = null; + private static final int CONN_TIMEOUT = 60; + private final Class c = TraceSpecificationSetToAllTest.class; + + RemoteFile rProfRootDir = null; + RemoteFile rProfBinFile = null; + + private static final String traceSpecification = "com.ibm.ws.logging.*=all"; + + public TraceSpecificationSetToAllTest(String name) { + super(name); + } + + @Override + public void setUp() throws Exception { + server = HpelSetup.getServerUnderTest(); + + if (!CommonTasks.isHpelEnabled(server)) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + server.getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(HpelSetup.getServerUnderTest(), true); + // if HPEL was not enabled, make sure trace spec is not valid to ensure restart below. + this.logStepCompleted(); + } + + CommonTasks.setHpelTraceSpec(HpelSetup.getServerUnderTest(), traceSpecification); + + CommonTasks.addBootstrapProperty(server, "com.ibm.ws.logging.trace.specification", "com.ibm.ws.logging.*=all:com.ibm.ws.org.*=all=enabled"); + + this.logStep("Bouncing server for new spec to take effect. Stopping application server"); + HpelSetup.getServerUnderTest().stop(); + this.logStepCompleted(); + + // Start Server + this.logStep("Starting the application server"); + HpelSetup.getServerUnderTest().start(); + this.logStepCompleted(); + + this.logStep("Checking the trace spec post app server restart: " + + CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest())); + this.logStepCompleted(); + assertTrue("Failed assertion that HPEL trace specification is set to " + traceSpecification, + traceSpecification.contains(CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest()))); + } + + /** + * This fat test ensures that if we set trace specification as "com.ibm.ws.logging.trace.specification=*=all" + * and write the entry, exit level messages then servlet request goes well and + * server does not throw StackOverflow exception. + * + * RTC WI : 137645 + * + * @throws Exception + */ + public void testResourceInjectionWorkNotGivingStackOverflow() throws Exception { + String arg1 = "view"; + String compareString; + + String txt = "http://" + server.getBackend().getHostname() + ":" + server.getBackend().getHttpDefaultPort() + "/HpelFat/WritingCustomLogServlet"; + URL url = new URL(txt); + Log.info(c, "testResourceInjectionWorkNotGivingStackOverflow", "Calling customLogger Application with URL=" + url.toString()); + + HttpURLConnection con = HttpUtils.getHttpConnection(url, HttpURLConnection.HTTP_OK, CONN_TIMEOUT); + BufferedReader br = HttpUtils.getConnectionStream(con); + String line = br.readLine(); + assertTrue("The response did not contain \'Servlet successfullly completed\' it's content was: " + line, + line.contains("Servlet successfullly completed")); + + compareString = "StackOverFlow"; + ProgramOutput lvPrgmOut = exeBinaryLog(new String[] { arg1, server.getBackend().getServerName(), "--includeInstance=latest" }); + Log.info(c, "testResourceInjectionWorkNotGivingStackOverflow", "Server Name : " + server.getBackend().getServerName()); + + String out = lvPrgmOut.getStdout(); + assertFalse(compareString, out.contains(compareString)); + + /** + * This assert verify RTC WI : 99171 + * Defect says that HPEL logs does not matches with text log. And comparison string used was + * "Event:org.osgi.framework.BundleEvent[source=com.ibm.ws.logging.osgi" + * We have replicated the same scenario here. + */ + compareString = "BundleEvent STARTING"; + assertTrue(compareString, out.contains(compareString)); + + compareString = "Event:org.osgi.framework.BundleEvent[source=com.ibm.ws.logging.osgi"; + assertTrue(compareString, out.contains(compareString)); + } + + /** + * A method to drive the execution of the binaryLog tool on the remote machine/server that is being tested. + * + * @throws Exception + */ + private ProgramOutput exeBinaryLog(String[] cmdLineOptions) throws Exception { + // make platform agnostic to handle .sh and .bat + String exeExt = ""; + final String BINARY_LOG = "binaryLog"; + + if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.WINDOWS)) { + exeExt = ".bat"; + } + rProfRootDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), HpelSetup.getServerUnderTest().getBackend().getInstallRoot()); + rProfBinFile = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), rProfRootDir, "bin"); + StringBuilder cmd = new StringBuilder(100); + cmd.append(rProfBinFile.getAbsolutePath()).append(HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().getFileSeparator()); + cmd.append(BINARY_LOG).append(exeExt).append(" "); + + for (String cmdOption : cmdLineOptions) { + if (!cmdOption.isEmpty()) { + cmd.append("\"" + cmdOption + "\" "); + } + } + + Log.info(c, "exeBinaryLog", "executing: " + cmd.toString()); + return HpelSetup.getNodeUnderTest().getMachine().execute(cmd.toString(), rProfBinFile.getAbsolutePath()); + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/VerifyRepositoryAccuracy.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/VerifyRepositoryAccuracy.java new file mode 100755 index 00000000000..671b73a37bd --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/hpel/tests/VerifyRepositoryAccuracy.java @@ -0,0 +1,337 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * F017049-18796.1 8.0 1/08/2010 spaungam Update test to support subdirectories + * F000896.23216 8.0 06/10/2010 shighbar Update to work on z/OS requires support for reading servants. Refactored initialize method into setup to reduce restarts which was impacting test on z/OS. + */ +package com.ibm.ws.fat.hpel.tests; + +import java.io.File; +import java.util.Date; + +import com.ibm.websphere.logging.hpel.reader.RepositoryLogRecord; +import com.ibm.websphere.logging.hpel.reader.RepositoryReaderImpl; +import com.ibm.websphere.logging.hpel.reader.ServerInstanceLogRecordList; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.ws.fat.Props; +import com.ibm.ws.fat.VerboseTestCase; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.ras.util.CommonTasks; + +/** + * This test is about verifying that HPEL is accurately reporting the number of messages sent to it. + * + * The test outline is as follows: 1: Create an HTTP client to the LogCreator JSP that logs messages (use the + * CommonTasks object) 2: Enable tracing so a tracedata directory and repository is created 3: Call the HTTP client with + * a known number of logging entries 4: Get the log records from the repository and count them 5: Do they match? Yes, + * pass, No, fail + * + */ +public class VerifyRepositoryAccuracy extends VerboseTestCase { + String localLogsRepositoryPath = null; + String localTraceRepositoryPath = null; + String uniqueLoggerID_Tag; + String loggerName = "VRAccuracyLogger"; + String logMessage = "VRAccuracy Message for FAT testing"; + final String TRACE_SPECIFICATION = "VRAccuracyLogger*=all"; // trace spec needed for this test case. + int logCount = 49; + boolean loggerSetup = false; + + public VerifyRepositoryAccuracy(String name) { + super(name); + } + + /** + * Configures instance resources to initialize this TestCase. + * + * @throws Exception + * if a problem happens while configuring the test fixture. + */ + @Override + public void setUp() throws Exception { + // Call super.SetUp() cause we still want it's setup as well + super.setUp(); + + // Confirm HPEL is enabled + if (!CommonTasks.isHpelEnabled(HpelSetup.getServerUnderTest())) { + // HPEL is not enabled. + this.logStep("HPEL is not enabled on " + HpelSetup.getServerUnderTest().getName() + ", attempting to enable."); + CommonTasks.setHpelEnabled(HpelSetup.getServerUnderTest(), true); + // if HPEL was not enabled, make sure trace spec is not valid to ensure restart below. + CommonTasks.setHpelTraceSpec(HpelSetup.getServerUnderTest(), null); + this.logStepCompleted(); + } + + /* + * Since we have multiple test methods in this test case, we will only restart if the spec is not already set to + * what we need. This will avoid extra server restarts which adds to the bucket execution time. + */ + this.logStep("Checking the HPEL trace spec for " + this.getName()); + if (!CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest()).equals(TRACE_SPECIFICATION)) { + // The current spec is not what we need for this test - update spec and bounce server to take effect + this.logStep("Updating the hpel trace spec to " + TRACE_SPECIFICATION + " as part of setup for " + this.getName()); + CommonTasks.setHpelTraceSpec(HpelSetup.getServerUnderTest(), TRACE_SPECIFICATION); + + // need to restart the application server now + // Stop Server first. + this.logStep("Bouncing server for new spec to take effect. Stopping application server"); + HpelSetup.getServerUnderTest().stop(); + this.logStepCompleted(); + + Thread.sleep(10000); // stop operation blocks, but want short pause before restarting. + + // Start Server + this.logStep("Restarting the application server"); + HpelSetup.getServerUnderTest().start(); + + this.logStep("Checking the trace spec post app server restart: " + + CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest())); + assertTrue("Failed assertion that HPEL trace specification is set to " + TRACE_SPECIFICATION, TRACE_SPECIFICATION + .equals(CommonTasks.getHpelTraceSpec(HpelSetup.getServerUnderTest()))); + this.logStepCompleted(); + + } + } + + private void setupLogger() { + if (!loggerSetup) { + // setup a new unique identifier for the logger name + Date d = new Date(); + loggerName = loggerName + d.getTime(); + this.logStep("Creating a new logger named: " + loggerName); + this.logStepCompleted(); + loggerSetup = true; + } + } + + /* + * Tests that HPEL accurately reports the number of logs records entered. Assumes that HPEL is enabled on the active + * server + */ + public void testLogRecordCountAccuracyCheck() throws Exception { + // Create the following log entries in the repository + // Levels: All (pass null) + // LoggerName: com.ibm.ws.fat.hpel.tests.VRAccuracy + uniqueLoggerID_Tag + // Log Message: VRAccuracy Message for FAT testing + // Iterations: 49 (just picked a random number) + + setupLogger(); + + this.logStep("Creating the log entries"); + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), loggerName, logMessage, null, logCount, CommonTasks.LOGS, -1); + this.logStepCompleted(); + + Thread.sleep(10 * 1000); // sleep for 10 seconds + + // Get the logs from the server to check what is in them + this.logStep("Getting the message logs from the server"); + getLogsFromServer(CommonTasks.LOGS); + this.logStepCompleted(); + + // Go read the repository and see if it has what we are looking for + RepositoryReaderImpl logRepository = new RepositoryReaderImpl(localLogsRepositoryPath); + ServerInstanceLogRecordList CurrentProcessLogList = logRepository.getLogListForCurrentServerInstance(); + // record list is the list of records we will compare against. Assume it's the currentServerInstance list by + // default. + Iterable recordList = CurrentProcessLogList; + + /* + * Note, if we are on z/OS the CurrentProcessLogList represents only the controller's logs. Our test log entries + * will be written by servant though. Will setup a Merged repository to include all the logs from sub-process + * instances. + */ + //The problem is with how test counts records on zOS. HPEL allows server to have a parent process (controller) with a set of child processes (servants). + //For such servers result for a server instance has none empty result from getChildren() call. The test problem is that it assumes that logs recorded by an application on zOS can be found _only_ in children processes. + //On Liberty that is not the case since even on zOS server consists of a single process processing all the requests. + + //The problem can be solved in two ways. 1. Remove 'if zOS' condition since the test is maintained separately on Liberty. + //2. Adjust test to do merge between parent and children logs for all OSs. Following the first solution here. + + //if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS)) { + //this.logStep("Since this is z/OS - using a MergedRepository representing all the servant and adjunct sub-processes"); + //recordList = new MergedRepository(CurrentProcessLogList.getChildren().values()); + //} + + this.logStep("Counting log records by level"); + int severe = 0; + int warning = 0; + int info = 0; + for (RepositoryLogRecord record : recordList) { + // process a record + if (record.getLoggerName().equals(loggerName)) { + switch (record.getLevel().intValue()) { + case 1000: // SEVERE == 1000 + severe++; + break; + case 900: // WARNING == 900 + warning++; + break; + case 800: // INFO == 800 + info++; + break; + } + } + } + this.logStepCompleted(); + + // Verify the results + this.logVerificationPoint("Verifying the repository log (Level.SEVERE) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.SEVERE {counted:wrote} {" + severe + + ":" + logCount + "}", severe == logCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository log (Level.WARNING) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.WARNING {counted:wrote} {" + warning + + ":" + logCount + "}", warning == logCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository log (Level.INFO) count against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.INFO {counted:wrote} {" + info + ":" + + logCount + "}", info == logCount); + this.logVerificationPassed(); + } + + /* + * Tests that HPEL accurately reports the number of logs records entered. Assumes that HPEL is enabled on the active + * server + */ + public void testTraceRecordCountAccuracyCheck() throws Exception { + // Create the following log entries in the repository + // Levels: All (pass null) + // LoggerName: com.ibm.ws.fat.hpel.tests.VRAccuracy + uniqueLoggerID_Tag + // Log Message: VRAccuracy Message for FAT testing + // Iterations: 476 (just picked a random number) + + setupLogger(); + + this.logStep("Creating the trace entries"); + CommonTasks.createLogEntries(HpelSetup.getServerUnderTest(), loggerName, logMessage, null, logCount, CommonTasks.TRACE, -1); + this.logStepCompleted(); + + Thread.sleep(10 * 1000); // sleep for 10 seconds + + // Get the logs from the server to check what is in them + this.logStep("Getting the trace logs from the server"); + getLogsFromServer(CommonTasks.TRACE); + this.logStepCompleted(); + + // =================================== + + // Go read the repository and see if it has what we are looking for + RepositoryReaderImpl logRepository = new RepositoryReaderImpl(localTraceRepositoryPath); + ServerInstanceLogRecordList CurrentProcessLogList = logRepository.getLogListForCurrentServerInstance(); + // record list is the list of records we will compare against. Assume it's the currentServerInstance list by + // default. + Iterable recordList = CurrentProcessLogList; + + /* + * Note, if we are on z/OS the CurrentProcessLogList represents only the controller's logs. Our test log entries + * will be written by servant though. Will setup a Merged repository to include all the logs from sub-process + * instances. + */ + //The problem is with how test counts records on zOS. HPEL allows server to have a parent process (controller) with a set of child processes (servants). + //For such servers result for a server instance has none empty result from getChildren() call. The test problem is that it assumes that logs recorded by an application on zOS can be found _only_ in children processes. + //On Liberty that is not the case since even on zOS server consists of a single process processing all the requests. + + //The problem can be solved in two ways. 1. Remove 'if zOS' condition since the test is maintained separately on Liberty. + //2. Adjust test to do merge between parent and children logs for all OSs. Following the first solution here. + + //if (HpelSetup.getNodeUnderTest().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS)) { + //this.logStep("Since this is z/OS - using a MergedRepository representing all the servant and adjunct sub-processes"); + //recordList = new MergedRepository(CurrentProcessLogList.getChildren().values()); + //} + + this.logStep("Counting log records by level"); + int fine = 0; + int finer = 0; + int finest = 0; + for (RepositoryLogRecord record : recordList) { + // process a record + if (record.getLoggerName().equals(loggerName)) { + switch (record.getLevel().intValue()) { + case 500: // FINE == 500 + fine++; + break; + case 400: // FINER == 400 + finer++; + break; + case 300: // FINEST == 300 + finest++; + break; + default: + System.out.println("loggerName expected: " + loggerName); + System.out.println("loggerName found: " + record.getLoggerName()); + System.out.println("level: " + record.getLevel()); + System.out.println("level in value: " + record.getLevel().intValue()); + } + } + } + this.logStepCompleted(); + + // Verify the results + this.logVerificationPoint("Verifying the repository trace count (Level.FINE) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINE {counted:wrote} {" + fine + ":" + + logCount + "}", fine == logCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository trace count (Level.FINER) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINER {counted:wrote} {" + finer + + ":" + logCount + "}", finer == logCount); + this.logVerificationPassed(); + + this.logVerificationPoint("Verifying the repository trace count (Level.FINEST) against the expected count."); + assertTrue("The repository does not contain the number of records it had wrote for Level.FINEST {counted:wrote} {" + finest + + ":" + logCount + "}", finest == logCount); + this.logVerificationPassed(); + + } + + /* + * This is a utility method to get all of the repository logs as well as the trace logs. + * + * @ param filesToGet This is a switch for which files to get. Options are CommonTasks.LOGS or CommonTasks.TRACE, + */ + private void getLogsFromServer(String filesToGet) throws Exception { + if (filesToGet.equals(CommonTasks.LOGS)) { + // Set up the Simplicity objects to the remote files + RemoteFile remoteLogsDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), CommonTasks.getBinaryLogDir(HpelSetup + .getServerUnderTest()), "logdata"); + + // Set up the Simplicity object to the local results directory + RemoteFile localLogsResultsDir = new RemoteFile(Machine.getLocalMachine(), Props.getFileProperty(Props.DIR_LOG) + .getCanonicalPath() + + File.separator + VerifyRepositoryAccuracy.class.getSimpleName() + File.separator + "logs"); + + // Save off the path of the repository log files directory + localLogsRepositoryPath = localLogsResultsDir.getAbsolutePath(); + localLogsResultsDir.copyFromSource(remoteLogsDir, true, true); + } else if (filesToGet.equals(CommonTasks.TRACE)) { + RemoteFile remoteTraceDir = new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), CommonTasks + .getBinaryTraceDir(HpelSetup.getServerUnderTest()), "tracedata"); + RemoteFile localTraceResultsDir = new RemoteFile(Machine.getLocalMachine(), Props.getFileProperty(Props.DIR_LOG) + .getCanonicalPath() + + File.separator + VerifyRepositoryAccuracy.class.getSimpleName() + File.separator + + "trace"); + + // Save off the path of the repository trace files directory + localTraceRepositoryPath = localTraceResultsDir.getAbsolutePath(); + localTraceResultsDir.copyFromSource(remoteTraceDir, true, true); + } + } + + @Override + public void tearDown() throws Exception { + /* + * Not disabling the spec in tearDown because we would only re-enable for the second test Method. By not + * disabling it we avoid the extra bounce. We assume that any future test cases will update the spec if + * required. + */ + + // call the super + super.tearDown(); + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/ras/util/CommonTasks.java b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/ras/util/CommonTasks.java new file mode 100755 index 00000000000..af0a3ddcd99 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/fat/src/com/ibm/ws/fat/ras/util/CommonTasks.java @@ -0,0 +1,1036 @@ +//%Z% %I% %W% %G% %U% [%H% %T%] +/* + * Change History: + * + * Reason Version Date User id Description + * ---------------------------------------------------------------------------- + * F017049-28712 8.0 06/29/2010 shighbar Updates for SSFAT test cases and new useful methods in prep for z/OS support. + * F17049-32205 8.0 10/04/2010 shighbar Generalize common methods to support additional ServerTypes. + * 681388 8.0 12/07/2010 shighbar Add method to start server with non-standard mBean timeout. + * 689639.fvt 8.0 02/09/2011 spaungam sensitive filtering needs to be enabled earlier + * 695538 8.0 03/08/2011 shighbar testMergedRepositories failures on z/OS. + * 707366 8.0 06/01/2011 shighbar Hpel Internal Trace failures / test case expansion + * PM41930 8.0 08/23/2011 spaungam FFDC loggers to be asynchronous + * 721541 8.0 10/26/2011 spaungam Ensure exceptions appear with logging + */ +package com.ibm.ws.fat.ras.util; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.util.Properties; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.xml.sax.SAXException; + +import com.ibm.websphere.simplicity.ApplicationServer; +import com.ibm.websphere.simplicity.Cell; +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.Node; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.Server; +import com.ibm.websphere.simplicity.ServerType; +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import com.ibm.websphere.simplicity.runtime.ProcessStatus; +import com.ibm.ws.fat.hpel.setup.HpelSetup; +import com.ibm.ws.fat.util.CommonActions; +import com.ibm.ws.fat.util.StopWatch; +import com.meterware.httpunit.PostMethodWebRequest; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.WebResponse; +import componenttest.topology.impl.LibertyServer; + +/** + * Holding class for driving common logic across multiple test cases/drivers + * + */ +public class CommonTasks { + + public static final String HPEL_APP_CONTEXT_ROOT = "HpelFat"; + public static final String HPEL_APP_GENLOG_JSP = "ivtLogSleep.jsp"; + public static final String HPEL_APP_CREATE_LOG_JSP = "LogCreator.jsp"; + public static final String RAS_ZIPPER_UTIL_JSP = "RasZipper.jsp"; + public static final String LOGS = "Logs"; + public static final String TRACE = "Trace"; + public static final String LOGS_TRACE = "LogsAndTrace"; + + public static enum zOSProcessType { + Control, Adjunct, Servant + } + + private static final int SERVER_START_MBEAN_TIMEOUT = 240; + +// private static final String JYTHON_RAS_RAWTRACE_SWITCH = "RasConfigEnableRawTrace.jy"; + + /** + * Makes use of the ivtLogSleep.jsp in the sample application to drive creation of log records. + * + * @param numCycles + * How many iterations to run (each iteration generates multiple log records, one of each level). Must be + * a positive integer, or else only onecycle will be ran + * + * @param cycleDelay + * The delay you want between each cycle in seconds. Useful for having steady stream of log entries + * created. If not a positive number, zero will be used. + * @throws Exception + * @throws SAXException + * @throws IOException + * @throws MalformedURLException + */ +// @Deprecated +// public static void genLogEntries(int numCycles, int cycleDelay) throws MalformedURLException, IOException, SAXException, Exception { +// if (numCycles <= 0) { +// numCycles = 1; +// } +// if (cycleDelay <= 0) { +// cycleDelay = 0; +// } +// +// String jsp = "/" + HPEL_APP_CONTEXT_ROOT + "/" + HPEL_APP_GENLOG_JSP; +// String jspParams = "?ActionParm=trace&NumberOfIterations=" + Integer.toString(numCycles) + "&CycleDelay=" +// + Integer.toString(cycleDelay); +// +// WebConversation wc = new WebConversation(); +// writeLogMsg(Level.INFO, " Getting URL: " + CommonActions.getUrl(HpelSetup.getServerUnderTest(), jsp + jspParams, false)); +// WebResponse response = wc.getResponse(CommonActions.getUrl(HpelSetup.getServerUnderTest(), jsp + jspParams, false)); +// +// int rc = response.getResponseCode(); +// writeLogMsg(Level.INFO, " Response Code for jsp is: " + Integer.toString(rc)); +// +// } + + /** + * @Deprecated A shortcut to createLogEntries(ApplicationServer appServer, String loggerName, String message, Level + * level, int iterations, String repository, int sleepTime) with no sleep time and assuming executing + * against the default application server for the test bucket. + */ +// @Deprecated +// public static WebResponse createLogEntries(String loggerName, String message, Level level, int iterations, String repository) +// throws MalformedURLException, IOException, SAXException, Exception { +// return createLogEntries(loggerName, message, level, iterations, repository, -1); +// } + + /** + * @Deprecated A shortcut to createLogEntries(ApplicationServer appServer, String loggerName, String message, Level + * level, int iterations, String repository, int sleepTime) without the requirement to pass in + * application server. + */ +// @Deprecated +// public static WebResponse createLogEntries(String loggerName, String message, Level level, int iterations, String repository, +// int sleepTime) throws MalformedURLException, IOException, SAXException, Exception { +// return createLogEntries(HpelSetup.getServerUnderTest(), loggerName, message, level, iterations, repository, sleepTime); +// } + + /** + * Makes use of the LogCreator.jsp in the RAS sample application to drive creation of log records. + * + * @param appServer + * The application server on which the log entries should be created. + * @param loggerName + * The name of the logger the JSP is to use. Default loggerName: Default_HPELTestLogger + * @param message + * The message the logger is to log. Default message: Default HPEL Message + * @param level + * The level of message to be logged. Choices are ALL, SEVERE, WARNING, INFO, FINE, FINER, FINEST Default + * value: ALL + * @param iterations + * How many iterations to run (each iteration generates multiple log records, one of each level). Must be + * a positive integer. Default value: 49 + * @param repository + * The repository to create the messages into. There are 3 choices, CommonTasks.LOGS, CommonTasks.TRACE + * or CommonTasks.LOGS_TRACE Default value: CommonTasks.LOGS + * @param sleepTime + * The time between iterations in milliseconds. + * @param async + * Value of the logger's (if it is a WAS WsLogger) async value to be set to. + * + * @return WebResponse + * + * @throws Exception + * @throws SAXException + * @throws IOException + * @throws MalformedURLException + */ + public static WebResponse createLogEntries(ApplicationServer appServer, String loggerName, String message, Level level, + int iterations, String repository, int sleepTime, boolean async) throws MalformedURLException, IOException, SAXException, Exception { + String jspParams = "?ActionParam="; + String jsp = "/" + HPEL_APP_CONTEXT_ROOT + "/" + HPEL_APP_CREATE_LOG_JSP; + String actionParam = CommonTasks.LOGS; + + // make the generation of both messages and logs the default + if (repository != null) { + actionParam = repository; + } + jspParams += actionParam + "&"; + + // check to see if anything was passed, if nothing was, all of the JSP's defaults can be used + if ((loggerName != null) || (message != null) || (level != null) || (iterations > 0)) { + String s1, s2, s3, s4, s5 = null, s6; + + if (loggerName != null) { + s1 = "LoggerName=" + loggerName; + } else { + s1 = "LoggerName=Default_HPELTestLogger"; + } + if (message != null) { + s2 = "Message=" + message; + } else { + s2 = "Message='Default HPEL Message'"; + } + if (level != null) { + s3 = "Level=" + level.getName(); + } else { + s3 = "Level=ALL"; + } + if (iterations > 0) { + s4 = "Iterations=" + Integer.toString(iterations); + } else { + s4 = "Iterations=49"; + } + + if (sleepTime > -1) + s5 = "Sleep=" + sleepTime; + + s6 = async ? "Async=true" : "Async=false"; + + jspParams += s1 + "&" + s2 + "&" + s3 + "&" + s4 + "&" + s5 + "&" + s6; + } + + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse(CommonActions.getUrl(appServer, jsp + jspParams, false)); + + return response; + } + + /** + * Makes use of the LogCreator.jsp in the RAS sample application to drive creation of log records. + * + * @param appServer + * The application server on which the log entries should be created. + * @param loggerName + * The name of the logger the JSP is to use. Default loggerName: Default_HPELTestLogger + * @param message + * The message the logger is to log. Default message: Default HPEL Message + * @param level + * The level of message to be logged. Choices are ALL, SEVERE, WARNING, INFO, FINE, FINER, FINEST Default + * value: ALL + * @param iterations + * How many iterations to run (each iteration generates multiple log records, one of each level). Must be + * a positive integer. Default value: 49 + * @param repository + * The repository to create the messages into. There are 3 choices, CommonTasks.LOGS, CommonTasks.TRACE + * or CommonTasks.LOGS_TRACE Default value: CommonTasks.LOGS + * @param sleepTime + * The time between iterations in milliseconds. + * + * @return WebResponse + * + * @throws Exception + * @throws SAXException + * @throws IOException + * @throws MalformedURLException + */ + public static WebResponse createLogEntries(ApplicationServer appServer, String loggerName, String message, Level level, + int iterations, String repository, int sleepTime) throws MalformedURLException, IOException, SAXException, Exception { + + return createLogEntries(appServer, loggerName, message, level, iterations, repository, sleepTime, false); + } + + /** + * Returns a ConfigObject representing the RAS Logging Service configuration in the model. + * + * @param aServer + * aServer The server you want the RAS Logging Service ConfigObject for + * + * @return ulsConfigObj + */ +// public static ConfigObject getLegacyLoggingService(Server aServer) throws Exception { +// ConfigObject ulsConfigObj = ConfigObject.getConfigObject(aServer, aServer.getConfigId(), "RASLoggingService"); +// return ulsConfigObj; +// } + + /** + * Returns a ConfigObject representing the HPEL configuration in the model. + * + * @param aServer + * aServer The server you want the HPEL ConfigObject for + * + * @return ulsConfigObj + */ +// public static ConfigObject getUnifiedLoggingService(Server aServer) throws Exception { +// ConfigObject ulsConfigObj = ConfigObject.getConfigObject(aServer, aServer.getConfigId(), "HighPerformanceExtensibleLogging"); +// return ulsConfigObj; +// } + + /** + * Returns a ConfigObject representing the child HPEL configuration in the model. + * + * @param aServer + * The server you want the child HPEL ConfigObject for. + * @param childName + * The name of the child configuration object you want to retrieve. + * + * @return ulsConfigObj + */ +// private static ConfigObject getUnifiedLoggingServiceChild(Server aServer, String childName) throws Exception { +// // this fails due to bug in Simplicity. +// // return ConfigObject.getConfigObject(HpelSetup.getServerUnderTest(), +// // getUnifiedLoggingService().getConfigIdentifier(), childName); +// +// List binChild1 = getUnifiedLoggingService(aServer).getChildObjectListByName(childName); +// if (binChild1.iterator().hasNext()) +// return binChild1.iterator().next(); // We should only get one child back. +// else +// return null; +// } + + /** + * Returns a ConfigObject representing the HPEL Binary Log configuration in the model. + * + * @param aServer + * The server you want the HPEL Binary Log ConfigObject for. + * + * @return The ConfigObject for the HPEL Binary Log. + */ +// public static ConfigObject getBinaryLogChild(Server aServer) throws Exception { +// return getUnifiedLoggingServiceChild(aServer, "HPELLog"); +// } + + /** + * Returns a ConfigObject representing the HPEL Binary Trace configuration in the model. + * + * @param aServer + * The server you want the HPEL Binary Trace ConfigObject for. + * + * @return The ConfigObject for the HPEL Binary Trace. + */ +// public static ConfigObject getBinaryTraceChild(Server aServer) throws Exception { +// return getUnifiedLoggingServiceChild(aServer, "HPELTrace"); +// } + + /** + * Returns a ConfigObject representing the HPEL Text Log configuration in the model. + * + * @param aServer + * The server you want the HPEL Text Log ConfigObject for. + * + * @return The ConfigObject for the HPEL Text Log. + */ +// public static ConfigObject getTextLogChild(Server aServer) throws Exception { +// return getUnifiedLoggingServiceChild(aServer, "HPELTextLog"); +// } + +// @Deprecated +// public static boolean isHpelEnabled() throws Exception { +// return isHpelEnabled(HpelSetup.getServerUnderTest()); +// } + + public static boolean isHpelEnabled(Server aServer) throws Exception { + LibertyServer server = aServer.getBackend(); + RemoteFile bootstrapFile = server.getServerBootstrapPropertiesFile(); + if (bootstrapFile == null || !bootstrapFile.exists()) { + return false; + } + Properties bootstrapProps = new Properties(); + bootstrapProps.load(bootstrapFile.openForReading()); + String logProvider = bootstrapProps.getProperty("websphere.log.provider"); + return logProvider != null && logProvider.startsWith("binaryLogging-"); +// if (getUnifiedLoggingService(aServer) == null) { +// // For backward compatibility - we assume if HPEL config object is null then server.xml is not updated and +// // therefore HPEL must not be enabled since the ConfigObject is returning null. +// writeLogMsg(Level.SEVERE, "isHpelEnabled method got null back from UnifiedLoggingService"); +// if (aServer == null) { +// writeLogMsg(Level.SEVERE, "The application server passed to isHpelEnabled is null"); +// } +// return false; +// } +// boolean tempresult = (getUnifiedLoggingService(aServer).getAttributeByName("enable").getValueAsBoolean() && !getLegacyLoggingService( +// aServer).getAttributeByName("enable").getValueAsBoolean()); +// return tempresult; + } + + public static boolean isHpelSensitiveTraceEnabled(Server aServer) throws Exception { + //if in hpel mode, get HighPerformanceExtensibleLogging +// ConfigObject configObj = getUnifiedLoggingService(aServer).getAttributeByName("rawTraceFilterEnabled"); +// +// if (configObj != null) { +// return configObj.getValueAsBoolean(); +// } +// +// writeLogMsg(Level.INFO, "isHpelSensitiveTraceEnabled configObj is null"); + return false; + } + + public static boolean setHpelSensitiveTraceEnabled(Server aServer, boolean enable) throws Exception { + if (enable == isHpelSensitiveTraceEnabled(aServer)) { + // the server is already set to the value we are trying to set. So do nothing. + return false; + } + + throw new UnsupportedOperationException("SensitiveTrace is not supported yet"); +// Workspace tempWorkSpace = HpelSetup.getCellUnderTest().getWorkspace(); +// getUnifiedLoggingService(aServer).getAttributeByName("rawTraceFilterEnabled").setValue(enable); +// tempWorkSpace.saveAndSync(); +// return true; + } + + public static boolean isRasSensitiveTraceEnabled() throws Exception { + throw new UnsupportedOperationException("SensitiveTrace is not supported yet"); +// String[] scriptArgs = null; +// scriptArgs = new String[3]; +// scriptArgs[0] = HpelSetup.getCellUnderTest().getName(); +// scriptArgs[1] = HpelSetup.getNodeUnderTest().getName(); +// scriptArgs[2] = HpelSetup.getServerUnderTest().getName(); + +// String result = RASWsadminScripts.exeJythonScript(JYTHON_RAS_RAWTRACE_SWITCH, scriptArgs); +// writeLogMsg(Level.INFO, "isRasSensitiveTraceEnabled result of wsadmin: " + result); +// +// return "true".equalsIgnoreCase(result); + } + + public static boolean setRasSensitiveTraceEnabled(boolean enable) throws Exception { + if (enable == isRasSensitiveTraceEnabled()) { + // the server is already set to the value we are trying to set. So do nothing. + return false; + } + + throw new UnsupportedOperationException("SensitiveTrace is not supported yet"); +// String[] scriptArgs = null; +// scriptArgs = new String[5]; +// scriptArgs[0] = HpelSetup.getCellUnderTest().getName(); +// scriptArgs[1] = HpelSetup.getNodeUnderTest().getName(); +// scriptArgs[2] = HpelSetup.getServerUnderTest().getName(); +// scriptArgs[3] = "set"; +// scriptArgs[4] = Boolean.toString(enable); +// +// String result = RASWsadminScripts.exeJythonScript(JYTHON_RAS_RAWTRACE_SWITCH, scriptArgs); +// writeLogMsg(Level.INFO, "setRasSensitiveTraceEnabled result of wsadmin: " + result); +// +// return true; + + } + + /** + * Sets if HPEL is enabled or not in the configuration. + * + * @param aServer + * The server you want to enable or disable HPEL on. + * + * @return True if changes were needed / made. False no changes were required, as in the configuration already matched what was requested. + */ + public static boolean setHpelEnabled(Server aServer, boolean enable) throws Exception { + if (enable == isHpelEnabled(aServer)) { + // the server is already set to the value we are trying to set. So do nothing. + return false; + } + LibertyServer server = aServer.getBackend(); + RemoteFile bootstrapFile = server.getServerBootstrapPropertiesFile(); + if (bootstrapFile == null) { + return false; + } + Properties bootstrapProps = new Properties(); + bootstrapProps.setProperty("websphere.log.provider", "binaryLogging-1.0"); + bootstrapProps.store(bootstrapFile.openForWriting(true), null); + return true; +// Workspace tempWorkSpace = HpelSetup.getCellUnderTest().getWorkspace(); +// getUnifiedLoggingService(aServer).getAttributeByName("enable").setValue(enable); +// getLegacyLoggingService(aServer).getAttributeByName("enable").setValue(!enable); +// tempWorkSpace.saveAndSync(); +// return true; + + // TODO Enabling or disabling HPEL requires us to bounce the server - don't know if we should do that here or + // not though? for now that is the caller's responsibility as they may not want it restarted and or have other + // changes they are making before the restart. + } + + /** + * Sets if HPEL is enabled or not in the configuration, and bounces the application server if needed. + * + * @param aServer + * The server you want to enable or disable HPEL on. The server will only be bounced if the configuration does not already match what was requested. + * + * @return True if changes were needed/made, and the server was bounced. False - no changes were required, as in the configuration already matched what was requested. + */ + public static boolean setHpelEnabledAndBounce(Server aServer, boolean enable) throws Exception { + if (setHpelEnabled(aServer, enable)) { + aServer.stop(); + aServer.start(); + return true; + } + return false; + } + + public static boolean isTextLogEnabled(Server aServer) throws Exception { + LibertyServer server = aServer.getBackend(); + BufferedReader config = new BufferedReader(new InputStreamReader(server.getServerConfigurationFile().openForReading())); + String line; + boolean result = false; + boolean inLogging = false; + while ((line = config.readLine()) != null) { + int index = 0; + if (!inLogging) { + int index1 = line.indexOf("= 0) { + inLogging = true; + index = index1; + } + } + if (inLogging) { + if (!result) { + int index2 = line.indexOf("= 0) { + result = true; + index = index2; + } + } + int index2 = line.indexOf("", index); + if (index2 >= 0) { + inLogging = false; + } + } + } + return result; +// return (getTextLogChild(aServer).getAttributeByName("enabled").getValueAsBoolean()); + } + + public static String getHpelTraceSpec(Server aServer) throws Exception { + LibertyServer server = aServer.getBackend(); + String traceSpec = server.getServerConfiguration().getLogging().getTraceSpecification(); + return traceSpec == null ? "" : traceSpec; +// return (getUnifiedLoggingService(aServer).getAttributeByName("startupTraceSpec").getValueAsString()); + } + + /** + * Sets the HPEL trace specification in the application server's configurations. Changes to the trace specification + * with this method will not take effect until after the application server is bounced. + * + * @param aServer + * The server you want the new trace specification applied to. + * @param newTraceSpec + * The new trace specification, such as 'com.ibm.myClass*=all' etc. Passing a null String is equivalent + * to specifying a trace string of '*=info' + * + * @throws Exception + */ + public static void setHpelTraceSpec(Server aServer, String newTraceSpec) throws Exception { + if (null == newTraceSpec) { + // null spec is equivalent to default no trace spec. + newTraceSpec = "*=info"; + } + + // check if we need to update the spec or if it's already set to what we want. + if (getHpelTraceSpec(aServer).equals(newTraceSpec)) { + writeLogMsg(Level.FINE, "HPEL Trace Spec already set to " + newTraceSpec + ". No change needed."); + return; + } else { + LibertyServer server = aServer.getBackend(); + ServerConfiguration config = server.getServerConfiguration(); + config.getLogging().setTraceSpecification(newTraceSpec); + server.updateServerConfiguration(config); +// writeLogMsg(Level.FINE, "Setting the HPEL Trace Spec to " + newTraceSpec); +// Workspace tmpWS = HpelSetup.getCellUnderTest().getWorkspace(); +// getUnifiedLoggingService(aServer).getAttributeByName("startupTraceSpec").setValue(newTraceSpec); +// tmpWS.saveAndSync(); + } + + } + + public static RemoteFile getBinaryLogDir(Server aServer) throws Exception { + String logDir = aServer.getBackend().getServerConfiguration().getLogging().getLogDirectory(); + return logDir == null ? aServer.getBackend().getFileFromLibertyServerRoot("logs") : + new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), logDir); +// return new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), aServer.expandString(getBinaryLogChild(aServer) +// .getAttributeByName("dataDirectory").getValueAsString())); + } + + public static RemoteFile getBinaryTraceDir(Server aServer) throws Exception { + String logDir = aServer.getBackend().getServerConfiguration().getLogging().getLogDirectory(); + return logDir == null ? aServer.getBackend().getFileFromLibertyServerRoot("logs") : + new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), logDir); +// return new RemoteFile(aServer.getNode().getMachine(), aServer.expandString(getBinaryTraceChild(aServer) +// .getAttributeByName("dataDirectory").getValueAsString())); + } + + public static RemoteFile getTextLogDir(Server aServer) throws Exception { + String logDir = aServer.getBackend().getServerConfiguration().getLogging().getLogDirectory(); + return logDir == null ? aServer.getBackend().getFileFromLibertyServerRoot("logs") : + new RemoteFile(HpelSetup.getNodeUnderTest().getMachine(), logDir); +// return new RemoteFile(aServer.getNode().getMachine(), aServer.expandString(getTextLogChild(aServer).getAttributeByName( +// "dataDirectory").getValueAsString())); + } + + /** + * A utility method to get log repository from a remote application server. The entire log repository will be copied + * to the location specified. + * + * @param aServer + * The Application Server from which to retrieve the log repository from. + * + * @param destinationDir + * A RemoteFile handle to the directory where you want the log repository copied to. + * + * @return true if the copy was successful. + */ + public static boolean getLogRepositoryFromServer(Server aServer, RemoteFile destinationDir) throws Exception { + RemoteFile remoteLogsDir = CommonTasks.getBinaryLogDir(aServer); + RemoteFile remoteLogRepository = new RemoteFile(remoteLogsDir.getMachine(), remoteLogsDir, "logdata"); + + return destinationDir.copyFromSource(remoteLogRepository, true, true); + } + + /** + * A utility method to get a compressed log repository from a remote application server. The entire log repository + * will be copied to the location specified. + * + * @param aServer + * The Application Server from which to retrieve the log repository from. + * + * @param destinationZipFile + * A RemoteFile handle to the zip file where you want the zipped log repository copied to to. Note if the + * file already exists it will be overwritten. + * + * @return true if the copy was successful. + */ + public static boolean getZippedLogRepositoryFromServer(Server aServer, RemoteFile destinationZipFile) throws Exception { + return zipAndCopyARepositoryFromServer(aServer, destinationZipFile, CommonTasks.LOGS); + } + + /** + * A utility method to get trace repository from a remote application server. The entire trace repository will be + * copied to the location specified. + * + * @param aServer + * The Application Server from which to retrieve the trace repository from. + * + * @param destinationDir + * A RemoteFile handle to the directory where you want the trace repository copied to. + * + * @return true if the copy was successful. + */ + public static boolean getTraceRepositoryFromServer(Server aServer, RemoteFile destinationDir) throws Exception { + RemoteFile remoteTraceDir = CommonTasks.getBinaryTraceDir(aServer); + RemoteFile remoteTraceRepository = new RemoteFile(remoteTraceDir.getMachine(), remoteTraceDir, "tracedata"); + + return destinationDir.copyFromSource(remoteTraceRepository, true, true); + } + + /** + * A utility method to get a compressed trace repository from a remote application server. The entire trace repository + * will be copied to the location specified. + * + * @param aServer + * The Application Server from which to retrieve the log repository from. + * + * @param destinationZipFile + * A RemoteFile handle to the zip file where you want the zipped log repository copied to to. Note if the + * file already exists it will be overwritten. + * + * @return true if the copy was successful. + */ + public static boolean getZippedTraceRepositoryFromServer(Server aServer, RemoteFile destinationZipFile) throws Exception { + return zipAndCopyARepositoryFromServer(aServer, destinationZipFile, CommonTasks.TRACE); + } + + private static boolean zipAndCopyARepositoryFromServer(Server aServer, RemoteFile destinationZipFile, String repositoryType) throws Exception { + RemoteFile remoteRepositoryDir = null; + String repositorySubDirName = "logdata"; // default is logs + if (repositoryType.equals(CommonTasks.TRACE)) { + remoteRepositoryDir = CommonTasks.getBinaryTraceDir(aServer); + repositorySubDirName = "tracedata"; + } else + remoteRepositoryDir = CommonTasks.getBinaryLogDir(aServer); + + Machine rMachine = remoteRepositoryDir.getMachine(); + RemoteFile remoteRepository = new RemoteFile(rMachine, remoteRepositoryDir, repositorySubDirName); + + String tmpZipFileName = ".tmp_" + Thread.currentThread().getId() + "_" + System.currentTimeMillis() + ".zip"; + RemoteFile rProfileLogsDir = new RemoteFile(rMachine, aServer.getNode().getProfileDir() + rMachine.getOperatingSystem().getFileSeparator() + "logs"); + RemoteFile tmpZipFile = new RemoteFile(rMachine, rProfileLogsDir, tmpZipFileName); + + // 1. Have the files zipped up on the server. + // Build the URL to this test case + String URLsuffix = "/" + HPEL_APP_CONTEXT_ROOT + "/" + RAS_ZIPPER_UTIL_JSP; + String URL = CommonActions.getUrl((ApplicationServer) aServer, URLsuffix, false); + + writeLogMsg(Level.FINE, "Calling RazZipper to compress remote files"); + writeLogMsg(Level.FINE, "URL: " + URL); + writeLogMsg(Level.FINE, "inputFile: " + remoteRepository.getAbsolutePath()); + writeLogMsg(Level.FINE, "outputZipArchive: " + tmpZipFile.getAbsolutePath()); + + WebRequest request = new PostMethodWebRequest(URL); + request.setParameter("inputFile", remoteRepository.getAbsolutePath()); + request.setParameter("outputZipArchive", tmpZipFile.getAbsolutePath()); + // request.setParameter("archiveComment", "" ); + + WebConversation wc = new WebConversation(); + WebResponse response = null; + response = wc.getResponse(request); + if (response == null) + writeLogMsg(Level.WARNING, "The response from RasZipper is null"); + if (response.getResponseCode() != 200) + writeLogMsg(Level.WARNING, "Unxpected response code from RasZipper. Recieved response code of: " + + response.getResponseCode()); + + // 2. Copy the zip file to the destination + boolean returneCode = destinationZipFile.copyFromSource(tmpZipFile, true, true); + if (!tmpZipFile.delete()) // clean up our tmp file. + writeLogMsg(Level.WARNING, "Could not delete tmp zip file " + tmpZipFile.getAbsolutePath()); + return returneCode; + } + + /** + * A utility method to get log and trace repository from a remote application server. The entire repository will be + * copied to the location specified. + * + * @param aServer + * The Application Server from which to retrieve the repository from. + * + * @param destinationDir + * A RemoteFile handle to the directory where you want the repository copied to. + * + * @return true if the copy was successful. + */ + public static boolean getRepositoryFromServer(Server aServer, RemoteFile destinationDir) throws Exception { + RemoteFile rRepLogDataDir = new RemoteFile(aServer.getNode().getMachine(), CommonTasks.getBinaryLogDir(aServer), "logdata"); + RemoteFile rRepTraceDataDir = new RemoteFile(aServer.getNode().getMachine(), CommonTasks.getBinaryTraceDir(aServer), + "tracedata"); + boolean logCopyResult = false; + boolean traceCopyResult = false; + if (rRepLogDataDir.exists()) { + // copy the logdata dir + RemoteFile destLogDataDir = new RemoteFile(destinationDir.getMachine(), destinationDir, "logdata"); + logCopyResult = destLogDataDir.copyFromSource(rRepLogDataDir, true, true); + } + if (rRepTraceDataDir.exists()) { + // copy the logdata dir + RemoteFile destTraceDataDir = new RemoteFile(destinationDir.getMachine(), destinationDir, "tracedata"); + traceCopyResult = destTraceDataDir.copyFromSource(rRepTraceDataDir, true, true); + } + + return (logCopyResult && traceCopyResult); + } + + /** + * A simple method used to log messages to the output.txt log + * + * @param logLevel + * The level you want the message written as. If null will default to INFO + * + * @param msg + * The message to log. + */ + public static void writeLogMsg(Level logLevel, String msg) { + // default to INFO if level is null + if (logLevel == null) + logLevel = Level.INFO; + // determine who called me + StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); + StackTraceElement element = stackTraceElements[3]; // get the latest entry after the calls to get stracktrace + Logger bucketLogger = Logger.getLogger(element.getClassName()); + bucketLogger.logp(logLevel, element.getClassName(), element.getMethodName(), msg); + } + + /** + * A simple method used to log messages to the output.txt log + * + * @param logLevel + * The level you want the message written as. If null will default to INFO + * + * @param msg + * The message to log. + * @param thrown + * Throwable to be logged + */ + public static void writeLogMsg(Level logLevel, String msg, Throwable thrown) { + // default to INFO if level is null + if (logLevel == null) + logLevel = Level.INFO; + // determine who called me + StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); + StackTraceElement element = stackTraceElements[3]; // get the latest entry after the calls to get stracktrace + Logger bucketLogger = Logger.getLogger(element.getClassName()); + bucketLogger.logp(logLevel, element.getClassName(), element.getMethodName(), msg, thrown); + } + + /** + * Stops and removes all Application Servers, Web Servers, and Proxy Servers in the specified cell, except for those + * specified in the excludes set + * + * @param cell + * The cell where you want to remove servers. + * @param excludedServers + * The Set of servers you want to keep. + * @throws Exception + * Thrown if any server can't be removed + */ + public static void removeUnusedServers(Cell cell, Set excludedServers) throws Exception { + if (cell == null) { + return; + } + try { + Set allServers = cell.getServers(); + for (Server server : allServers) { + ServerType type = server.getServerType(); + if (ServerType.PROXY_SERVER.equals(type) || ServerType.WEB_SERVER.equals(type) + || ServerType.APPLICATION_SERVER.equals(type)) { + if (!excludedServers.contains(server)) { + writeLogMsg(Level.INFO, "Removing the server " + server.getName()); + remove(server); + } + } + } + } catch (Exception e) { + throw new Exception("Unable to remove unused Servers in the Cell named " + cell.getName(), e); + } + } + + /** + * Removes a Server from the WebSphere configuration (and Simplicity object model) using Simplicity. If the server + * is currently running, it will be stopped before it's removed. + * + * @param server + * The Server you wish to remove. + * @throws Exception + * If Simplicity fails to remove the server. + */ + public static void remove(Server server) throws Exception { + if (server == null) { + return; // nothing to do + } + Level logAtlevel = Level.INFO; + writeLogMsg(logAtlevel, "Removing a Server..."); + ProcessStatus status = server.getServerStatus(); + String serverName = server.getName(); + + writeLogMsg(logAtlevel, " Type: " + server.getServerType().toString()); + writeLogMsg(logAtlevel, " Name: " + serverName); + Node node = server.getNode(); + if (node == null) { + writeLogMsg(logAtlevel, " Node: null"); + } else { + writeLogMsg(logAtlevel, " Node: " + node.getName()); + Cell cell = node.getCell(); + if (cell == null) { + writeLogMsg(logAtlevel, " Cell: null"); + } else { + writeLogMsg(logAtlevel, " Cell: " + cell.getName()); + } + } + writeLogMsg(logAtlevel, " Status: " + server.getName()); + + StopWatch timer = new StopWatch(); + timer.start(); + if (ProcessStatus.RUNNING.equals(status)) { + writeLogMsg(logAtlevel, "Since the server is currently running, it will be stopped and then removed."); + server.stop(); + } + server.getNode().deleteServer(serverName); + timer.stop(); + + writeLogMsg(logAtlevel, "The Server was removed after: " + timer.getTimeElapsedAsString()); + + } + + /** + * Starts a server and explicitly sets the timeout value for the mBean start operation. On slower systems, + * especially z/OS where the server startup takes longer use of this start method may be needed. Using this method + * uses a higher timeout value when starting the application server. + * + * @param serverToStart + * The Server you wish to start. + * @throws Exception + * If Simplicity fails to start the server. + */ + public static void startServer(Server serverToStart) throws Exception { + serverToStart.start(SERVER_START_MBEAN_TIMEOUT); + } + + /** + * To add new properties to bootstrap file + * + * @param appServer + * @param propertyName + * @param propertyValue + * @throws Exception + */ + public static void addBootstrapProperty(Server appServer, String propertyName, String propertyValue) throws Exception { + + LibertyServer server = appServer.getBackend(); + RemoteFile bootstrapFile = server.getServerBootstrapPropertiesFile(); + Properties bootstrapProps = new Properties(); + bootstrapProps.setProperty(propertyName, propertyValue); + bootstrapProps.store(bootstrapFile.openForWriting(true), null); + + } + + /** + * Returns a ConfigObject representing the JVMEntries for an Application Server. The JVMEntries is a child object of + * processDefinition. It's useful for getting at the systemProperties / customProperties configured for an + * application server. + * + * @param appServ + * The Server you want the JVMEntries ConfigObject for. + * @param procType + * Optional. Specifies which zOSProcessType type for this server you want to get the JVMEntries for. If + * the value is null, then Servant is used as a default. This parameter is ignored on non z/OS platforms. + * + * @throws Exception + */ +// public static ConfigObject getJVMEntries(Server appServ, zOSProcessType procType) throws Exception { +// if (procType == null) +// procType = zOSProcessType.Servant; +// +// ConfigObject jvmProcessDefCfgObj = null; +// if (appServ.getNode().getMachine().getOperatingSystem().equals(OperatingSystem.ZOS)) { +// // We are on z/OS. Need to get the process def for the procType. +// CommonTasks.writeLogMsg(Level.INFO, "z/OS detected. Getting the Process Definition ConfigObject for " + procType.toString()); +// List jvmProcessDefCfgObjList = ConfigObject.getConfigObjectList(appServ, appServ.getConfigId(), +// "JavaProcessDef"); +// for (ConfigObject cfgObj : jvmProcessDefCfgObjList) { +// if (cfgObj.getAttributeByName("processType").getValueAsString().equals(procType.toString())) { +// // We have the zOSProcessType process def. +// CommonTasks.writeLogMsg(Level.INFO, "Found the " + procType + " Process Definition."); +// jvmProcessDefCfgObj = cfgObj; +// break; // no need to complete the for loop +// } else { +// CommonTasks.writeLogMsg(Level.INFO, "Found the Process Definition for " +// + cfgObj.getAttributeByName("processType").getValueAsString()); +// } +// } +// } else { +// // distributed systems have only one JavaProcessDef configObject +// CommonTasks.writeLogMsg(Level.INFO, "Getting the Process Definition ConfigObject"); +// jvmProcessDefCfgObj = ConfigObject.getConfigObject(appServ, appServ.getConfigId(), "JavaProcessDef"); +// } +// if (jvmProcessDefCfgObj == null) +// CommonTasks.writeLogMsg(Level.WARNING, "Warning Process Definition ConfigObject is null."); +// ConfigObject jvmEntriesCfgObj = ConfigObject.getConfigObject(appServ, jvmProcessDefCfgObj.getConfigIdentifier(), +// "JavaVirtualMachine"); +// return jvmEntriesCfgObj; +// } + + /** + * Sets JVM system property / custom JVM property. + * + * @param theServer + * The application server on which to set the JVM system property. + * @param zProcType + * The zOSProcessType to use if on z/OS platform. Determine which process type updated on z/OS. + * @param propertyName + * The property name. + * @param propertyValue + * The value to set the property to. If the value passed in is null, and a property already exists in the + * config, the property will be removed from the config. + * @param requiredProp + * A boolean representing if the property is required or not. + * @return boolean Boolean value of true if changes to the configuration were required, false if no changes were + * needed. + * */ +// public static boolean setCustomJVMPropertyInConfig(ApplicationServer theServer, CommonTasks.zOSProcessType zProcType, +// String propertyName, String propertyValue, boolean requiredProp) throws Exception { +// CommonTasks.writeLogMsg(Level.INFO, "Setting custom property " + propertyName + " with a value of " + propertyValue); +// Workspace tmpWS = theServer.getNode().getCell().getWorkspace(); +// ConfigObject jvmEntriesCfgObj = CommonTasks.getJVMEntries(theServer, zProcType); +// if (null == jvmEntriesCfgObj) +// throw new Exception("Could not obtain Process JVMEntries"); +// +// // Check if and entry for propertyName already exists +// ConfigObject aProperty = null; +// List jvmCustomProps = jvmEntriesCfgObj.getChildObjects(); +// if (null == jvmCustomProps) +// throw new Exception("Could not obtain JVM Properties"); +// +// for (ConfigObject i : jvmCustomProps) { +// // check if we have an existing matching property. +// if ((i.getName().equals("systemProperties")) +// && i.getAttributeByName("name").getValueAsString().equalsIgnoreCase(propertyName)) { +// CommonTasks.writeLogMsg(Level.INFO, "Found system Propery " + propertyName + " in config with a value of " +// + i.getAttributeByName("value").getValueAsString()); +// aProperty = i; +// break; +// } +// } +// +// if (aProperty != null) { +// // The property already exists in the configuration. +// if (null == propertyValue) { // remove the property since the value passed in was null. +// CommonTasks.writeLogMsg(Level.FINE, "Removing the systemPropery " + propertyName + " since set value is null."); +// jvmCustomProps.remove(aProperty); +// } else { +// if ((propertyValue.equals(aProperty.getAttributeByName("value").getValueAsString())) +// && (requiredProp == aProperty.getAttributeByName("required").getValueAsBoolean())) { +// // The property is already set to what we want. Do nothing. +// CommonTasks.writeLogMsg(Level.INFO, "The property " + propertyName + " already set to " + propertyValue +// + ". No changes were made."); +// return false; // return that no changes were needed. +// } else { +// // The property is not set to what we want. Change the value. +// aProperty.getAttributeByName("value").setValue(propertyValue); +// aProperty.getAttributeByName("required").setValue(requiredProp); +// CommonTasks.writeLogMsg(Level.INFO, "Updated JVM custom property " + propertyName + " with a value of " +// + propertyValue); +// } +// } +// } else { +// if (null != propertyValue) { // don't create if propertyValue was null +// // The property does not already exist. +// CommonTasks.writeLogMsg(Level.FINE, "The property " + propertyName + " does not exists."); +// +// // we need to create the property and set it's value. +// CommonTasks.writeLogMsg(Level.INFO, "Creating the new JVM custom / System property " + propertyName); +// ConfigObject newJvmProperty = ConfigObject.createConfigObject(theServer, "Property", jvmEntriesCfgObj); +// CommonTasks.writeLogMsg(Level.FINE, "Setting attributes / name and value for new JVM custom property"); +// newJvmProperty.getAttributeByName("name").setValue(propertyName); +// newJvmProperty.getAttributeByName("value").setValue(propertyValue); +// newJvmProperty.getAttributeByName("required").setValue("false"); +// } +// } +// +// // if we have not already returned false, then we changed something and need to save & sync before we return +// // true that we have changed the configuration. +// CommonTasks.writeLogMsg(Level.FINE, "Calling saveAndSync() on the workspace to persist changes."); +// tmpWS.saveAndSync(); +// return true; +// } + + /** + * Gets the value as a String of a JVM system property / custom JVM property. If the property does not exist a value + * of null is returned. + * + * @param theServer + * The application server on which to set the JVM system property. + * @param zProcType + * The zOSProcessType to use if on z/OS platform. Determine which process type updated on z/OS. + * @param propertyName + * The property name. + * @return propertyValue The value to set the property to. Returns null if property is not found. + * */ +// public String getCustomJVMPropertyInConfig(ApplicationServer theServer, CommonTasks.zOSProcessType zProcType, String propertyName) +// throws Exception { +// CommonTasks.writeLogMsg(Level.INFO, "Getting custom property " + propertyName); +// ConfigObject jvmEntriesCfgObj = CommonTasks.getJVMEntries(theServer, zProcType); +// if (null == jvmEntriesCfgObj) +// throw new Exception("Could not obtain Process JVMEntries"); +// +// // Check if and entry for propertyName already exists +// List jvmCustomProps = jvmEntriesCfgObj.getChildObjects(); +// if (null == jvmCustomProps) +// throw new Exception("Could not obtain JVM Properties"); // there may not be any child props but there should +// // be child objects still. +// +// for (ConfigObject i : jvmCustomProps) { +// // check if we have an existing property. +// if ((i.getName().equals("systemProperties")) +// && i.getAttributeByName("name").getValueAsString().equalsIgnoreCase(propertyName)) { +// CommonTasks.writeLogMsg(Level.INFO, "Found system Propery " + propertyName + " in config with a value of " +// + i.getAttributeByName("value").getValueAsString()); +// return i.getAttributeByName("value").getValueAsString(); +// } +// } +// return null; +// } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/lib/fat.harness.jar b/dev/com.ibm.ws.logging.hpel_fat/lib/fat.harness.jar new file mode 100755 index 00000000000..7656962e757 Binary files /dev/null and b/dev/com.ibm.ws.logging.hpel_fat/lib/fat.harness.jar differ diff --git a/dev/com.ibm.ws.logging.hpel_fat/lib/htmlunit-2.4.jar b/dev/com.ibm.ws.logging.hpel_fat/lib/htmlunit-2.4.jar new file mode 100755 index 00000000000..8a5bb3cff12 Binary files /dev/null and b/dev/com.ibm.ws.logging.hpel_fat/lib/htmlunit-2.4.jar differ diff --git a/dev/com.ibm.ws.logging.hpel_fat/lib/phased.junit.jar b/dev/com.ibm.ws.logging.hpel_fat/lib/phased.junit.jar new file mode 100755 index 00000000000..16828055661 Binary files /dev/null and b/dev/com.ibm.ws.logging.hpel_fat/lib/phased.junit.jar differ diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_1.xml new file mode 100755 index 00000000000..96ca53fe151 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_1.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_2.xml new file mode 100755 index 00000000000..3001d33bb9b --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELDeleteLogDirectory_2.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeInvalid.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeInvalid.xml new file mode 100755 index 00000000000..fa0ff63a17f --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeInvalid.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_1.xml new file mode 100755 index 00000000000..7afb6ad18dc --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_1.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_2.xml new file mode 100755 index 00000000000..a5aee2c82e5 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_2.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_3.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_3.xml new file mode 100755 index 00000000000..9e2e53c5ed9 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_3.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_4.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_4.xml new file mode 100755 index 00000000000..427e7cad047 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_4.xml @@ -0,0 +1,13 @@ + + + jsp-2.2 + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_5.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_5.xml new file mode 100755 index 00000000000..10d2f6784e6 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_5.xml @@ -0,0 +1,14 @@ + + + jsp-2.2 + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_6.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_6.xml new file mode 100755 index 00000000000..2656bcc6e17 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_6.xml @@ -0,0 +1,12 @@ + + + jsp-2.2 + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_7.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_7.xml new file mode 100755 index 00000000000..767564cbe87 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMaxSizeTest_7.xml @@ -0,0 +1,11 @@ + + + jsp-2.2 + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_1.xml new file mode 100755 index 00000000000..f6c503a3be0 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_1.xml @@ -0,0 +1,14 @@ + + + jsp-2.2 + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_2.xml new file mode 100755 index 00000000000..e1b2e9b159d --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HPELPurgeMinTimeTest_2.xml @@ -0,0 +1,13 @@ + + + jsp-2.2 + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDeleteEmptyDirectories.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDeleteEmptyDirectories.xml new file mode 100755 index 00000000000..8c79c52b470 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDeleteEmptyDirectories.xml @@ -0,0 +1,14 @@ + + + jsp-2.2 + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_1.xml new file mode 100755 index 00000000000..45c04395a5e --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_1.xml @@ -0,0 +1,13 @@ + + + jsp-2.2 + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_2.xml new file mode 100755 index 00000000000..f700afe75ae --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelDirChangePurgeMaxTest_2.xml @@ -0,0 +1,13 @@ + + + jsp-2.2 + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_1.xml new file mode 100755 index 00000000000..98fce4b1e73 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_1.xml @@ -0,0 +1,11 @@ + + + jsp-2.2 + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_2.xml new file mode 100755 index 00000000000..f86da35d129 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogDirectoryChange_2.xml @@ -0,0 +1,11 @@ + + + jsp-2.2 + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_1.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_1.xml new file mode 100755 index 00000000000..180e0f092d4 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_1.xml @@ -0,0 +1,14 @@ + + + jsp-2.2 + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_2.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_2.xml new file mode 100755 index 00000000000..2925c7ac031 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelLogElementDelete_2.xml @@ -0,0 +1,11 @@ + + + jsp-2.2 + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelTextLogRetention.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelTextLogRetention.xml new file mode 100755 index 00000000000..a39050a34c5 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-HpelTextLogRetention.xml @@ -0,0 +1,13 @@ + + + jsp-2.2 + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-TraceSpecificationSetToAllTest.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-TraceSpecificationSetToAllTest.xml new file mode 100755 index 00000000000..b1eb87a21a7 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/files/server-TraceSpecificationSetToAllTest.xml @@ -0,0 +1,9 @@ + + + + jsp-2.2 + servlet-3.0 + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/.gitignore b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/.gitignore new file mode 100644 index 00000000000..f3f483d82c0 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/.gitignore @@ -0,0 +1 @@ +/dropins diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/bootstrap.properties b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/bootstrap.properties new file mode 100755 index 00000000000..98a6db1b769 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/bootstrap.properties @@ -0,0 +1,3 @@ +bootstrap.include=../testports.properties +websphere.log.provider=binaryLogging-1.0 +com.ibm.ws.logging.console.log.level=INFO diff --git a/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/server.xml b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/server.xml new file mode 100755 index 00000000000..179455eb2d8 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/publish/servers/HpelServer/server.xml @@ -0,0 +1,9 @@ + + + jsp-2.2 + + + + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/LogCreator.jsp b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/LogCreator.jsp new file mode 100755 index 00000000000..fca0089a940 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/LogCreator.jsp @@ -0,0 +1,136 @@ + + +HPEL Function Test JSP + + +<%@page + import="java.util.*, java.io.*, com.ibm.ejs.ras.*, java.security.*" +%> +

+
Date: <%= new java.util.Date() %> +

+ +<% +String actionToPerform = request.getParameter( "ActionParam" ); +//make the default action Logs +if (actionToPerform == null) actionToPerform = "Logs"; + +if (actionToPerform.equals("Help")) { + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println("
Parmeters:  
IterationsDefault: 50Will log the message iterations times"); + out.println("
LoggerNameDefault: com.ibm.ws.fat.hpel.tests.Default_HPELTestLoggerWill create a logger with the specificed name"); + out.println("
LevelDefault: ALLWill log messages Only to the specificed level [SEVERE, WARNING, INFO, FINE, FINER, FINEST]"); + out.println("
MessageDefault: Default HPEL MessageWill log the message passed to the JSP
SleepDefault: -1No sleep delay between logging
"); +} else { + String parmStr = request.getParameter("Iterations") ; + int numIterations = (parmStr == null) ? 49 : Integer.parseInt(parmStr) ; + + parmStr = request.getParameter("Message"); + String logMessage = (parmStr == null) ? "Default HPEL Message" : parmStr; + + parmStr = request.getParameter("LoggerName"); + String loggerName = (parmStr == null) ? "com.ibm.ws.fat.hpel.tests.Default_HPELTestLogger" : parmStr; + + parmStr = request.getParameter("Level"); + String level = (parmStr == null) ? "ALL" : parmStr; + + parmStr = request.getParameter("Sleep"); + int secondsToSleep = (parmStr == null) ? -1 : Integer.parseInt(parmStr); + + java.util.logging.Level passedLevel = null; + if (!level.equals("ALL")) { + if (level.toLowerCase().equals("severe")) passedLevel = java.util.logging.Level.SEVERE; + else if (level.toLowerCase().equals("warning")) passedLevel = java.util.logging.Level.WARNING; + else if (level.toLowerCase().equals("info")) passedLevel = java.util.logging.Level.INFO; + else if (level.toLowerCase().equals("fine")) passedLevel = java.util.logging.Level.FINE; + else if (level.toLowerCase().equals("finer")) passedLevel = java.util.logging.Level.FINER; + else if (level.toLowerCase().equals("finest")) passedLevel = java.util.logging.Level.FINEST; + } + + out.println("

Start time of JSP load: " + new java.util.Date() + "

"); + + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println("
Name Value
******Parms specific to this run******
Iterations " + numIterations + "
LoggerName " + loggerName + "
Level " + level + "
Message " + logMessage + "
Action " + actionToPerform + "
Sleep " + secondsToSleep + " milliseconds
") ; + + java.util.logging.Logger logger = java.util.logging.Logger.getLogger(loggerName); + + out.println("Action to perform: " + actionToPerform); + if (actionToPerform.equals("Logs")) { + out.println("Action performed: Logs"); + if (level.equals("ALL")) { + out.println("Level: ALL"); + for (int j = 0; j < numIterations; j++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(java.util.logging.Level.SEVERE, loggerName, "Method.Severe", logMessage); + logger.logp(java.util.logging.Level.WARNING, loggerName, "Method.Warning", logMessage); + logger.logp(java.util.logging.Level.INFO, loggerName, "Method.Info", logMessage); + } + } else { + out.println("Level: " + passedLevel); + for (int i = 0; i < numIterations; i++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(passedLevel, loggerName, passedLevel.getName(), logMessage); + } + } + } else if (actionToPerform.equals("Trace")) { + out.println("Action performed: Trace"); + if (level.equals("ALL")) { + out.println("Level: ALL"); + for (int j = 0; j < numIterations; j++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(java.util.logging.Level.FINE, loggerName, "Method.Fine", logMessage); + logger.logp(java.util.logging.Level.FINER, loggerName, "Method.Finer", logMessage); + logger.logp(java.util.logging.Level.FINEST, loggerName, "Method.Finest", logMessage); + } + } else { + out.println("Level: " + passedLevel); + for (int i = 0; i < numIterations; i++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(passedLevel, loggerName, passedLevel.getName(), logMessage); + } + } + } else if (actionToPerform.equals("LogsAndTrace")) { + out.println("Action performed: LogsAndTrace"); + if (level.equals("ALL")) { + out.println("Level: ALL"); + for (int j = 0; j < numIterations; j++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(java.util.logging.Level.FINE, loggerName, "Method.Fine", logMessage); + logger.logp(java.util.logging.Level.FINER, loggerName, "Method.Finer", logMessage); + logger.logp(java.util.logging.Level.FINEST, loggerName, "Method.Finest", logMessage); + logger.logp(java.util.logging.Level.SEVERE, loggerName, "Method.Severe", logMessage); + logger.logp(java.util.logging.Level.WARNING, loggerName, "Method.Warning", logMessage); + logger.logp(java.util.logging.Level.INFO, loggerName, "Method.Info", logMessage); + } + } else { + out.println("Level: " + passedLevel); + for (int i = 0; i < numIterations; i++) { + //only do this once for each iteration + if (secondsToSleep > 0) Thread.sleep(secondsToSleep); + logger.logp(passedLevel, loggerName, passedLevel.getName(), logMessage) ; + } + } + } else { + out.println("Action performed: NOTHING"); + } + out.println("

End time of JSP load: " + new java.util.Date() + "

"); +} +%> + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/META-INF/permissions.xml b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..2ec4e2c6204 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/META-INF/permissions.xml @@ -0,0 +1,14 @@ + + + + + java.util.logging.LoggingPermission + control + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/WEB-INF/web.xml b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..4427dd030b0 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/resources/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + + HpelFatWAR + This is a servlet designed to test autoInstall. + + + + WritingCustomLogServlet + WritingCustomLogServlet + Write to custom log ... that's it!. + com.ibm.ws.logging.hpel_fat.WritingCustomLogServlet + + + + + + WritingCustomLogServlet + /* + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel/handlers/MyCustomHandler.java b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel/handlers/MyCustomHandler.java new file mode 100755 index 00000000000..3cf7d6d6ac8 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel/handlers/MyCustomHandler.java @@ -0,0 +1,11 @@ +package com.ibm.ws.logging.hpel.handlers; + +import java.io.IOException; +import java.util.logging.FileHandler; + +public class MyCustomHandler extends FileHandler { + public MyCustomHandler(String pattern, int limit, int count, boolean append) + throws SecurityException, IOException { + super(pattern, limit, count, append); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel_fat/WritingCustomLogServlet.java b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel_fat/WritingCustomLogServlet.java new file mode 100755 index 00000000000..e857d3e1060 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/HpelFat/src/com/ibm/ws/logging/hpel_fat/WritingCustomLogServlet.java @@ -0,0 +1,80 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.hpel_fat; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.logging.SimpleFormatter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.ibm.ws.logging.hpel.handlers.MyCustomHandler; + +/** + * This is a servlet to write logs to a custom file + */ +public class WritingCustomLogServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + private final Logger logger = Logger.getLogger(getClass().getPackage() + .getName()); + + @Override + public void init() throws ServletException { + logger.setLevel(Level.ALL); + try { + MyCustomHandler handler = new MyCustomHandler("customlog.log", 50000, 10, true); + handler.setLevel(Level.ALL); + handler.setFormatter(new SimpleFormatter()); + logger.addHandler(handler); + } catch (Exception e) { + logger.severe("FileHanler initilization failed:" + + e.toString()); + e.printStackTrace(); + } + } + + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + logger.finest("Entering in to the doGet() method."); + logger.info("doGet method of WritingCustomLogServlet called and now calling the doService"); + doService(request, response); + logger.finest("Exiting from the doGet() method."); + } + + @Override + protected void doPost(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + logger.finest("Entering in to the doPost() method."); + logger.info("doPost method of WritingCustomLogServlet is called and now calling the doService"); + doService(request, response); + logger.finest("Exiting from the doPost() method."); + } + + protected void doService(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + logger.finest("Entering in to the doService() method."); + logger.fine("This is Fine message in doGet()"); + logger.finer("This is Finer message in doGet()"); + logger.config("This is config message in doGet()"); + + PrintWriter pw = response.getWriter(); + pw.println("Servlet successfullly completed"); + + this.logger.finest("Exiting from doService() method."); + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/META-INF/permissions.xml b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..2ec4e2c6204 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/META-INF/permissions.xml @@ -0,0 +1,14 @@ + + + + + java.util.logging.LoggingPermission + control + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/WEB-INF/web.xml b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..11f8c9b6f4c --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/resources/WEB-INF/web.xml @@ -0,0 +1,30 @@ + + + + + LRC + LRC servlet + + + LogDecoratorFilter + com.ibm.ws.test.LogDecoratorFilter + + IncludeParameter + userName productId + + + + LogDecoratorFilter + /* + + + + LogServlet + com.ibm.ws.logging.hpel.LRCServlet + + + LogServlet + /* + + + diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/logging/hpel/LRCServlet.java b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/logging/hpel/LRCServlet.java new file mode 100755 index 00000000000..0824021a132 --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/logging/hpel/LRCServlet.java @@ -0,0 +1,39 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.hpel; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + */ +public class LRCServlet extends HttpServlet { + + /** */ + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException + { + PrintWriter out = res.getWriter(); + res.setContentType("text/html"); + out.println("LRC Servlet"); + out.println("LRC Servlet"); + System.out.println("LRC Servlet doGet Method stars"); + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/LogDecoratorFilter.java b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/LogDecoratorFilter.java new file mode 100755 index 00000000000..e503d427a0d --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/LogDecoratorFilter.java @@ -0,0 +1,145 @@ +/* + * This program may be used, executed, copied, modified and distributed + * without royalty for the purpose of developing, using, marketing, or distributing. + */ + +package com.ibm.ws.test; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import com.ibm.websphere.logging.hpel.LogRecordContext; + +/** + * This servlet filter adds configured request query parameters to the + * LogRecordContext + * + * Sample content to add to web.xml deployment descriptor to configure this + * servlet filter to add the userName and productId request query parameters to + * the LogRecordContext: + * + * + * LogDecoratorFilter + * com.test.LogDecoratorFilter + * + * IncludeParameter + * userName productId + * + * + * + * LogDecoratorFilter + * /* + * + * + */ +public class LogDecoratorFilter implements Filter { + + private static Logger logger = Logger.getLogger("com.ibm.ws.test.LogDecoratorFilter"); + + private ThreadLocalStringExtension[] extensions; + private String[] extensionNames; + + /** + * Default constructor. + */ + public LogDecoratorFilter() {} + + /** + * @see Filter#destroy() + */ + @Override + public void destroy() { + logger.info("LogDecoratorFilter - destroy"); + for (String extensionName : extensionNames) { + LogRecordContext.unregisterExtension(extensionName); + } + } + + /** + * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) + */ + @Override + public void doFilter(ServletRequest servletRequest, + ServletResponse servletResponse, + FilterChain filterChain) + throws IOException, ServletException { + logger.info("LogDecoratorFilter - doFilter"); + + // set values we want to log + for (int i = 0; i < extensionNames.length; i++) { + String value = servletRequest.getParameter(extensionNames[i]); + extensions[i].setValue(value); + logger.info(extensionNames[i] + " set to: " + value); + } + + // pass the request along the filter chain + filterChain.doFilter(servletRequest, servletResponse); + + // unset the values so they don't leak to other threads + for (int i = 0; i < extensionNames.length; i++) { + extensions[i].setValue(null); + logger.info(extensionNames[i] + " set to: " + null); + } + } + + /** + * @see Filter#init(FilterConfig) + */ + @Override + public void init(FilterConfig filterConfig) throws ServletException { + logger.info("LogDecoratorFilter - init"); + + // get names from deployment descriptor + List names = getIncludeParameters(filterConfig); + + // set up an extension for each name + extensionNames = new String[names.size()]; + extensions = new ThreadLocalStringExtension[names.size()]; + Map extns = new HashMap(); + for (int i = 0; i < names.size(); i++) { + extensionNames[i] = names.get(i); + extensions[i] = new ThreadLocalStringExtension(); + LogRecordContext.registerExtension(extensionNames[i], extensions[i]); + LogRecordContext.getExtensions(extns); + logger.info("LogRecordContextExtensions ::" + extns); + } + logger.info("LogDecoratorFilter - init -Ends"); + } + + private List getIncludeParameters(FilterConfig filterConfig) { + + List names = new ArrayList(); + + { + Enumeration initParameterNames = filterConfig.getInitParameterNames(); + while (initParameterNames.hasMoreElements()) { + String name = initParameterNames.nextElement(); + if (!name.equals("IncludeParameter")) { + logger.info("unrecognized [" + name + "]. Only IncludeParameter accepted"); + } + else { + String combinedValue = filterConfig.getInitParameter(name); + String[] splitValue = combinedValue.split(" "); + for (String value : splitValue) { + logger.info("init parm: " + value); + names.add(value); + } + } + } + } + + return names; + } +} diff --git a/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/ThreadLocalStringExtension.java b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/ThreadLocalStringExtension.java new file mode 100755 index 00000000000..8ba4a6f308d --- /dev/null +++ b/dev/com.ibm.ws.logging.hpel_fat/test-applications/LogFat/src/com/ibm/ws/test/ThreadLocalStringExtension.java @@ -0,0 +1,30 @@ +/* + * This program may be used, executed, copied, modified and distributed + * without royalty for the purpose of developing, using, marketing, or distributing. + */ + +package com.ibm.ws.test; + +import java.util.logging.Logger; + +import com.ibm.websphere.logging.hpel.LogRecordContext; + +public class ThreadLocalStringExtension implements LogRecordContext.Extension { + private static Logger logger = Logger.getLogger("com.ibm.ws.test.ThreadLocalStringExtension"); + + public ThreadLocalStringExtension() {} + + private final ThreadLocal threadLocalString = new ThreadLocal(); + + public void setValue(String string) { + threadLocalString.set(string); + logger.info("setValue - new value: [" + string + "] for thread " + Thread.currentThread().getName()); +// System.out.println("setValue - new value: [" + string + "] for thread " + Thread.currentThread().getName()); + } + + @Override + public String getValue() { + return threadLocalString.get(); + // don't log here or you will get a recursion + } +} diff --git a/dev/com.ibm.ws.logging_fat/.classpath b/dev/com.ibm.ws.logging_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/.classpath.gradle b/dev/com.ibm.ws.logging_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/.gitignore b/dev/com.ibm.ws.logging_fat/.gitignore new file mode 100644 index 00000000000..647380e0e0c --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.gitignore @@ -0,0 +1 @@ +dropins diff --git a/dev/com.ibm.ws.logging_fat/.project b/dev/com.ibm.ws.logging_fat/.project new file mode 100755 index 00000000000..52807d17e17 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.logging_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..f48ecd6cc60 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..74d9c72c1f3 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,113 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.logging_fat/bnd.bnd b/dev/com.ibm.ws.logging_fat/bnd.bnd new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.logging_fat/bnd.bnd.gradle b/dev/com.ibm.ws.logging_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.logging_fat/build-test.xml b/dev/com.ibm.ws.logging_fat/build-test.xml new file mode 100755 index 00000000000..365255bee8b --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/build-test.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/build.gradle b/dev/com.ibm.ws.logging_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.logging_fat/delivery.sets b/dev/com.ibm.ws.logging_fat/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/AbstractStackTraceFilteringTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/AbstractStackTraceFilteringTest.java new file mode 100755 index 00000000000..b35a9f49f36 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/AbstractStackTraceFilteringTest.java @@ -0,0 +1,105 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.net.URL; +import java.util.Arrays; +import java.util.List; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.utils.HttpUtils; + +/** + * + */ +public class AbstractStackTraceFilteringTest { + + protected static final String INTERNAL_CLASSES_REGEXP = "at \\[internal classes\\]"; + protected static final String CONSOLE_LOG = "logs/console.log"; + + protected static final int CONN_TIMEOUT = 10; + + protected static LibertyServer server; + + protected static void hitWebPage(String contextRoot, String servletName, boolean failureAllowed) throws MalformedURLException, IOException, ProtocolException { + try { + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/" + contextRoot + "/" + servletName); + int expectedResponseCode = failureAllowed ? HttpURLConnection.HTTP_INTERNAL_ERROR : HttpURLConnection.HTTP_OK; + HttpURLConnection con = HttpUtils.getHttpConnection(url, expectedResponseCode, CONN_TIMEOUT); + BufferedReader br = HttpUtils.getConnectionStream(con); + String line = br.readLine(); + // Make sure the server gave us something back + assertNotNull(line); + con.disconnect(); + } catch (IOException e) { + // A message about a 500 code may be fine + if (!failureAllowed) { + throw e; + } + + } + + } + + protected void assertConsoleLogDoesNotContain(String message, String stringToCheckFor) throws Exception { + List lines = server.findStringsInFileInLibertyServerRoot(stringToCheckFor, CONSOLE_LOG); + assertTrue(message + " (found \'" + Arrays.toString(lines.toArray()) + "\'", + lines.isEmpty()); + + } + + protected void assertConsoleLogContains(String message, String stringToCheckFor) throws Exception { + assertFalse(message + " (could not find \'" + stringToCheckFor + "\')", + server.findStringsInFileInLibertyServerRoot(stringToCheckFor, CONSOLE_LOG).isEmpty()); + + } + + protected void assertConsoleLogCountEquals(String message, String stringToCheckFor, int count) throws Exception { + assertEquals(message, count, + server.findStringsInFileInLibertyServerRoot(stringToCheckFor, CONSOLE_LOG).size()); + + } + + protected void assertMessagesLogDoesNotContain(String message, String stringToCheckFor) throws Exception { + assertTrue(message, + server.findStringsInLogs(stringToCheckFor).isEmpty()); + + } + + protected void assertMessagesLogContains(String message, String stringToCheckFor) throws Exception { + assertFalse(message, + server.findStringsInLogs(stringToCheckFor).isEmpty()); + + } + + protected void assertTraceLogDoesNotContain(String message, String stringToCheckFor) throws Exception { + assertTrue(message, + server.findStringsInTrace(stringToCheckFor).isEmpty()); + + } + + protected void assertTraceLogContains(String message, String stringToCheckFor) throws Exception { + assertFalse(message, + server.findStringsInTrace(stringToCheckFor).isEmpty()); + + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/FATSuite.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/FATSuite.java new file mode 100755 index 00000000000..6995423fed5 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/FATSuite.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * + */ +@RunWith(Suite.class) +@SuiteClasses({ StackTraceFilteringForLoggedExceptionParametersTest.class, StackTraceFilteringForLoggedExceptionWithACauseParametersTest.class, + StackTraceFilteringForPrintedExceptionTest.class, StackTraceFilteringForPrintedExceptionWithIBMCodeAtTopTest.class, + StackTraceFilteringForNoClassDefFoundErrorTest.class, StackTraceFilteringForBadlyWrittenThrowableTest.class, + StackTraceFilteringForUserFeatureExceptionTest.class, StackTraceFilteringForIBMFeatureExceptionTest.class, + StackTraceFilteringForSpecificationClassesExceptionTest.class, InvalidTraceSpecificationTest.class, + HealthCenterTest.class, TestHideMessages.class, TestHideMsgDefinedBootstrap.class, IsoDateFormatTest.class }) +public class FATSuite { + +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/HealthCenterTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/HealthCenterTest.java new file mode 100755 index 00000000000..250dc8c240b --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/HealthCenterTest.java @@ -0,0 +1,48 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +public class HealthCenterTest { + private static final boolean J9 = System.getProperty("java.vm.name", "unknown").contains("J9"); + private static LibertyServer server; + + @BeforeClass + public static void beforeClass() { + Assume.assumeTrue(J9); + server = LibertyServerFactory.getStartedLibertyServer("com.ibm.ws.logging.healthcenter"); + } + + @Test + public void testHealthCenterInfo() throws Exception { + Assert.assertFalse("Expected healthcenter INFO message", + server.findStringsInLogs("^INFO:.*com\\.ibm\\.java\\.diagnostics\\.healthcenter\\.agent\\.iiop\\.port", + server.getConsoleLogFile()).isEmpty()); + } + + @Test + public void testConsoleLogLevelOff() throws Exception { + HttpUtils.findStringInReadyUrl(server, "/logger-servlet", "Hello world!"); + List messages = server.findStringsInLogs("Hello world!", server.getConsoleLogFile()); + Assert.assertTrue("Did not expect to find servlet Logger message: " + messages, messages.isEmpty()); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/InvalidTraceSpecificationTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/InvalidTraceSpecificationTest.java new file mode 100755 index 00000000000..044a2f4f707 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/InvalidTraceSpecificationTest.java @@ -0,0 +1,164 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.config.Logging; +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class InvalidTraceSpecificationTest { + + protected static final String MESSAGE_LOG = "logs/messages.log"; + protected static final String INVALIDTRACEMSG = ""; + protected String invalidTraceSpec1 = "com.ibm.someInvalid.*=all"; + protected String invalidTraceSpec2 = "com.ibm.someMoreInvalid.*=all"; + private final String validTraceSpec1 = "com.ibm.ws.*=all"; + protected static LibertyServer server; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.tracespec"); + System.out.println("Starting server)"); + server.startServer(); + System.out.println("Stared server)"); + } + + //Check if we have one Warning message with "com.ibm.someInvalid.*=all" + protected void checkOnlyOneInvalidTraceSpecEntryExists() throws Exception { + List lines = server.findStringsInFileInLibertyServerRoot("TRAS0040I", MESSAGE_LOG); + assertEquals("Message TRAS0040I not appeared or appeared more than once ", 1, lines.size()); + assertMessagesLogContains(lines.get(0), invalidTraceSpec1); + } + + protected void checkNoInvalidTraceSpecEntryExists() throws Exception { + List lines = server.findStringsInFileInLibertyServerRoot("TRAS0040I", MESSAGE_LOG); + assertEquals("Message TRAS0040I not appeared or appeared more than once ", 0, lines.size()); + } + + @Test + public void testInvalidTraceSpec() throws Exception { + Logging loggingObj; + ServerConfiguration serverConfig = server.getServerConfiguration(); + loggingObj = serverConfig.getLogging(); + loggingObj.setTraceSpecification(invalidTraceSpec1); + server.setMarkToEndOfLog(); + server.updateServerConfiguration(serverConfig); + server.waitForConfigUpdateInLogUsingMark(null); + + //Test 1: Check if TRAS0040I Message appears for invalid trace spec + checkOnlyOneInvalidTraceSpecEntryExists(); + } + + /* + * This test sets valid trace string now. + */ + @Test + public void testValidTraceSpec() throws Exception { + Logging loggingObj; + ServerConfiguration serverConfig = server.getServerConfiguration(); + loggingObj = serverConfig.getLogging(); + loggingObj.setTraceSpecification(validTraceSpec1); + server.setMarkToEndOfLog(); + server.updateServerConfiguration(serverConfig); + server.waitForConfigUpdateInLogUsingMark(null); + checkNoInvalidTraceSpecEntryExists(); + + } + + /* + * Test 3. + * - Stop Server + * - Update Config with invalid trace spec + * - start server + * - TRAS0040I shouldn't appear during startup. + */ + @Test + public void testInvalidTraceSpecOffline() throws Exception { + Logging loggingObj; + server.stopServer(); + //Offline test + ServerConfiguration serverConfig = server.getServerConfiguration(); + loggingObj = serverConfig.getLogging(); + loggingObj.setTraceSpecification(invalidTraceSpec1); + server.updateServerConfiguration(serverConfig); + //Offline test. + + server.startServer(); + checkNoInvalidTraceSpecEntryExists(); + + String existingTraceString = loggingObj.getTraceSpecification(); + loggingObj.setTraceSpecification(existingTraceString + ":" + validTraceSpec1); + server.setMarkToEndOfLog(); + server.updateServerConfiguration(serverConfig); + server.waitForConfigUpdateInLogUsingMark(null); + checkOnlyOneInvalidTraceSpecEntryExists(); + + } + + /* + * Test 4 + * - Update trace specification with invalidTraceSpec1 and invalidTraceSpec2 + * - Make sure the message TRAS0040I appears for both the invalid strings + */ + @Test + public void testMultipleInvalidTraceSpec() throws Exception { + Logging loggingObj; + + ServerConfiguration serverConfig = server.getServerConfiguration(); + loggingObj = serverConfig.getLogging(); + loggingObj.setTraceSpecification(invalidTraceSpec1 + ":" + invalidTraceSpec2); + server.setMarkToEndOfLog(); + server.updateServerConfiguration(serverConfig); + server.waitForConfigUpdateInLogUsingMark(null); + + List lines = server.findStringsInFileInLibertyServerRoot("TRAS0040I", MESSAGE_LOG); + assertEquals("Expecting multiple invalid trace spec message, but not found ", 1, lines.size()); + assertMessagesLogContains(lines.get(0), invalidTraceSpec1); + assertMessagesLogContains(lines.get(0), invalidTraceSpec2); + } + + protected void assertMessagesLogContains(String message, String stringToCheckFor) throws Exception { + assertFalse(message, + server.findStringsInLogs(stringToCheckFor).isEmpty()); + + } + + @Before + public void setup() throws Exception { + if (server != null && !server.isStarted()) { + server.startServer(); + } + } + + @After + public void tearDown() throws Exception { + if (server != null && server.isStarted()) { + server.stopServer(); + } + } + +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/IsoDateFormatTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/IsoDateFormatTest.java new file mode 100644 index 00000000000..9a3a4aa564b --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/IsoDateFormatTest.java @@ -0,0 +1,311 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* WLP Copyright IBM Corp. 2017 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.config.Logging; +import com.ibm.websphere.simplicity.config.ServerConfiguration; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; +import componenttest.topology.utils.HttpUtils; + +/** + * + */ +public class IsoDateFormatTest { + private static final String MESSAGE_LOG = "logs/messages.log"; + private static final String TRACE_LOG = "logs/trace.log"; + private static final String TRACE_SPEC = "com.ibm.ws.logging.*=all"; + private static final String SERVER_NAME = "com.ibm.ws.logging.isodateformat"; + private static final String INVALID_ISO_DATE_FORMAT_SERVER = "server-invalidIsoDateFormat.xml"; + private static final String ISO_8601_REGEX_PATTERN = "(\\d{4})\\-(\\d{2})\\-(\\d{2})T(\\d{2})\\:(\\d{2})\\:(\\d{2})\\.(\\d{3})[+-](\\d{4})"; //ISO 8601 Format : yyyy-MM-dd'T'HH:mm:ss.SSSZ + private static final int CONN_TIMEOUT = 10; + + private static LibertyServer server; + + @BeforeClass + public static void initialSetup() throws Exception { + server = LibertyServerFactory.getLibertyServer(SERVER_NAME); + System.out.println("Starting server..."); + server.startServer(); + System.out.println("Started server."); + + // Preserve the original server configuration + server.saveServerConfiguration(); + } + + @Before + public void setUp() throws Exception { + if (server != null && !server.isStarted()) { + // Restore the original server configuration, before starting the server for each test case. + server.restoreServerConfiguration(); + server.startServer(); + } + } + + @After + public void cleanUp() throws Exception { + if (server != null && server.isStarted()) { + server.stopServer(); + } + } + + /* + * This test sets the "isoDateFormat" attribute to true and verifies the ISO-8601 date format in the messages.log file. + */ + @Test + public void testIsoDateFormatInMessagesLog() throws Exception { + // Set isoDateFormat=true and traceSpec=off in server.xml + setServerConfiguration(true, false); + + List lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, MESSAGE_LOG); + assertTrue("The date and time was not formatted in ISO-8601 format in messages.log.", lines.size() > 0); + } + + /* + * This test sets the "isoDateFormat" attribute to true and verifies the ISO-8601 date format in the trace.log file. + */ + @Test + public void testIsoDateFormatInTraceLog() throws Exception { + // Set isoDateFormat=true and traceSpec=on in server.xml + setServerConfiguration(true, true); + + List lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, TRACE_LOG); + assertTrue("The date and time was not formatted in ISO-8601 format in trace.log.", lines.size() > 0); + } + + /* + * This test sets the "isoDateFormat" attribute to true and verifies the ISO-8601 date format in the FFDC log and summary files. + */ + @Test + public void testIsoDateFormatInFFDC() throws Exception { + // Set isoDateFormat = true and traceSpec=off in server.xml + setServerConfiguration(true, false); + + // Run application to generate FFDC + hitWebPage("ffdc-servlet", "FFDCServlet", true, "?generateFFDC=true"); + + // Get latest FFDC file + ArrayList ffdcFiles = server.listFFDCFiles(SERVER_NAME); + RemoteFile ffdcFile = server.getFFDCLogFile(ffdcFiles.get(ffdcFiles.size() - 1)); //Gets the latest FFDC file. + + List lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, "logs/ffdc/" + ffdcFile.getName()); + assertTrue("The date and time was not formatted in ISO-8601 format in FFDC file.", lines.size() > 0); + + // Get latest FFDC Summary file + ArrayList ffdcSummaryFiles = server.listFFDCSummaryFiles(SERVER_NAME); + RemoteFile ffdcSummaryFile = server.getFFDCSummaryFile(ffdcSummaryFiles.get(ffdcSummaryFiles.size() - 1)); //Gets the latest FFDC Summary file. + + lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, "logs/ffdc/" + ffdcSummaryFile.getName()); + assertTrue("The date and time was not formatted in ISO-8601 format in FFDC Summary file.", lines.size() > 0); + } + + /* + * This test sets the "isoDateFormat" attribute to an invalid value and verifies if the appropriate warning message is displayed + * and checks that the previously configured date format is applied. + */ + @Test + public void testInvalidIsoDateFormatAttributeValue() throws Exception { + // Set the invalid true value for attribute. e.g. "isoDateFormat=ture" + server.setServerConfigurationFile(INVALID_ISO_DATE_FORMAT_SERVER); + server.waitForConfigUpdateInLogUsingMark(null); + + List lines = server.findStringsInFileInLibertyServerRoot("CWWKG0081E", MESSAGE_LOG); + assertEquals("Error CWWKG0081E did not appear in messages.log", 1, lines.size()); + + lines = server.findStringsInFileInLibertyServerRoot("CWWKG0083W", MESSAGE_LOG); + assertEquals("Error CWWKG0083W did not appear in messages.log", 1, lines.size()); + + // Verify that the ISO-8601 date format is not set, and the previously configured Locale date format is being used. + lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, MESSAGE_LOG); + assertFalse("The date and time is being formatted in ISO-8601 format, instead of the default Locale format.", lines.size() > 0); + } + + /* + * This test sets the "isoDateFormat" attribute to true in the bootstrap.properties and verifies the ISO-8601 date format in the FFDC log and summary files. + */ + @Test + public void testIsoDateFormatSetInBootstrapProperties() throws Exception { + // Stop server, if running... + if (server != null && server.isStarted()) { + server.stopServer(); + } + + // Get the bootstrap.properties file and store the original content + RemoteFile bootstrapFile = server.getServerBootstrapPropertiesFile(); + + FileInputStream in = getFileInputStreamForRemoteFile(bootstrapFile); + Properties initialBootstrapProps = loadProperties(in); + + try { + // Update bootstrap.properties file with isoDateFormat = true + Properties newBootstrapProps = new Properties(); + newBootstrapProps.put("com.ibm.ws.logging.isoDateFormat", "true"); + + FileOutputStream out = getFileOutputStreamForRemoteFile(bootstrapFile, true); + writeProperties(newBootstrapProps, out); + + // Start server... + server.startServer(); + + // Check in messages.log file to see if the date and time is formatted in ISO-8601 format + List lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, MESSAGE_LOG); + assertTrue("The date and time was not formatted in ISO-8601 format in messages.log.", lines.size() > 0); + } finally { + // Restore the initial contents of bootstrap.properties + FileOutputStream out = getFileOutputStreamForRemoteFile(bootstrapFile, false); + writeProperties(initialBootstrapProps, out); + } + } + + /* + * This test dynamically changes the isoDateFormat attribute to true and false, and verifies if the date and time are formatted accordingly each time. + */ + @Test + public void testDynamicallyUpdatingIsoDateFormatAttribute() throws Exception { + // Verify if the date and time are in Locale format + List lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, MESSAGE_LOG); + assertFalse("The date and time is being formatted in ISO-8601 format, instead of the default Locale format.", lines.size() > 0); + + // Set the isoDateFormat=true and traceSpec=off in server.xml + setServerConfiguration(true, false); + + // Verify if the server was successfully updated + lines = server.findStringsInFileInLibertyServerRoot("CWWKG0017I", MESSAGE_LOG); + assertEquals("Message CWWKG0017I not appeared or appeared more than once ", 1, lines.size()); + + // Verify the date and time are in ISO-8601 format + lines = server.findStringsInFileInLibertyServerRoot(ISO_8601_REGEX_PATTERN, MESSAGE_LOG); + assertTrue("The date and time was not formatted in ISO-8601 format in messages.log.", lines.size() > 0); + + // Set the isoDateFormat=false and traceSpec=off in server.xml + setServerConfiguration(false, false); + + // Verify if the server was successfully updated again. + lines = server.findStringsInFileInLibertyServerRoot("CWWKG0017I", MESSAGE_LOG); + assertEquals("Message CWWKG0017I not appeared or appeared more than twice ", 2, lines.size()); + + // Verify if the date and time are in Locale format, by getting the latest server update success message (CWWKG0017I) + // and verifying if the string does not contain the ISO-8601 date format + String latestServerUpdateSuccessMsg = lines.get(1); + assertFalse("The date and time is being formatted in ISO-8601 format, instead of the default Locale format.", latestServerUpdateSuccessMsg.matches(ISO_8601_REGEX_PATTERN)); + } + + private FileInputStream getFileInputStreamForRemoteFile(RemoteFile bootstrapPropFile) throws Exception { + FileInputStream input = null; + try { + input = (FileInputStream) bootstrapPropFile.openForReading(); + } catch (Exception e) { + throw new Exception("Error while getting the FileInputStream for the remote bootstrap properties file."); + } + return input; + } + + private Properties loadProperties(FileInputStream input) throws IOException { + Properties props = new Properties(); + try { + props.load(input); + } catch (IOException e) { + + throw new IOException("Error while loading properties from the remote bootstrap properties file."); + } finally { + try { + input.close(); + } catch (IOException e1) { + throw new IOException("Error while closing the input stream."); + } + } + return props; + } + + private FileOutputStream getFileOutputStreamForRemoteFile(RemoteFile bootstrapPropFile, boolean append) throws Exception { + // Open the remote file for writing with append as false + FileOutputStream output = null; + try { + output = (FileOutputStream) bootstrapPropFile.openForWriting(append); + } catch (Exception e) { + throw new Exception("Error while getting FileOutputStream for the remote bootstrap properties file."); + } + return output; + } + + private void writeProperties(Properties props, FileOutputStream output) throws Exception { + // Write the properties to remote bootstrap properties file + try { + props.store(output, null); + } catch (IOException e) { + throw new Exception("Error while writing to the remote bootstrap properties file."); + } finally { + try { + output.close(); + } catch (IOException e) { + throw new IOException("Error while closing the output stream."); + } + } + } + + private static void setServerConfiguration(boolean useIsoDateFormat, boolean useTraceSpec) throws Exception { + Logging loggingObj; + ServerConfiguration serverConfig = server.getServerConfiguration(); + loggingObj = serverConfig.getLogging(); + if (useTraceSpec) { + loggingObj.setTraceSpecification(TRACE_SPEC); + } + loggingObj.setIsoDateFormat(useIsoDateFormat); + server.setMarkToEndOfLog(); + server.updateServerConfiguration(serverConfig); + server.waitForConfigUpdateInLogUsingMark(null); + } + + private static void hitWebPage(String contextRoot, String servletName, boolean failureAllowed, String params) throws MalformedURLException, IOException, ProtocolException { + try { + String urlStr = "http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/" + contextRoot + "/" + servletName; + urlStr = params != null ? urlStr + params : urlStr; + URL url = new URL(urlStr); + int expectedResponseCode = failureAllowed ? HttpURLConnection.HTTP_INTERNAL_ERROR : HttpURLConnection.HTTP_OK; + HttpURLConnection con = HttpUtils.getHttpConnection(url, expectedResponseCode, CONN_TIMEOUT); + BufferedReader br = HttpUtils.getConnectionStream(con); + String line = br.readLine(); + // Make sure the server gave us something back + assertNotNull(line); + con.disconnect(); + } catch (IOException e) { + // A message about a 500 code may be fine + if (!failureAllowed) { + throw e; + } + } + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForBadlyWrittenThrowableTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForBadlyWrittenThrowableTest.java new file mode 100755 index 00000000000..47df688b1be --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForBadlyWrittenThrowableTest.java @@ -0,0 +1,67 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForBadlyWrittenThrowableTest extends AbstractStackTraceFilteringTest { + + private static final String EXPECTED_EXCEPTION = "BadlyWrittenException"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("broken-servlet"); + + // Hit the servlet, to drive the error + hitWebPage("broken-servlet", "BrokenWithABadlyWrittenThrowableServlet", true); + + } + + @Test + public void testConsoleDoesNotNPEForPrintedException() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertMessagesLogDoesNotContain("The console log had an NPE in it.", "NullPointerException"); + + } + + @Test + public void testMessagesIsNotTrimmedForPrintedException() throws Exception { + assertMessagesLogContains("The messages log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertMessagesLogDoesNotContain("The messages log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception + assertMessagesLogContains("The console stack didn't show the originating class.", + "at com.ibm.ws.logging.fat.servlet.BrokenWithABadlyWrittenThrowableServlet.doGet"); + // We also want at least one line about javax.servlet + assertMessagesLogContains("The console stack was trimmed too aggressively.", + "at javax.servlet.http.HttpServlet.service"); + assertMessagesLogContains("The console stack was apparently trimmed, but internal WAS classes got left in it", + "at com.ibm.ws.webcontainer"); + + } + + @Test + public void testTraceIsNotTrimmedForPrintedException() throws Exception { + assertTraceLogContains("The trace log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertTraceLogDoesNotContain("The trace log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForIBMFeatureExceptionTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForIBMFeatureExceptionTest.java new file mode 100755 index 00000000000..85785f1a76f --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForIBMFeatureExceptionTest.java @@ -0,0 +1,78 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForIBMFeatureExceptionTest extends AbstractStackTraceFilteringTest { + + private static final String MAIN_EXCEPTION = "ConfigurationReceivedException"; + private static final String BUNDLE_NAME = "test.configuration.fallalloverthefloor.ibmfeature_1.0.0"; + private static final String FEATURE_NAME = "unconfigurableIbmFeature-1.0"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.badconfig.ibm"); + + // install our user feature + server.installUserBundle(BUNDLE_NAME); // NO HYPHENS! NO ".jar" SUFFIX! + server.installUserFeature(FEATURE_NAME); // NO UNDERSCORES! NO ".mf" SUFFIX! + + // Just starting the server should be enough to get exceptions + server.startServer(); + // ... but to be safe, wait until we know the config has been driven + String successMessage = server.waitForStringInLog("The user feature is about to throw an exception."); + assertNotNull("The user feature should have produced a message saying it was active and about to fall all over the floor.", successMessage); + } + + @AfterClass + public static void tearDown() throws Exception { + server.stopServer(); + + server.uninstallUserBundle(BUNDLE_NAME); + server.uninstallFeature(FEATURE_NAME); + } + + @Test + public void testConsoleIsTrimmedForNastyInternalErrorFromIBMFeature() throws Exception { + assertConsoleLogContains("The console log should at the very least have our exception in it.", MAIN_EXCEPTION); + assertConsoleLogCountEquals("The console stack should only have one [internal classes] in it.", + INTERNAL_CLASSES_REGEXP, 1); + // The other methods from the user feature should still be in the stack trace + assertConsoleLogContains("The console log should have frames from the mock-IBM classes in it.", "reallyThrowAnException"); + assertConsoleLogDoesNotContain("The console log should not have more than one frames from the mock-IBM classes in it.", "thinkAboutThrowingAnException"); + + // We should have no SCR stuff, since SCR is calling a 'Liberty' feature + assertConsoleLogDoesNotContain("The SCR classes should not be in the console log", + "at org.apache.felix.scr.impl"); + // Similarly, the Java frames are just calls to Liberty code from SCR code so should be stripped + assertConsoleLogDoesNotContain("The console stack should not have any JVM frames in it.", + "at java."); + + } + + @Test + public void testMessagesIsNotTrimmedForNastyInternalErrorFromIBMFeature() throws Exception { + assertMessagesLogContains("The messages log should have our exception in it.", + MAIN_EXCEPTION); + assertMessagesLogContains("The console stack should have the scr packages we think our stack trace has in it", + "at org.apache.felix.scr.impl"); + assertMessagesLogDoesNotContain("The messages log should not have a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionParametersTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionParametersTest.java new file mode 100755 index 00000000000..a93042f3826 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionParametersTest.java @@ -0,0 +1,72 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForLoggedExceptionParametersTest extends AbstractStackTraceFilteringTest { + + private static final String SPECIAL_BROKEN_EXCEPTION = "SpecialBrokenException"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("broken-servlet"); + + // Hit the servlet, to drive the error + hitWebPage("broken-servlet", "BrokenServlet", true); + + } + + @Test + public void testConsoleIsTrimmedForLoggedParameter() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + SPECIAL_BROKEN_EXCEPTION); + assertConsoleLogContains("The console stack was not trimmed.", + INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception + assertConsoleLogContains("The console stack was trimmed too aggressively and stripped out our servlet.", + "at com.ibm.ws.logging.fat.servlet.BrokenServlet.doGet"); + // We also want at least one line about javax.servlet + assertConsoleLogContains("The console stack was was trimmed too aggressively and stripped out the API we're using", + "at javax.servlet.http.HttpServlet.service"); + + // We don't want to be seeing anything that looks like internal WAS classes in the console + assertConsoleLogDoesNotContain("The console stack was apparently trimmed, but internal WAS classes got left in it", + "at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest"); + } + + @Test + public void testMessagesIsNotTrimmedForLoggedParameter() throws Exception { + assertMessagesLogContains("The messages log did not have our exception in it at all.", + SPECIAL_BROKEN_EXCEPTION); + assertMessagesLogDoesNotContain("The messages log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + // We don't want to be seeing anything that looks like internal WAS classes in the console + assertMessagesLogContains("The messages stack was apparently untrimmed, but it didn't have the internal WAS class stacks we expected in it", + "at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest"); + } + + @Test + public void testTraceIsNotTrimmedForLoggedParameter() throws Exception { + assertTraceLogContains("The trace log did not have our exception in it at all.", + SPECIAL_BROKEN_EXCEPTION); + assertTraceLogDoesNotContain("The trace log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionWithACauseParametersTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionWithACauseParametersTest.java new file mode 100755 index 00000000000..ca2e339fef1 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForLoggedExceptionWithACauseParametersTest.java @@ -0,0 +1,67 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForLoggedExceptionWithACauseParametersTest extends AbstractStackTraceFilteringTest { + + private static final String EXCEPTION_WITH_A_CAUSE = "BrokenWithACauseException"; + private static final String CAUSE_EXCEPTION = "ReasonItAllWentWrongException"; + private static final String CAUSED_BY = "Caused by:"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("broken-servlet"); + + // Hit the servlet, to drive the error + hitWebPage("broken-servlet", "BrokenWithACauseServlet", true); + + } + + @Test + public void testConsoleIsTrimmedForLoggedParameter() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + EXCEPTION_WITH_A_CAUSE); + assertConsoleLogContains("The console stack was not trimmed.", + INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception + assertConsoleLogContains("The console stack was trimmed too aggressively and stripped out our servlet.", + "at com.ibm.ws.logging.fat.servlet.BrokenWithACauseServlet.doGet"); + + assertConsoleLogContains("The console log should say 'Caused by'", CAUSED_BY); + assertConsoleLogContains("The console log include the root cause", CAUSE_EXCEPTION); + + } + + @Test + public void testMessagesIsNotTrimmedForLoggedParameter() throws Exception { + assertMessagesLogContains("The messages log did not have our exception in it at all.", + EXCEPTION_WITH_A_CAUSE); + assertMessagesLogDoesNotContain("The messages log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + // We don't want to be seeing anything that looks like internal WAS classes in the console + assertMessagesLogContains("The messages stack was apparently untrimmed, but it didn't have the internal WAS class stacks we expected in it", + "at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest"); + assertConsoleLogContains("The console log should say 'Caused by'", CAUSED_BY); + assertConsoleLogContains("The console log include the root cause", CAUSE_EXCEPTION); + } + +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForNoClassDefFoundErrorTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForNoClassDefFoundErrorTest.java new file mode 100755 index 00000000000..5d81ff416e4 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForNoClassDefFoundErrorTest.java @@ -0,0 +1,85 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForNoClassDefFoundErrorTest extends AbstractStackTraceFilteringTest { + + private static final String MAIN_EXCEPTION = "NoClassDefFoundError"; + private static final String NESTED_EXCEPTION = "ClassNotFoundException"; + private static final String CAUSED_BY = "Caused by:"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.missingfeatureserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("missing-feature-servlet"); + + hitWebPage("missing-feature-servlet", "MissingEntityManagerServlet", true); + } + + @Test + public void testConsoleIsTrimmedForNoClassDefFoundError() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + MAIN_EXCEPTION); + assertConsoleLogContains("The console stack was not trimmed.", + INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception, but don't make too many assumptions about what class that was + assertConsoleLogContains("The console stack didn't show the originating class.", + "at com.ibm.ws.logging"); + // We only want one line of WAS context + assertConsoleLogCountEquals("The console stack was apparently trimmed, but internal WAS classes got left in it", + "at com.ibm.ws.webcontainer", 1); + + } + + @Test + public void testRedundantCauseIsStrippedOutForNoClassDefFoundError() throws Exception { + assertConsoleLogContains("The console log should always have our exception in it.", + MAIN_EXCEPTION); + assertConsoleLogContains("The console log should have a line saying trimming happened.", INTERNAL_CLASSES_REGEXP); + assertConsoleLogDoesNotContain("The console log should not have anything about \"Caused by\"", + CAUSED_BY); + assertConsoleLogDoesNotContain("The console log should not have our nested exception in it.", + NESTED_EXCEPTION); + } + + @Test + public void testMessagesIsNotTrimmedForNoClassDefFoundError() throws Exception { + assertMessagesLogContains("The messages log should have our exception in it.", + MAIN_EXCEPTION); + assertMessagesLogDoesNotContain("The messages log should not have a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + assertMessagesLogContains("The messages log should have a 'Caused by' line in it.", + CAUSED_BY); + assertMessagesLogContains("The message log should have our nested exception in it.", + NESTED_EXCEPTION); + } + + @Test + public void testTraceIsNotTrimmedForNoClassDefFoundError() throws Exception { + assertTraceLogContains("The trace log should not have our exception in it.", + MAIN_EXCEPTION); + assertTraceLogDoesNotContain("The trace log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + assertTraceLogContains("The trace log should have a 'Caused by' line in it.", + CAUSED_BY); + assertTraceLogContains("The trace log should not have our nested exception in it.", + NESTED_EXCEPTION); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionTest.java new file mode 100755 index 00000000000..59631ac3bc8 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionTest.java @@ -0,0 +1,77 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForPrintedExceptionTest extends AbstractStackTraceFilteringTest { + + private static final String SPECIAL_PRINTED_EXCEPTION = "SpecialPrintingException"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("broken-servlet"); + + // Hit the servlet, to drive the error + hitWebPage("broken-servlet", "ExceptionPrintingServlet", false); + + } + + @Test + public void testConsoleIsTrimmedForPrintedException() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + SPECIAL_PRINTED_EXCEPTION); + assertConsoleLogContains("The console stack was not trimmed.", + INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception + assertConsoleLogContains("The console stack didn't show the originating class.", + "at com.ibm.ws.logging.fat.servlet.ExceptionPrintingServlet.doGet"); + assertConsoleLogContains("The console stack didn't show the inner originating class.", + "ExceptionGeneratingObject.hashCode"); + // We also want at least one line about javax.servlet + assertConsoleLogContains("The console stack was trimmed too aggressively.", + "at javax.servlet.http.HttpServlet.service"); + // We only want one line of internal WAS classes in the console + int traceCount = server.findStringsInFileInLibertyServerRoot(SPECIAL_PRINTED_EXCEPTION, CONSOLE_LOG).size(); + assertConsoleLogCountEquals("The console stack was apparently trimmed, but internal WAS classes got left in it", + "at com.ibm.ws.webcontainer", traceCount); + + // The java.* classes used by the user code should not be trimmed + assertConsoleLogContains("The console stack was trimmed too aggressively of java classes.", + "at java.util.HashMap.put"); + assertConsoleLogContains("The console stack was trimmed too aggressively of java classes.", + "at java.util.HashSet.add"); + + } + + @Test + public void testMessagesIsNotTrimmedForPrintedException() throws Exception { + assertMessagesLogContains("The messages log did not have our exception in it at all.", + SPECIAL_PRINTED_EXCEPTION); + assertMessagesLogDoesNotContain("The messages log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } + + @Test + public void testTraceIsNotTrimmedForPrintedException() throws Exception { + assertTraceLogContains("The trace log did not have our exception in it at all.", + SPECIAL_PRINTED_EXCEPTION); + assertTraceLogDoesNotContain("The trace log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionWithIBMCodeAtTopTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionWithIBMCodeAtTopTest.java new file mode 100755 index 00000000000..5a9b218ffdd --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForPrintedExceptionWithIBMCodeAtTopTest.java @@ -0,0 +1,69 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForPrintedExceptionWithIBMCodeAtTopTest extends AbstractStackTraceFilteringTest { + + private static final String EXPECTED_EXCEPTION = "javax.naming.NamingException"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + + //Make sure the application has come up before proceeding + server.addInstalledAppForValidation("broken-servlet"); + + // Hit the servlet, to drive the error + hitWebPage("broken-servlet", "IBMCodeAtTopExceptionPrintingServlet", false); + + } + + @Test + public void testConsoleIsTrimmedForPrintedExceptionThrownByIBMCode() throws Exception { + assertConsoleLogContains("The console log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertConsoleLogContains("The console stack was not trimmed.", + INTERNAL_CLASSES_REGEXP); + // We better have a line for the class that threw the exception + assertConsoleLogContains("The console stack didn't show the originating class.", + "at com.ibm.ws.logging.fat.servlet.IBMCodeAtTopExceptionPrintingServlet.doGet"); + // We also want at least one line about javax.servlet + assertConsoleLogContains("The console stack was trimmed too aggressively.", + "at javax.servlet.http.HttpServlet.service"); + // We only want one line of internal WAS classes in the console + int traceCount = server.findStringsInFileInLibertyServerRoot(EXPECTED_EXCEPTION, CONSOLE_LOG).size(); + assertConsoleLogCountEquals("The console stack was apparently trimmed, but internal WAS classes got left in it", + "at com.ibm.ws.webcontainer", traceCount); + + } + + @Test + public void testMessagesIsNotTrimmedForPrintedExceptionThrownByIBMCode() throws Exception { + assertMessagesLogContains("The messages log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertMessagesLogDoesNotContain("The messages log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } + + @Test + public void testTraceIsNotTrimmedForPrintedExceptionThrownByIBMCode() throws Exception { + assertTraceLogContains("The trace log did not have our exception in it at all.", + EXPECTED_EXCEPTION); + assertTraceLogDoesNotContain("The trace log had a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForSpecificationClassesExceptionTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForSpecificationClassesExceptionTest.java new file mode 100755 index 00000000000..b96efd952a0 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForSpecificationClassesExceptionTest.java @@ -0,0 +1,73 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012, 2017 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +/** + * A test which makes sure internal classes exported as spec-type API don't get filtered + * from the top of stack traces, but do get filtered from the middle. + * We want to see exceptions like + * + * java.lang.NullPointerException + * at javax.servlet.http.Cookie.isToken(Cookie.java:384) + * at javax.servlet.http.Cookie.(Cookie.java:124) + * at com.ibm.ws.logging.fat.servlet.SpecUsingServlet.doGet(SpecUsingServlet.java:40) + * at javax.servlet.http.HttpServlet.service(HttpServlet.java:575) + * at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) + * at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1240) + * at [internal classes] + */ +public class StackTraceFilteringForSpecificationClassesExceptionTest extends AbstractStackTraceFilteringTest { + + private static final String MAIN_EXCEPTION = "NullPointerException"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.brokenserver"); + + server.startServer(); + server.addInstalledAppForValidation("broken-servlet"); + hitWebPage("broken-servlet", "SpecUsingServlet", true); + } + + @Test + public void testConsoleIsTrimmedForUserUseOfSpecificationClass() throws Exception { + assertConsoleLogContains("The console log should at the very least have our exception in it.", MAIN_EXCEPTION); + // How many stack traces we get depends a bit on server internals, so to try and be more robust, + // count how many [ERROR] lines we get and match this + // We don't want to count errors that don't have stack traces, so try and exclude these by also checking + // for message id 'SRVE.*E'. This still isn't totally robust since it won't catch printed Errors + // if the message doesn't include the id 'SRVE.*E' or misspells it, as our current messages do + int errorCount = server.findStringsInFileInLibertyServerRoot("ERROR.*SRVE.*E", CONSOLE_LOG).size(); + int causedByCount = server.findStringsInFileInLibertyServerRoot("Caused by", CONSOLE_LOG).size(); + // Sanity check - we got an [ERROR], right? + assertConsoleLogContains("The console log should have [ERROR] prefix in it", "ERROR"); + + assertConsoleLogCountEquals("The console stack should only have one [internal classes] in it per stack trace.", + INTERNAL_CLASSES_REGEXP, errorCount); + // The javax.servlet methods shouldn't be stripped out, because they're spec used by the app + final int servletFrames = 9; + assertConsoleLogCountEquals("The console log should have several frames from the specification javax.servlet classes", "javax.servlet", servletFrames); + + assertConsoleLogContains("The console log should have the user class in it", "SpecUsingServlet"); + + // We want one line of internal WAS classes in the console + assertConsoleLogCountEquals("There should be exactly one IBM frame per stack trace", + "at com.ibm.ws.webcontainer", errorCount + causedByCount); + + } + +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForUserFeatureExceptionTest.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForUserFeatureExceptionTest.java new file mode 100755 index 00000000000..02f2336723f --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/StackTraceFilteringForUserFeatureExceptionTest.java @@ -0,0 +1,80 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class StackTraceFilteringForUserFeatureExceptionTest extends AbstractStackTraceFilteringTest { + + private static final String MAIN_EXCEPTION = "ConfigurationReceivedException"; + private static final String BUNDLE_NAME = "test.configuration.fallalloverthefloor.userfeature_1.0.0"; + private static final String FEATURE_NAME = "unconfigurableUserFeature-1.0"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory + .getLibertyServer("com.ibm.ws.logging.badconfig.user"); + + // install our user feature + server.installUserBundle(BUNDLE_NAME); // NO HYPHENS! NO ".jar" SUFFIX! + server.installUserFeature(FEATURE_NAME); // NO UNDERSCORES! NO ".mf" SUFFIX! + + // Just starting the server should be enough to get exceptions + server.startServer(); + // ... but to be safe, wait until we know the config has been driven + String successMessage = server.waitForStringInLog("The user feature is about to throw an exception."); + assertNotNull("The user feature should have produced a message saying it was active and about to fall all over the floor.", successMessage); + } + + @AfterClass + public static void tearDown() throws Exception { + server.stopServer(); + + server.uninstallUserBundle(BUNDLE_NAME); + server.uninstallFeature(FEATURE_NAME); + } + + @Test + public void testConsoleIsTrimmedForNastyInternalErrorFromUserFeature() throws Exception { + assertConsoleLogContains("The console log should at the very least have our exception in it.", MAIN_EXCEPTION); + assertConsoleLogCountEquals("The console stack should only have one [internal classes] in it.", + INTERNAL_CLASSES_REGEXP, 1); + // The other methods from the user feature should still be in the stack trace + assertConsoleLogContains("The console log should have frames from the user classes in it.", "thinkAboutThrowingAnException"); + assertConsoleLogContains("The console log should have more than one frames from the user classes in it.", "reallyThrowAnException"); + + // We should have one line of scr stuff, since it's the last internal line before the java + // class packages are called, which count as third-party, and in the IBM->third party->user + // case, the third-party stuff survives + assertConsoleLogCountEquals("The console stack was apparently trimmed, but the SCR classes got left in it", + "at org.apache.felix.scr.impl", 1); + // We want a Java line, but only one + assertConsoleLogCountEquals("The console stack should have one Java lines in it.", + "at java.", 1); + + } + + @Test + public void testMessagesIsNotTrimmedForNastyInternalErrorFromUserFeature() throws Exception { + assertMessagesLogContains("The messages log should have our exception in it.", + MAIN_EXCEPTION); + assertMessagesLogContains("The console stack should have the scr packages we think our stack trace has in it", + "at org.apache.felix.scr.impl"); + assertMessagesLogDoesNotContain("The messages log should not have a trimmed stack trace in it.", INTERNAL_CLASSES_REGEXP); + } +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMessages.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMessages.java new file mode 100755 index 00000000000..2d21b73134e --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMessages.java @@ -0,0 +1,90 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class TestHideMessages { + + private static LibertyServer msgServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.hidemessage"); + private static final Class logClass = TestHideMessages.class; + static String TWO_HIDDEDN_MESSAGE_SERVER = "server-twomessageids.xml"; + + static long SMALL_TIMEOUT = 10000; + @Rule + public TestName name = new TestName(); + + @BeforeClass + public static void prepareTest() throws Exception { + msgServer.startServer(); + } + + @Test + // No need to wait for message CWWKZ0058I/TRAS3001I since that happens during server startup. So using findStringsInLogs + public void testHiddenMsgIds() throws Exception { + + assertTrue("Hidden Message CWWKZ0058I should not be seen in messages.log", + msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("messages.log")).isEmpty()); + assertTrue("Hidden Message CWWKZ0058I should not be seen in console.log", msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("console.log")).isEmpty()); + assertFalse("Hidden Message CWWKZ0058I should be seen in trace", msgServer.findStringsInTrace("CWWKZ0058I:").isEmpty()); + assertFalse("Info message about redirection to trace file should be logged", + msgServer.findStringsInLogs("TRAS3001I:", msgServer.getMatchingLogFile("messages.log")).isEmpty()); + + } + + @Test + public void testDynamicAddMessageIds() throws Exception { + Log.info(logClass, name.getMethodName(), "Entering test " + name.getMethodName()); + // Need to capture CWWKF0012I messages that are in the logs from initial startup + int initial_messages_size_CWWKF0012I = msgServer.findStringsInLogs("CWWKF0012I:", msgServer.getMatchingLogFile("messages.log")).size(); + int initial_console_size_CWWKF0012I = msgServer.findStringsInLogs("CWWKF0012I:", msgServer.getMatchingLogFile("console.log")).size(); + int initial_trace_size_CWWKF0012I = msgServer.findStringsInTrace("CWWKF0012I:").size(); + + msgServer.setServerConfigurationFile(TWO_HIDDEDN_MESSAGE_SERVER); + + assertTrue("Hidden Message CWWKZ0058I should not be seen in messages.log", + msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("messages.log")).isEmpty()); + assertTrue("Hidden Message CWWKZ0058I should not be seen in console.log", msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("console.log")).isEmpty()); + assertFalse("Hidden Message CWWKZ0058I should be seen in trace", msgServer.findStringsInTrace("CWWKZ0058I:").isEmpty()); + + //This will wait for feature update completion message since we are adding a new feature. And CWWKF0012I should be seen before that + msgServer.waitForConfigUpdateInLogUsingMark(null); + assertTrue("Hidden Message CWWKF0012I should not be seen in messages.log", + msgServer.findStringsInLogs("CWWKF0012I:", msgServer.getMatchingLogFile("messages.log")).size() == initial_messages_size_CWWKF0012I); + assertTrue("Hidden Message CWWKF0012I should not be seen in console.log", + msgServer.findStringsInLogs("CWWKF0012I:", msgServer.getMatchingLogFile("console.log")).size() == initial_console_size_CWWKF0012I); + assertTrue("Hidden Message CWWKF0012I should be seen in trace", + msgServer.findStringsInTrace("CWWKF0012I:").size() == (initial_trace_size_CWWKF0012I + 1)); + + Log.info(logClass, name.getMethodName(), "Exiting test " + name.getMethodName()); + } + + @AfterClass + public static void completeTest() throws Exception { + msgServer.stopServer(); + } + +} diff --git a/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMsgDefinedBootstrap.java b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMsgDefinedBootstrap.java new file mode 100755 index 00000000000..bf7bc50c114 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/fat/src/com/ibm/ws/logging/fat/TestHideMsgDefinedBootstrap.java @@ -0,0 +1,62 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class TestHideMsgDefinedBootstrap { + + private static LibertyServer msgServer = LibertyServerFactory.getLibertyServer("com.ibm.ws.logging.hidemsg.bootstrap"); + private static final Class logClass = TestHideMsgDefinedBootstrap.class; + + @Rule + public TestName name = new TestName(); + + @BeforeClass + public static void prepareTest() throws Exception { + msgServer.startServer(); + } + + @Test + public void testHiddenMsgIds() throws Exception { + assertTrue("Hidden Message CWWKZ0058I should not be seen in messages.log", + msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("messages.log")).isEmpty()); + assertTrue("Hidden Message CWWKZ0058I should not be seen in console.log", msgServer.findStringsInLogs("CWWKZ0058I:", msgServer.getMatchingLogFile("console.log")).isEmpty()); + assertFalse("Hidden Message CWWKZ0058I should be seen in trace", msgServer.findStringsInTrace("CWWKZ0058I:").isEmpty()); + } + + @Test + public void testSuppressedIdsInMsgHeader() throws Exception { + assertFalse("Suppressed Message Ids logged in header ", + msgServer.findStringsInLogs("Suppressed message ids:", msgServer.getMatchingLogFile("messages.log")).isEmpty()); + + } + + @AfterClass + public static void completeTest() throws Exception { + msgServer.stopServer(); + } + +} diff --git a/dev/com.ibm.ws.logging_fat/publish/.gitignore b/dev/com.ibm.ws.logging_fat/publish/.gitignore new file mode 100644 index 00000000000..0968b1bceb6 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableIbmFeature-1.0.mf b/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableIbmFeature-1.0.mf new file mode 100755 index 00000000000..db84826829b --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableIbmFeature-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: unconfigurableIbmFeature-1.0 +Subsystem-SymbolicName: com.ibm.ws.logging.unconfigurableibmfeature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.configuration.fallalloverthefloor.ibmfeature; version="[1,1.0.100)", +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableUserFeature-1.0.mf b/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableUserFeature-1.0.mf new file mode 100755 index 00000000000..79ee094debd --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/features/unconfigurableUserFeature-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: unconfigurableUserFeature-1.0 +Subsystem-SymbolicName: com.ibm.ws.logging.unconfigurableuserfeature-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.configuration.fallalloverthefloor.userfeature; version="[1,1.0.100)", +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.logging_fat/publish/files/server-invalidIsoDateFormat.xml b/dev/com.ibm.ws.logging_fat/publish/files/server-invalidIsoDateFormat.xml new file mode 100755 index 00000000000..1df05405bb3 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/files/server-invalidIsoDateFormat.xml @@ -0,0 +1,9 @@ + + + jsp-2.2 + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/files/server-twomessageids.xml b/dev/com.ibm.ws.logging_fat/publish/files/server-twomessageids.xml new file mode 100755 index 00000000000..ce86dd23a23 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/files/server-twomessageids.xml @@ -0,0 +1,11 @@ + + + jsp-2.2 + ssl-1.0 + + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/.gitignore b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/server.xml new file mode 100755 index 00000000000..da45c5a6553 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.ibm/server.xml @@ -0,0 +1,11 @@ + + + + + + + servlet-3.0 + usr:unconfigurableIbmFeature-1.0 + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/.gitignore b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/.gitignore new file mode 100644 index 00000000000..2b09f7ba1e1 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/.gitignore @@ -0,0 +1 @@ +/apps diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/server.xml new file mode 100755 index 00000000000..b36cf13d721 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.badconfig.user/server.xml @@ -0,0 +1,11 @@ + + + + + + + servlet-3.0 + usr:unconfigurableUserFeature-1.0 + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/server.xml new file mode 100755 index 00000000000..413710708a2 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.brokenserver/server.xml @@ -0,0 +1,9 @@ + + + + + + jsp-2.2 + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/bootstrap.properties new file mode 100755 index 00000000000..f67f7f4db10 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +com.ibm.ws.logging.console.log.level=OFF diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/jvm.options b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/jvm.options new file mode 100755 index 00000000000..70bb64f28bb --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/jvm.options @@ -0,0 +1 @@ +-Xhealthcenter \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/server.xml new file mode 100755 index 00000000000..9a5836e936c --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.healthcenter/server.xml @@ -0,0 +1,7 @@ + + + jsp-2.2 + + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemessage/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemessage/server.xml new file mode 100755 index 00000000000..d64a00016be --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemessage/server.xml @@ -0,0 +1,9 @@ + + + jsp-2.2 + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/bootstrap.properties new file mode 100755 index 00000000000..d60ff633c37 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/bootstrap.properties @@ -0,0 +1 @@ +com.ibm.ws.logging.hideMessage=CWWKZ0058I \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/server.xml new file mode 100755 index 00000000000..9a5836e936c --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.hidemsg.bootstrap/server.xml @@ -0,0 +1,7 @@ + + + jsp-2.2 + + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/bootstrap.properties new file mode 100755 index 00000000000..4f1ae5a2e10 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/server.xml new file mode 100644 index 00000000000..085212527e3 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.isodateformat/server.xml @@ -0,0 +1,8 @@ + + + + + + jsp-2.2 + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/server.xml new file mode 100755 index 00000000000..413710708a2 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.missingfeatureserver/server.xml @@ -0,0 +1,9 @@ + + + + + + jsp-2.2 + + + diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/bootstrap.properties b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/server.xml b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/server.xml new file mode 100755 index 00000000000..779892ce757 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/publish/servers/com.ibm.ws.logging.tracespec/server.xml @@ -0,0 +1,8 @@ + + + + + + jsp-2.2 + + diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/.gitignore b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/.gitignore new file mode 100644 index 00000000000..50d9e9338c7 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/.gitignore @@ -0,0 +1 @@ +/WEB-INF diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..254272e1c07 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenServlet.java new file mode 100755 index 00000000000..fbe28197760 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenServlet.java @@ -0,0 +1,44 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which throws an exception. + */ +@WebServlet("/BrokenServlet") +public class BrokenServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public BrokenServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + // Whoops, we seem to have a problem! Oh dear, how unexpected! + throw new SpecialBrokenException(); + + } + + static class SpecialBrokenException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithABadlyWrittenThrowableServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithABadlyWrittenThrowableServlet.java new file mode 100755 index 00000000000..abdb445489b --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithABadlyWrittenThrowableServlet.java @@ -0,0 +1,50 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which throws an exception. The getStackTrace() method on the exception returns null. + */ +@WebServlet("/BrokenWithABadlyWrittenThrowableServlet") +public class BrokenWithABadlyWrittenThrowableServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public BrokenWithABadlyWrittenThrowableServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + // Whoops, we seem to have a problem! Oh dear, how unexpected! + throw new BadlyWrittenException(); + + } + + static class BadlyWrittenException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + @Override + public StackTraceElement[] getStackTrace() { + // Can our logging code handle this? + return null; + } + + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithACauseServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithACauseServlet.java new file mode 100755 index 00000000000..c5214b2390d --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/BrokenWithACauseServlet.java @@ -0,0 +1,52 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which throws an exception. + */ +@WebServlet("/BrokenWithACauseServlet") +public class BrokenWithACauseServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public BrokenWithACauseServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + ReasonItAllWentWrongException reasonItAllWentWrongException = new ReasonItAllWentWrongException(); + throw new BrokenWithACauseException(reasonItAllWentWrongException); + + } + + static class BrokenWithACauseException extends RuntimeException { + public BrokenWithACauseException(ReasonItAllWentWrongException reasonItAllWentWrongException) { + super("arbitrary message", reasonItAllWentWrongException); + } + + private static final long serialVersionUID = 1L; + + } + + static class ReasonItAllWentWrongException extends Exception { + private static final long serialVersionUID = 1L; + + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/ExceptionPrintingServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/ExceptionPrintingServlet.java new file mode 100755 index 00000000000..89c159af369 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/ExceptionPrintingServlet.java @@ -0,0 +1,70 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which prints an exception. + */ +@WebServlet("/ExceptionPrintingServlet") +public class ExceptionPrintingServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public ExceptionPrintingServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + response.getWriter().println("Well, hello there. This servlet is working."); + + // Generate a few lines of java stack trace + Set set = new HashSet(); + set.add(new ExceptionGeneratingObject(true)); + set.add(new ExceptionGeneratingObject(false)); + + response.getWriter().println("There should be an exception in your logs."); + + } + + static class SpecialPrintingException extends Exception { + + private static final long serialVersionUID = 1L; + + } + + static class ExceptionGeneratingObject { + private final boolean shouldPrintException; + + public ExceptionGeneratingObject(boolean b) { + shouldPrintException = b; + } + + @Override + public int hashCode() { + if (shouldPrintException) { + new SpecialPrintingException().printStackTrace(); + return 1; + } else { + return -1; + } + } + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/IBMCodeAtTopExceptionPrintingServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/IBMCodeAtTopExceptionPrintingServlet.java new file mode 100755 index 00000000000..471e8c361a4 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/IBMCodeAtTopExceptionPrintingServlet.java @@ -0,0 +1,49 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; + +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which prints an exception. + */ +@WebServlet("/IBMCodeAtTopExceptionPrintingServlet") +public class IBMCodeAtTopExceptionPrintingServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public IBMCodeAtTopExceptionPrintingServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + response.getWriter().println("Howdy! This servlet is working just fine, except for all the bits that are deliberately broken."); + + // In the absence of the jndi feature, this lookup shouldn't go well + try { + InitialContext ctx = new InitialContext(); + ctx.lookup("something/That/Does/Not/Exist"); + } catch (NamingException e) { + // Print the stack trace, and see what happens + e.printStackTrace(); + } + + response.getWriter().println("There should be an exception in your logs."); + + } +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/SpecUsingServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/SpecUsingServlet.java new file mode 100755 index 00000000000..958d533ed6f --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/broken-servlet/src/com/ibm/ws/logging/fat/servlet/SpecUsingServlet.java @@ -0,0 +1,65 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet which prints an exception. + */ +@WebServlet("/SpecUsingServlet") +public class SpecUsingServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public SpecUsingServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.setContentType("text/plain"); + + response.getWriter().println("This servlet uses specification classes, but you shouldn't see this message."); + // Generate an exception which has a few lines of javax.servlet.* content in it + Cookie cookie = new Cookie(null, null); + response.addCookie(cookie); + + } + + static class SpecialPrintingException extends Exception { + + private static final long serialVersionUID = 1L; + + } + + static class ExceptionGeneratingObject { + private final boolean shouldPrintException; + + public ExceptionGeneratingObject(boolean b) { + shouldPrintException = b; + } + + @Override + public int hashCode() { + if (shouldPrintException) { + new SpecialPrintingException().printStackTrace(); + return 1; + } else { + return -1; + } + } + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/.gitignore b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/.gitignore new file mode 100644 index 00000000000..50d9e9338c7 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/.gitignore @@ -0,0 +1 @@ +/WEB-INF diff --git a/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..254272e1c07 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/src/com/ibm/ws/logging/fat/servlet/FFDCServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/src/com/ibm/ws/logging/fat/servlet/FFDCServlet.java new file mode 100755 index 00000000000..1e27d6d6dda --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/ffdc-servlet/src/com/ibm/ws/logging/fat/servlet/FFDCServlet.java @@ -0,0 +1,26 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; +import java.util.logging.Logger; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet("/FFDCServlet") +public class FFDCServlet extends HttpServlet { + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + response.getWriter().println("Test Servlet to generate FFDC"); + + String generateFFDC = request.getParameter("generateFFDC"); + + if ((generateFFDC != null) && (generateFFDC.equalsIgnoreCase("true"))) { + // Divide by zero, to get an ArithmeticException, which will generate an FFDC + int i = 10 / 0; + } + } +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/.gitignore b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/.gitignore new file mode 100644 index 00000000000..50d9e9338c7 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/.gitignore @@ -0,0 +1 @@ +/WEB-INF diff --git a/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/META-INF/MANIFEST.MF b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..254272e1c07 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/src/com/ibm/ws/logging/fat/servlet/LoggerServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/src/com/ibm/ws/logging/fat/servlet/LoggerServlet.java new file mode 100755 index 00000000000..2da44805cc2 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/logger-servlet/src/com/ibm/ws/logging/fat/servlet/LoggerServlet.java @@ -0,0 +1,24 @@ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; +import java.util.logging.Logger; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet("/*") +@SuppressWarnings("serial") +public class LoggerServlet extends HttpServlet { + private static final Logger logger = Logger.getLogger(LoggerServlet.class.getName()); + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + response.getWriter().println("Hello world!"); + // Use severe, which is higher than AUDIT, to ensure this message would + // normally show up in console.log if output wasn't disabled. + logger.severe("Hello world!"); + } +} diff --git a/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/.gitignore b/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/.gitignore new file mode 100644 index 00000000000..e47e1b33a74 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/.gitignore @@ -0,0 +1 @@ +/resources diff --git a/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/src/com/ibm/ws/logging/fat/servlet/MissingEntityManagerServlet.java b/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/src/com/ibm/ws/logging/fat/servlet/MissingEntityManagerServlet.java new file mode 100755 index 00000000000..326e4f7a340 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-applications/missing-feature-servlet/src/com/ibm/ws/logging/fat/servlet/MissingEntityManagerServlet.java @@ -0,0 +1,60 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat.servlet; + +import java.io.IOException; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * A servlet with a dependency on JPA, running in a server with no jpa feature loaded. What could + * possibly go wrong? + */ +@WebServlet("/MissingEntityManagerServlet") +public class MissingEntityManagerServlet extends HttpServlet { + + private static final long serialVersionUID = 1L; + + @PersistenceContext(unitName = "thiswontworkpu") + private EntityManager em; + + /** + * @see HttpServlet#HttpServlet() + */ + public MissingEntityManagerServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + response.getWriter().println("About to try and run a query on the entity manager we don't have."); + String query = "SELECT f FROM ChocolateOrder f"; + Query q = em.createQuery(query); + + List list = q.getResultList(); + response.getWriter().println("How did that work out?" + list); + + } + +} diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/bnd.bnd b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/bnd.bnd new file mode 100755 index 00000000000..4d6d8c13458 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/bnd.bnd @@ -0,0 +1,19 @@ +# Simulate a failure in Liberty code by having a user feature which looks like IBM code +Bundle-Vendor: IBM +bVersion=1.0.0 +Bundle-Version: 1.0.0 +Bundle-Name: Exception throwing feature +Bundle-Description: This feature throws an exception +Bundle-SymbolicName: test.configuration.fallalloverthefloor.ibmfeature; singleton:=true + +Private-Package: \ + com.ibm.ws.logging.fat.fallalloverthefloor.ibmfeature + +Include-Resource: \ + OSGI-INF=resources/OSGI-INF + +Service-Component: \ + com.ibm.ws.logging.fat.brokenfeature; \ + implementation:=com.ibm.ws.logging.fat.fallalloverthefloor.ibmfeature.BrokenFeature; \ + configurationAdmin=org.osgi.service.cm.ConfigurationAdmin; \ + properties:="service.vendor=IBM,com.ibm.ws.wim.repository.type=File" diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/resources/OSGI-INF/metatype/metatype.xml b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/resources/OSGI-INF/metatype/metatype.xml new file mode 100755 index 00000000000..e3db91d6ff8 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/resources/OSGI-INF/metatype/metatype.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/ibmfeature/BrokenFeature.java b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/ibmfeature/BrokenFeature.java new file mode 100755 index 00000000000..49ed9a932c6 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.ibmfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/ibmfeature/BrokenFeature.java @@ -0,0 +1,50 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat.fallalloverthefloor.ibmfeature; + +import java.util.Map; + +/** + * + */ +public class BrokenFeature { + + /** + * A method which, after some indirection, throws an exception. + */ + protected void activate(Map properties) throws Exception { + thinkAboutThrowingAnException(); + + } + + /** + * @throws ConfigurationReceivedException + */ + private void thinkAboutThrowingAnException() throws ConfigurationReceivedException { + reallyThrowAnException(); + } + + /** + * @throws ConfigurationReceivedException + */ + private void reallyThrowAnException() throws ConfigurationReceivedException { + System.out.println("The user feature is about to throw an exception."); + throw new ConfigurationReceivedException(); + } + + protected static class ConfigurationReceivedException extends Exception { + + /** */ + private static final long serialVersionUID = 1L; + + } +} diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/bnd.bnd b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/bnd.bnd new file mode 100755 index 00000000000..30ab1f2515b --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/bnd.bnd @@ -0,0 +1,18 @@ +# Don't include the IBM properties, this is intended to be a user feature +bVersion=1.0.0 +Bundle-Version: 1.0.0 +Bundle-Name: Exception throwing feature +Bundle-Description: This feature throws an exception +Bundle-SymbolicName: test.configuration.fallalloverthefloor.userfeature; singleton:=true + +Private-Package: \ + com.ibm.ws.logging.fat.fallalloverthefloor.userfeature + +Include-Resource: \ + OSGI-INF=resources/OSGI-INF + +Service-Component: \ + com.ibm.ws.logging.fat.brokenfeature; \ + implementation:=com.ibm.ws.logging.fat.fallalloverthefloor.userfeature.BrokenFeature; \ + configurationAdmin=org.osgi.service.cm.ConfigurationAdmin; \ + properties:="service.vendor=IBM,com.ibm.ws.wim.repository.type=File" diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/resources/OSGI-INF/metatype/metatype.xml b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/resources/OSGI-INF/metatype/metatype.xml new file mode 100755 index 00000000000..e3db91d6ff8 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/resources/OSGI-INF/metatype/metatype.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/userfeature/BrokenFeature.java b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/userfeature/BrokenFeature.java new file mode 100755 index 00000000000..5f8b2461583 --- /dev/null +++ b/dev/com.ibm.ws.logging_fat/test-bundles/test.configuration.fallalloverthefloor.userfeature/src/com/ibm/ws/logging/fat/fallalloverthefloor/userfeature/BrokenFeature.java @@ -0,0 +1,50 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.logging.fat.fallalloverthefloor.userfeature; + +import java.util.Map; + +/** + * + */ +public class BrokenFeature { + + /** + * A method which, after some indirection, throws an exception. + */ + protected void activate(Map properties) throws Exception { + thinkAboutThrowingAnException(); + + } + + /** + * @throws ConfigurationReceivedException + */ + private void thinkAboutThrowingAnException() throws ConfigurationReceivedException { + reallyThrowAnException(); + } + + /** + * @throws ConfigurationReceivedException + */ + private void reallyThrowAnException() throws ConfigurationReceivedException { + System.out.println("The user feature is about to throw an exception."); + throw new ConfigurationReceivedException(); + } + + protected static class ConfigurationReceivedException extends Exception { + + /** */ + private static final long serialVersionUID = 1L; + + } +} diff --git a/dev/com.ibm.ws.org.codehaus.jackson/.classpath.ant b/dev/com.ibm.ws.org.codehaus.jackson/.classpath.ant deleted file mode 100644 index ba360b1b66d..00000000000 --- a/dev/com.ibm.ws.org.codehaus.jackson/.classpath.ant +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.classpath b/dev/com.ibm.ws.org.glassfish.json_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.classpath.gradle b/dev/com.ibm.ws.org.glassfish.json_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.gitignore b/dev/com.ibm.ws.org.glassfish.json_fat/.gitignore new file mode 100644 index 00000000000..1117ac1f9e9 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.gitignore @@ -0,0 +1,2 @@ +junit.jar +/bootstrapping.properties diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.project b/dev/com.ibm.ws.org.glassfish.json_fat/.project new file mode 100644 index 00000000000..99f4e300645 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.org.glassfish.json_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..f48ecd6cc60 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..8607a4626e4 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,63 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_settings_version=11 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd b/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd new file mode 100644 index 00000000000..9801b86a42e --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd @@ -0,0 +1,13 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + com.ibm.ws.componenttest;version=latest, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.org.glassfish.json.1.0;version=latest diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd.gradle b/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..9801b86a42e --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/bnd.bnd.gradle @@ -0,0 +1,13 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + com.ibm.ws.componenttest;version=latest, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.ws.org.glassfish.json.1.0;version=latest diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/build-test.xml b/dev/com.ibm.ws.org.glassfish.json_fat/build-test.xml new file mode 100644 index 00000000000..28e8733b7e3 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/build-test.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/build.gradle b/dev/com.ibm.ws.org.glassfish.json_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/delivery.sets b/dev/com.ibm.ws.org.glassfish.json_fat/delivery.sets new file mode 100644 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/FATSuite.java b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/FATSuite.java new file mode 100644 index 00000000000..1be011b859a --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/FATSuite.java @@ -0,0 +1,28 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.org.glassfish.json.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import com.ibm.ws.org.glassfish.json.fat.tests.BasicJSONPTest; +import com.ibm.ws.org.glassfish.json.fat.tests.CustomFeatureJSONPTest; +import componenttest.custom.junit.runner.AlwaysPassesTest; + +@RunWith(Suite.class) +@SuiteClasses({ + AlwaysPassesTest.class, + BasicJSONPTest.class, + CustomFeatureJSONPTest.class +}) +public class FATSuite {} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/AbstractTest.java b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/AbstractTest.java new file mode 100644 index 00000000000..723219190a6 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/AbstractTest.java @@ -0,0 +1,145 @@ +package com.ibm.ws.org.glassfish.json.fat.tests; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +import static componenttest.topology.utils.HttpUtils.getHttpConnection; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; + +import junit.framework.Assert; + +import org.junit.AfterClass; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.app.FATServlet; +import componenttest.custom.junit.runner.OnlyRunInJava7Rule; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.utils.HttpUtils; +import componenttest.topology.utils.HttpUtils.HTTPRequestMethod; + +/** + * Abstract test class. This should be extended when adding a new test class, + * so that this shared logic for running the actual tests remains in one place. + * + * To add new test, simply implement @BeforeClass method that gets and starts + * the server needed. + */ +public abstract class AbstractTest { + /** The time in seconds to wait at a URL before giving up. **/ + public static final int CONN_TIMEOUT = 30; + + protected static LibertyServer server; + private static final Class c = AbstractTest.class; + + @ClassRule + public static final TestRule java7Rule = new OnlyRunInJava7Rule(); + + @Rule + public TestName testName = new TestName(); + + public String servlet; + + /** + * Call {@link #runTest} with the configured servlet name and the current + * test method as the "testMethod" query parameter. + */ + protected void runTest() throws Exception { + Assert.assertNotNull(servlet); + runTest(servlet + "?testMethod=" + testName.getMethodName()); + } + + protected void runTest(String servlet, String method) throws Exception { + Assert.assertNotNull(servlet); + String invocationString = servlet + "?testMethod=" + method; + runTest(invocationString); + } + + /** + * Invoke the specified servlet and look for "PASSED" as a response. + */ + protected void runTest(String servlet) throws Exception { + final String method = testName.getMethodName(); + + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + servlet); + Log.info(c, method, "Calling application with URL=" + url.toString()); + HttpURLConnection con = getHttpConnection(url, HttpURLConnection.HTTP_OK, new int[0], CONN_TIMEOUT, HTTPRequestMethod.GET); + + // Check the response from servlet for "PASSED" + String response = getAnyResponse(con); + Log.info(c, method, "Response from " + servlet + ": " + response); + if (!"PASSED".equals(response) && + !response.contains(FATServlet.SUCCESS)) { + fail(servlet + " failed: " + response); + } + } + + /** + * Invoke the specified servlet and wait until the passed in response + * code is returned. + * + * @return the message associated with the response + */ + String runTest(String servlet, int responseCode) throws Exception { + final String method = testName.getMethodName(); + + URL url = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + servlet); + Log.info(c, method, "Calling application with URL=" + url.toString()); + HttpURLConnection con = getHttpConnection(url, responseCode, CONN_TIMEOUT); + + // Check the response from servlet for "PASSED" + String response = getAnyResponse(con); + Log.info(c, method, "Response from " + servlet + ": " + response); + + return response; + } + + /** + * This method is used to read the response from either the input stream or + * error stream. + * + * @param con The connection to the HTTP address + * @return The output or error from the webpage + * @throws IOException if neither the input stream nor error stream can be read + */ + public static String getAnyResponse(HttpURLConnection urlConnection) throws IOException { + BufferedReader br; + try { + br = HttpUtils.getConnectionStream(urlConnection); + } catch (IOException ioex) { + br = HttpUtils.getErrorStream(urlConnection); + } + + String response = ""; + String aLine; + + while ((aLine = br.readLine()) != null) { + response = response + aLine; + } + return response; + } + + @AfterClass + public static void tearDown() throws Exception { + if (server != null && server.isStarted()) { + server.stopServer(); + } + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/BasicJSONPTest.java b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/BasicJSONPTest.java new file mode 100644 index 00000000000..151ff2ec2b4 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/BasicJSONPTest.java @@ -0,0 +1,85 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +package com.ibm.ws.org.glassfish.json.fat.tests; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class BasicJSONPTest extends AbstractTest { + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer"); + server.addInstalledAppForValidation("JSONPWAR"); + server.addInstalledAppForValidation("customAppJSONPWAR"); + server.addInstalledAppForValidation("customLibJSONPWAR"); + server.startServer("BasicJSONPTest.log"); + } + + /** + * Ensure that JsonObjectBuilder is functioning. + */ + @Test + public void testJsonBuild() throws Exception { + this.servlet = "/JSONPWAR/BuildJSONPServlet"; + runTest(); + } + + /** + * Ensure that JsonReader is functioning. + */ + @Test + public void testJsonRead() throws Exception { + this.servlet = "/JSONPWAR/ReadJSONPServlet"; + runTest(); + } + + /** + * Ensure that JsonWriter is functioning. + */ + @Test + public void testJsonWrite() throws Exception { + this.servlet = "/JSONPWAR/WriteJSONPServlet"; + runTest(); + } + + /** + * Ensure that JsonGenerator is functioning. + */ + @Test + public void testJsonStream() throws Exception { + this.servlet = "/JSONPWAR/StreamJSONPServlet"; + runTest(); + } + + /** + * Test plugging in a custom implementation for JSON processing, + * where the custom implementation is packaged in the application. + */ + @Test + public void testCustomAppJsonProvider() throws Exception { + this.servlet = "/customAppJSONPWAR/CustomJsonProviderServlet"; + runTest(); + } + + /** + * Test plugging in a custom implementation for JSON processing, + * where the custom implementation is packaged in a shared library. + */ + @Test + public void testCustomLibJsonProvider() throws Exception { + this.servlet = "/customLibJSONPWAR/CustomJsonProviderServlet"; + runTest(); + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/CustomFeatureJSONPTest.java b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/CustomFeatureJSONPTest.java new file mode 100644 index 00000000000..0b53c606e03 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/fat/src/com/ibm/ws/org/glassfish/json/fat/tests/CustomFeatureJSONPTest.java @@ -0,0 +1,49 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +package com.ibm.ws.org.glassfish.json.fat.tests; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class CustomFeatureJSONPTest extends AbstractTest { + private static final String FEATURE_NAME = "customJsonpProvider-1.0"; + private static final String BUNDLE_NAME = "com.ibm.ws.jsonp.feature.provider.1.0_1.0.0"; + + @BeforeClass + public static void setUp() throws Exception { + server = LibertyServerFactory.getLibertyServer("com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer"); + server.installUserFeature(FEATURE_NAME); + server.installUserBundle(BUNDLE_NAME); + server.addInstalledAppForValidation("customFeatureJSONPWAR"); + server.startServer("customFeatureJSONPTest.log"); + } + + @AfterClass + public static void afterClass() throws Exception { + server.stopServer(); + server.uninstallUserBundle(BUNDLE_NAME); + server.uninstallUserFeature(FEATURE_NAME); + } + + /** + * Test plugging in a custom implementation for JSON processing, + * where the custom implementation is packaged in a user defined feature. + */ + @Test + public void testCustomFeatureJsonProvider() throws Exception { + this.servlet = "/customFeatureJSONPWAR/CustomJsonProviderServlet"; + runTest(); + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/.gitignore b/dev/com.ibm.ws.org.glassfish.json_fat/publish/.gitignore new file mode 100644 index 00000000000..0968b1bceb6 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/features/customJsonpProvider-1.0.mf b/dev/com.ibm.ws.org.glassfish.json_fat/publish/features/customJsonpProvider-1.0.mf new file mode 100644 index 00000000000..34c4cb146bc --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/features/customJsonpProvider-1.0.mf @@ -0,0 +1,10 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: customJsonpProvider-1.0 +Subsystem-SymbolicName: com.ibm.ws.jsonp.feature.provider.1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.websphere.appserver.classloading-1.0; type="osgi.subsystem.feature", + com.ibm.ws.jsonp.feature.provider.1.0; version="[1,1.0.100)" +IBM-API-Package: com.ibm.ws.jsonp.feature.provider; type="api" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/.gitignore b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/.gitignore new file mode 100644 index 00000000000..a443afd9743 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/.gitignore @@ -0,0 +1,4 @@ +/JSONPProviderLib +/apps +/dropins +/lib diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/bootstrap.properties b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/bootstrap.properties new file mode 100644 index 00000000000..af984ccafa5 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +com.ibm.ws.logging.trace.specification=*=info diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/build.properties b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/build.properties new file mode 100644 index 00000000000..ae211a3c3cc --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/build.properties @@ -0,0 +1 @@ +include.JSONPProviderLib=true \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/server.xml b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/server.xml new file mode 100644 index 00000000000..1de1369c8e5 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer/server.xml @@ -0,0 +1,17 @@ + + + + + servlet-3.0 + jsonp-1.0 + + + + + + + + + + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/.gitignore b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/.gitignore new file mode 100644 index 00000000000..26548bf9b65 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/.gitignore @@ -0,0 +1,2 @@ +/dropins +/lib diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/bootstrap.properties b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/bootstrap.properties new file mode 100644 index 00000000000..af984ccafa5 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +com.ibm.ws.logging.trace.specification=*=info diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/server.xml b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/server.xml new file mode 100644 index 00000000000..9d1ab7f343a --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/publish/servers/com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer/server.xml @@ -0,0 +1,10 @@ + + + + + servlet-3.0 + jsonp-1.0 + usr:customJsonpProvider-1.0 + + + diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/package.properties b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/package.properties new file mode 100644 index 00000000000..3ee53ab9e54 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/package.properties @@ -0,0 +1,2 @@ +server.pattern=com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer +lib.componenttest=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/META-INF/permissions.xml new file mode 100644 index 00000000000..28acc02da03 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/WEB-INF/json_read_test_data.js b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/WEB-INF/json_read_test_data.js new file mode 100644 index 00000000000..7d566461a52 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/resources/WEB-INF/json_read_test_data.js @@ -0,0 +1,6 @@ +{ "firstName": "Steve", "lastName": "Watson", "age": 45, + "phoneNumber": [ + { "type": "office", "number": "507-253-1234" }, + { "type": "cell", "number": "507-253-4321" } + ] +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/AbstractJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/AbstractJSONPServlet.java new file mode 100644 index 00000000000..f0ad4205609 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/AbstractJSONPServlet.java @@ -0,0 +1,138 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.util.HashMap; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.stream.JsonParser; +import javax.json.stream.JsonParser.Event; +import javax.json.stream.JsonParserFactory; + +import junit.framework.Assert; + +import componenttest.app.FATServlet; + +@SuppressWarnings("serial") +public abstract class AbstractJSONPServlet extends FATServlet { + private String jsonData = ""; + + protected JsonParser getJsonParser(String fileLocation) { + FileInputStream fis = createFileInputStream(fileLocation); + JsonParserFactory jsonParserFactory = Json.createParserFactory(new HashMap()); + JsonParser parser = jsonParserFactory.createParser(fis); + return parser; + } + + protected JsonParser getJsonParser(JsonObject value) { + JsonParserFactory jsonParserFactory = Json.createParserFactory(new HashMap()); + JsonParser parser = jsonParserFactory.createParser(value); + return parser; + } + + protected void parseJson(JsonParser parser) { + + Boolean startObjectOrArray = false; + Boolean endObjectOrArray = false; + while (parser.hasNext()) { + Event event = parser.next(); + + if (endObjectOrArray && (event.equals(Event.START_ARRAY) || event.equals(Event.START_OBJECT))) { + logJsonElement(","); + } + endObjectOrArray = false; + + switch (event) { + case START_ARRAY: + startObjectOrArray = true; + logJsonElement("["); + break; + case END_ARRAY: + endObjectOrArray = true; + logJsonElement("]"); + break; + case START_OBJECT: + startObjectOrArray = true; + logJsonElement("{"); + break; + case END_OBJECT: + endObjectOrArray = true; + logJsonElement("}"); + break; + case VALUE_NUMBER: + if (parser.isIntegralNumber()) { + logJsonElement(Integer.toString(parser.getInt())); + } else { + logJsonElement(Long.toString(parser.getLong())); + } + break; + case VALUE_FALSE: + logJsonElement("FALSE"); + break; + case VALUE_NULL: + logJsonElement("NULL"); + break; + case VALUE_TRUE: + logJsonElement("TRUE"); + break; + case KEY_NAME: + if (!startObjectOrArray) { + logJsonElement(","); + } + startObjectOrArray = false; + + logJsonElement("\"" + parser.getString() + "\":"); + break; + case VALUE_STRING: + logJsonElement("\"" + parser.getString() + "\""); + break; + } + } + //System.out.println("DEBUG: " + jsonData); + } + + private void logJsonElement(String element) { + System.out.println(element); + jsonData = jsonData + element; + } + + protected void checkJsonData() { + String expectedString = "{\"firstName\":\"Steve\",\"lastName\":\"Watson\",\"age\":45,\"phoneNumber\":[{\"type\":\"office\",\"number\":\"507-253-1234\"},{\"type\":\"cell\",\"number\":\"507-253-4321\"}]}"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString + "> FOUND <" + jsonData + ">", expectedString.equals(jsonData)); + } + + protected FileOutputStream createFileOutputStream(String fileLocation) { + FileOutputStream fos = null; + try { + fos = new FileOutputStream(fileLocation); + } catch (FileNotFoundException e) { + e.printStackTrace(); + Assert.fail("AbstractJSONPServlet threw an unexpected FileNotFoundException."); + } + return fos; + } + + protected FileInputStream createFileInputStream(String fileLocation) { + FileInputStream fis = null; + try { + fis = new FileInputStream(fileLocation); + } catch (FileNotFoundException e) { + e.printStackTrace(); + Assert.fail("AbstractJSONPServlet threw an unexpected FileNotFoundException."); + } + return fis; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/BuildJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/BuildJSONPServlet.java new file mode 100644 index 00000000000..f0a134d7d58 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/BuildJSONPServlet.java @@ -0,0 +1,41 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +@WebServlet("/BuildJSONPServlet") +@SuppressWarnings("serial") +public class BuildJSONPServlet extends AbstractJSONPServlet { + + public void testJsonBuild() { + JsonObject value = buildJsonObject(); + JsonParser parser = getJsonParser(value); + parseJson(parser); + checkJsonData(); + } + + private JsonObject buildJsonObject() { + JsonObject value = Json.createObjectBuilder() + .add("firstName", "Steve") + .add("lastName", "Watson") + .add("age", 45) + .add("phoneNumber", Json.createArrayBuilder() + .add(Json.createObjectBuilder().add("type", "office").add("number", "507-253-1234")) + .add(Json.createObjectBuilder().add("type", "cell").add("number", "507-253-4321"))) + .build(); + return value; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/ReadJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/ReadJSONPServlet.java new file mode 100644 index 00000000000..98daf7189b6 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/ReadJSONPServlet.java @@ -0,0 +1,41 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.InputStream; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonReader; +import javax.json.stream.JsonParser; +import javax.servlet.ServletContext; +import javax.servlet.annotation.WebServlet; + +@WebServlet("/ReadJSONPServlet") +@SuppressWarnings("serial") +public class ReadJSONPServlet extends AbstractJSONPServlet { + + public void testJsonRead() { + JsonObject jsonData = readJsonFile("/WEB-INF/json_read_test_data.js"); + JsonParser parser = getJsonParser(jsonData); + parseJson(parser); + checkJsonData(); + } + + private JsonObject readJsonFile(String fileLocation) { + ServletContext context = getServletContext(); + InputStream is = context.getResourceAsStream(fileLocation); + JsonReader reader = Json.createReader(is); + JsonObject value = reader.readObject(); + return value; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/StreamJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/StreamJSONPServlet.java new file mode 100644 index 00000000000..6bbd7f6a6b7 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/StreamJSONPServlet.java @@ -0,0 +1,59 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.FileOutputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.json.Json; +import javax.json.stream.JsonGenerator; +import javax.json.stream.JsonGeneratorFactory; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +@WebServlet("/StreamJSONPServlet") +@SuppressWarnings("serial") +public class StreamJSONPServlet extends AbstractJSONPServlet { + + public void testJsonStream() { + String outputDir = System.getenv("X_LOG_DIR") + "/json_stream_test_data.js"; + generateJSON(outputDir); + JsonParser parser = getJsonParser(outputDir); + parseJson(parser); + checkJsonData(); + } + + private void generateJSON(String fileLocation) { + FileOutputStream os = createFileOutputStream(fileLocation); + Map props = new HashMap(); + props.put(JsonGenerator.PRETTY_PRINTING, new Object()); + JsonGeneratorFactory factory = Json.createGeneratorFactory(props); + JsonGenerator generator = factory.createGenerator(os); + generator.writeStartObject() + .write("firstName", "Steve") + .write("lastName", "Watson") + .write("age", 45) + .writeStartArray("phoneNumber") + .writeStartObject() + .write("type", "office") + .write("number", "507-253-1234") + .writeEnd() + .writeStartObject() + .write("type", "cell") + .write("number", "507-253-4321") + .writeEnd() + .writeEnd() + .writeEnd(); + generator.close(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/WriteJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/WriteJSONPServlet.java new file mode 100644 index 00000000000..081424f3cc8 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/JSONPWAR.war/src/com/ibm/ws/jsonp/fat/WriteJSONPServlet.java @@ -0,0 +1,54 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonReader; +import javax.json.JsonWriter; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +@WebServlet("/WriteJSONPServlet") +@SuppressWarnings("serial") +public class WriteJSONPServlet extends AbstractJSONPServlet { + + public void testJsonWrite() { + InputStream originalInputStream = getServletContext().getResourceAsStream("/WEB-INF/json_read_test_data.js"); + JsonObject originalJsonData = readJsonFile(originalInputStream); + + String outputDir = System.getenv("X_LOG_DIR") + "/json_write_test_data.js"; + writeJsonFile(outputDir, originalJsonData); + FileInputStream newInputStream = createFileInputStream(outputDir); + JsonObject newJsonData = readJsonFile(newInputStream); + JsonParser parser = getJsonParser(newJsonData); + parseJson(parser); + checkJsonData(); + } + + private void writeJsonFile(String fileLocation, JsonObject value) { + FileOutputStream os = createFileOutputStream(fileLocation); + JsonWriter writer = Json.createWriter(os); + writer.writeObject(value); + writer.close(); + } + + private JsonObject readJsonFile(InputStream is) { + JsonReader reader = Json.createReader(is); + JsonObject value = reader.readObject(); + return value; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/permissions.xml new file mode 100644 index 00000000000..28acc02da03 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider new file mode 100644 index 00000000000..34dbcb5cfc5 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider @@ -0,0 +1 @@ +com.ibm.ws.jsonp.app.provider.JsonProviderImpl \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonParserImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonParserImpl.java new file mode 100644 index 00000000000..08605d06014 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonParserImpl.java @@ -0,0 +1,65 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.app.provider; + +import java.math.BigDecimal; + +import javax.json.stream.JsonLocation; + +/** + * + */ +public class JsonParserImpl implements javax.json.stream.JsonParser { + + @Override + public void close() {} + + @Override + public BigDecimal getBigDecimal() { + return null; + } + + @Override + public int getInt() { + return 0; + } + + @Override + public JsonLocation getLocation() { + return null; + } + + @Override + public long getLong() { + return 0; + } + + @Override + public String getString() { + return "Custom JSONP implementation loaded from an application library"; + } + + @Override + public boolean hasNext() { + return false; + } + + @Override + public boolean isIntegralNumber() { + return false; + } + + @Override + public Event next() { + return null; + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonProviderImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonProviderImpl.java new file mode 100644 index 00000000000..3c122636eb7 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPProvider.jar/src/com/ibm/ws/jsonp/app/provider/JsonProviderImpl.java @@ -0,0 +1,97 @@ +package com.ibm.ws.jsonp.app.provider; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.util.Map; + +import javax.json.JsonArrayBuilder; +import javax.json.JsonBuilderFactory; +import javax.json.JsonObjectBuilder; +import javax.json.JsonReader; +import javax.json.JsonReaderFactory; +import javax.json.JsonWriter; +import javax.json.JsonWriterFactory; +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonGenerator; +import javax.json.stream.JsonGeneratorFactory; +import javax.json.stream.JsonParser; +import javax.json.stream.JsonParserFactory; + +public class JsonProviderImpl extends JsonProvider { + @Override + public JsonParser createParser(Reader reader) { + return null; + } + + @Override + public JsonParser createParser(InputStream in) { + return new JsonParserImpl(); + } + + @Override + public JsonParserFactory createParserFactory(Map config) { + return null; + } + + @Override + public JsonGenerator createGenerator(Writer writer) { + return null; + } + + @Override + public JsonGenerator createGenerator(OutputStream out) { + return null; + } + + @Override + public JsonGeneratorFactory createGeneratorFactory(Map config) { + return null; + } + + @Override + public JsonReader createReader(Reader reader) { + return null; + } + + @Override + public JsonReader createReader(InputStream in) { + return null; + } + + @Override + public JsonWriter createWriter(Writer writer) { + return null; + } + + @Override + public JsonWriter createWriter(OutputStream out) { + return null; + } + + @Override + public JsonWriterFactory createWriterFactory(Map config) { + return null; + } + + @Override + public JsonReaderFactory createReaderFactory(Map config) { + return null; + } + + @Override + public JsonObjectBuilder createObjectBuilder() { + return null; + } + + @Override + public JsonArrayBuilder createArrayBuilder() { + return null; + } + + @Override + public JsonBuilderFactory createBuilderFactory(Map config) { + return null; + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/package.properties b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/package.properties new file mode 100644 index 00000000000..109d9f3a7d9 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/package.properties @@ -0,0 +1,3 @@ +server.pattern=com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer +lib.pattern=customAppJSONPProvider.jar +lib.componenttest=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/resources/META-INF/permissions.xml new file mode 100644 index 00000000000..28acc02da03 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomAppJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomAppJSONPServlet.java new file mode 100644 index 00000000000..cf771f427e5 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customAppJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomAppJSONPServlet.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.InputStream; + +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +import junit.framework.Assert; + +import componenttest.app.FATServlet; + +@WebServlet("/CustomJsonProviderServlet") +@SuppressWarnings("serial") +public class CustomAppJSONPServlet extends FATServlet { + public void testCustomAppJsonProvider() { + // Verify the custom JSON Provider class is being used. + JsonProvider dummyProvider = JsonProvider.provider(); + String providerName = dummyProvider.getClass().getName(); + String expectedString1 = "com.ibm.ws.jsonp.app.provider.JsonProviderImpl"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString1 + "> FOUND <" + providerName + ">", expectedString1.equals(providerName)); + + // Verify the custom implemented JsonParser class gets loaded and used. + InputStream dummyInputStream = null; + JsonParser dummyParser = dummyProvider.createParser(dummyInputStream); + String parserString = dummyParser.getString(); + String expectedString2 = "Custom JSONP implementation loaded from an application library"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString2 + "> FOUND <" + parserString + ">", expectedString2.equals(parserString)); + + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/package.properties b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/package.properties new file mode 100644 index 00000000000..92fd83b503d --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/package.properties @@ -0,0 +1,2 @@ +server.pattern=com.ibm.ws.org.glassfish.json.fat.CustomFeatureJsonpServer +lib.componenttest=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/resources/META-INF/permissions.xml new file mode 100644 index 00000000000..28acc02da03 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomFeatureJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomFeatureJSONPServlet.java new file mode 100644 index 00000000000..6424974169c --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customFeatureJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomFeatureJSONPServlet.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.InputStream; + +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +import junit.framework.Assert; + +import componenttest.app.FATServlet; + +@WebServlet("/CustomJsonProviderServlet") +@SuppressWarnings("serial") +public class CustomFeatureJSONPServlet extends FATServlet { + public void testCustomFeatureJsonProvider() { + // Verify the custom JSON Provider class is being used. + JsonProvider dummyProvider = JsonProvider.provider(); + String providerName = dummyProvider.getClass().getName(); + String expectedString1 = "com.ibm.ws.jsonp.feature.provider.JsonProviderImpl"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString1 + "> FOUND <" + providerName + ">", expectedString1.equals(providerName)); + + // Verify the custom implemented JsonParser class gets loaded and used. + InputStream dummyInputStream = null; + JsonParser dummyParser = dummyProvider.createParser(dummyInputStream); + String parserString = dummyParser.getString(); + String expectedString2 = "Custom JSONP implementation loaded from a user defined feature"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString2 + "> FOUND <" + parserString + ">", expectedString2.equals(parserString)); + + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/permissions.xml new file mode 100644 index 00000000000..28acc02da03 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider new file mode 100644 index 00000000000..6f90d7810ce --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/resources/META-INF/services/javax.json.spi.JsonProvider @@ -0,0 +1 @@ +com.ibm.ws.jsonp.lib.provider.JsonProviderImpl \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonParserImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonParserImpl.java new file mode 100644 index 00000000000..54ce647847d --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonParserImpl.java @@ -0,0 +1,65 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.lib.provider; + +import java.math.BigDecimal; + +import javax.json.stream.JsonLocation; + +/** + * + */ +public class JsonParserImpl implements javax.json.stream.JsonParser { + + @Override + public void close() {} + + @Override + public BigDecimal getBigDecimal() { + return null; + } + + @Override + public int getInt() { + return 0; + } + + @Override + public JsonLocation getLocation() { + return null; + } + + @Override + public long getLong() { + return 0; + } + + @Override + public String getString() { + return "Custom JSONP implementation loaded from a shared library"; + } + + @Override + public boolean hasNext() { + return false; + } + + @Override + public boolean isIntegralNumber() { + return false; + } + + @Override + public Event next() { + return null; + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonProviderImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonProviderImpl.java new file mode 100644 index 00000000000..672ff871cc8 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPProvider.jar/src/com/ibm/ws/jsonp/lib/provider/JsonProviderImpl.java @@ -0,0 +1,97 @@ +package com.ibm.ws.jsonp.lib.provider; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.util.Map; + +import javax.json.JsonArrayBuilder; +import javax.json.JsonBuilderFactory; +import javax.json.JsonObjectBuilder; +import javax.json.JsonReader; +import javax.json.JsonReaderFactory; +import javax.json.JsonWriter; +import javax.json.JsonWriterFactory; +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonGenerator; +import javax.json.stream.JsonGeneratorFactory; +import javax.json.stream.JsonParser; +import javax.json.stream.JsonParserFactory; + +public class JsonProviderImpl extends JsonProvider { + @Override + public JsonParser createParser(Reader reader) { + return null; + } + + @Override + public JsonParser createParser(InputStream in) { + return new JsonParserImpl(); + } + + @Override + public JsonParserFactory createParserFactory(Map config) { + return null; + } + + @Override + public JsonGenerator createGenerator(Writer writer) { + return null; + } + + @Override + public JsonGenerator createGenerator(OutputStream out) { + return null; + } + + @Override + public JsonGeneratorFactory createGeneratorFactory(Map config) { + return null; + } + + @Override + public JsonReader createReader(Reader reader) { + return null; + } + + @Override + public JsonReader createReader(InputStream in) { + return null; + } + + @Override + public JsonWriter createWriter(Writer writer) { + return null; + } + + @Override + public JsonWriter createWriter(OutputStream out) { + return null; + } + + @Override + public JsonWriterFactory createWriterFactory(Map config) { + return null; + } + + @Override + public JsonReaderFactory createReaderFactory(Map config) { + return null; + } + + @Override + public JsonObjectBuilder createObjectBuilder() { + return null; + } + + @Override + public JsonArrayBuilder createArrayBuilder() { + return null; + } + + @Override + public JsonBuilderFactory createBuilderFactory(Map config) { + return null; + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/package.properties b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/package.properties new file mode 100644 index 00000000000..4678d3b93f7 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/package.properties @@ -0,0 +1,3 @@ +server.pattern=com.ibm.ws.org.glassfish.json.fat.BasicJsonpServer +app.dir=apps +lib.componenttest=true diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/resources/META-INF/permissions.xml b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/resources/META-INF/permissions.xml new file mode 100644 index 00000000000..28acc02da03 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/resources/META-INF/permissions.xml @@ -0,0 +1,20 @@ + + + + + java.lang.RuntimePermission + getenv.* + + + + java.io.FilePermission + ALL FILES + read,write + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomLibJSONPServlet.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomLibJSONPServlet.java new file mode 100644 index 00000000000..5322b03e301 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-applications/customLibJSONPWAR.war/src/com/ibm/ws/jsonp/fat/CustomLibJSONPServlet.java @@ -0,0 +1,42 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.fat; + +import java.io.InputStream; + +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonParser; +import javax.servlet.annotation.WebServlet; + +import junit.framework.Assert; + +import componenttest.app.FATServlet; + +@WebServlet("/CustomJsonProviderServlet") +@SuppressWarnings("serial") +public class CustomLibJSONPServlet extends FATServlet { + public void testCustomLibJsonProvider() { + // Verify the custom JSON Provider class is being used. + JsonProvider dummyProvider = JsonProvider.provider(); + String providerName = dummyProvider.getClass().getName(); + String expectedString1 = "com.ibm.ws.jsonp.lib.provider.JsonProviderImpl"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString1 + "> FOUND <" + providerName + ">", expectedString1.equals(providerName)); + + // Verify the custom implemented JsonParser class gets loaded and used. + InputStream dummyInputStream = null; + JsonParser dummyParser = dummyProvider.createParser(dummyInputStream); + String parserString = dummyParser.getString(); + String expectedString2 = "Custom JSONP implementation loaded from a shared library"; + Assert.assertTrue("DEBUG: EXPECTED <" + expectedString2 + "> FOUND <" + parserString + ">", expectedString2.equals(parserString)); + + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/bnd.bnd b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/bnd.bnd new file mode 100644 index 00000000000..ab64fc7816b --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/bnd.bnd @@ -0,0 +1,25 @@ +-include=~../../../cnf/resources/bnd/bundle.props + +bVersion=1.0.0 + + +Bundle-SymbolicName: com.ibm.ws.jsonp.feature.provider.1.0 + +# Provide these as resources to applications. +app-resources= \ + META-INF/services/javax.json.spi.JsonProvider + +Export-Package: \ + com.ibm.ws.jsonp.feature.provider.* + +# The file system path is relative to the location of this bnd.bnd file. +Include-Resource: \ + META-INF/services=resources/META-INF/services + +Service-Component: \ + com.ibm.ws.jsonp.feature.provide_${bVersion}.ResourceProvider; \ + implementation:=com.ibm.wsspi.classloading.ResourceProvider; \ + provide:=com.ibm.wsspi.classloading.ResourceProvider; \ + configuration-policy:=ignore; \ + properties:= "resources=${app-resources}" + \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/resources/META-INF/services/javax.json.spi.JsonProvider b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/resources/META-INF/services/javax.json.spi.JsonProvider new file mode 100644 index 00000000000..cfe62ac4c41 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/resources/META-INF/services/javax.json.spi.JsonProvider @@ -0,0 +1 @@ +com.ibm.ws.jsonp.feature.provider.JsonProviderImpl \ No newline at end of file diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonParserImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonParserImpl.java new file mode 100644 index 00000000000..11e32120c14 --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonParserImpl.java @@ -0,0 +1,65 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.jsonp.feature.provider; + +import java.math.BigDecimal; + +import javax.json.stream.JsonLocation; + +/** + * + */ +public class JsonParserImpl implements javax.json.stream.JsonParser { + + @Override + public void close() {} + + @Override + public BigDecimal getBigDecimal() { + return null; + } + + @Override + public int getInt() { + return 0; + } + + @Override + public JsonLocation getLocation() { + return null; + } + + @Override + public long getLong() { + return 0; + } + + @Override + public String getString() { + return "Custom JSONP implementation loaded from a user defined feature"; + } + + @Override + public boolean hasNext() { + return false; + } + + @Override + public boolean isIntegralNumber() { + return false; + } + + @Override + public Event next() { + return null; + } +} diff --git a/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonProviderImpl.java b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonProviderImpl.java new file mode 100644 index 00000000000..69e4a1d86ec --- /dev/null +++ b/dev/com.ibm.ws.org.glassfish.json_fat/test-bundles/custom.jsonp/src/com/ibm/ws/jsonp/feature/provider/JsonProviderImpl.java @@ -0,0 +1,97 @@ +package com.ibm.ws.jsonp.feature.provider; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.util.Map; + +import javax.json.JsonArrayBuilder; +import javax.json.JsonBuilderFactory; +import javax.json.JsonObjectBuilder; +import javax.json.JsonReader; +import javax.json.JsonReaderFactory; +import javax.json.JsonWriter; +import javax.json.JsonWriterFactory; +import javax.json.spi.JsonProvider; +import javax.json.stream.JsonGenerator; +import javax.json.stream.JsonGeneratorFactory; +import javax.json.stream.JsonParser; +import javax.json.stream.JsonParserFactory; + +public class JsonProviderImpl extends JsonProvider { + @Override + public JsonParser createParser(Reader reader) { + return null; + } + + @Override + public JsonParser createParser(InputStream in) { + return new JsonParserImpl(); + } + + @Override + public JsonParserFactory createParserFactory(Map config) { + return null; + } + + @Override + public JsonGenerator createGenerator(Writer writer) { + return null; + } + + @Override + public JsonGenerator createGenerator(OutputStream out) { + return null; + } + + @Override + public JsonGeneratorFactory createGeneratorFactory(Map config) { + return null; + } + + @Override + public JsonReader createReader(Reader reader) { + return null; + } + + @Override + public JsonReader createReader(InputStream in) { + return null; + } + + @Override + public JsonWriter createWriter(Writer writer) { + return null; + } + + @Override + public JsonWriter createWriter(OutputStream out) { + return null; + } + + @Override + public JsonWriterFactory createWriterFactory(Map config) { + return null; + } + + @Override + public JsonReaderFactory createReaderFactory(Map config) { + return null; + } + + @Override + public JsonObjectBuilder createObjectBuilder() { + return null; + } + + @Override + public JsonArrayBuilder createArrayBuilder() { + return null; + } + + @Override + public JsonBuilderFactory createBuilderFactory(Map config) { + return null; + } +} diff --git a/dev/com.ibm.ws.org.osgi.service.resolver/.classpath.ant b/dev/com.ibm.ws.org.osgi.service.resolver/.classpath.ant deleted file mode 100644 index 6e48000f881..00000000000 --- a/dev/com.ibm.ws.org.osgi.service.resolver/.classpath.ant +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/dev/com.ibm.ws.product.utility_bvt/bnd.bnd b/dev/com.ibm.ws.product.utility_bvt/bnd.bnd index df45604f272..27abb02cc16 100755 --- a/dev/com.ibm.ws.product.utility_bvt/bnd.bnd +++ b/dev/com.ibm.ws.product.utility_bvt/bnd.bnd @@ -13,4 +13,4 @@ src: \ ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ - com.ibm.ws.threading;version=latest + com.ibm.ws.product.utility;version=latest diff --git a/dev/com.ibm.ws.product.utility_bvt/bnd.bnd.gradle b/dev/com.ibm.ws.product.utility_bvt/bnd.bnd.gradle index df45604f272..27abb02cc16 100755 --- a/dev/com.ibm.ws.product.utility_bvt/bnd.bnd.gradle +++ b/dev/com.ibm.ws.product.utility_bvt/bnd.bnd.gradle @@ -13,4 +13,4 @@ src: \ ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ - com.ibm.ws.threading;version=latest + com.ibm.ws.product.utility;version=latest diff --git a/dev/com.ibm.ws.product.utility_fat/.classpath b/dev/com.ibm.ws.product.utility_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/.classpath.gradle b/dev/com.ibm.ws.product.utility_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/.gitignore b/dev/com.ibm.ws.product.utility_fat/.gitignore new file mode 100644 index 00000000000..106ad11d242 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.gitignore @@ -0,0 +1,5 @@ +bundles +dist +/*.log* +/coverage.ec +/lib diff --git a/dev/com.ibm.ws.product.utility_fat/.project b/dev/com.ibm.ws.product.utility_fat/.project new file mode 100755 index 00000000000..f421c24b889 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.product.utility_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..845c3083c7d --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +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.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c874b581698 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.product.utility_fat/bnd.bnd b/dev/com.ibm.ws.product.utility_fat/bnd.bnd new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.product.utility_fat/bnd.bnd.gradle b/dev/com.ibm.ws.product.utility_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.product.utility_fat/build-test.xml b/dev/com.ibm.ws.product.utility_fat/build-test.xml new file mode 100755 index 00000000000..adf0e26c1ad --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/build-test.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/build.gradle b/dev/com.ibm.ws.product.utility_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_fat/delivery.sets b/dev/com.ibm.ws.product.utility_fat/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/FATSuite.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/FATSuite.java new file mode 100755 index 00000000000..92b28c8f443 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/FATSuite.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ + ProductUtilToolTest.class, + ProductInfoToolTest.class, + ProductInfoValidateTest.class, + ProductInfoLicenseFileTest.class +}) +/** + * Purpose: This suite collects and runs all known good test suites. + */ +public class FATSuite { + +} diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoLicenseFileTest.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoLicenseFileTest.java new file mode 100755 index 00000000000..2adea07dac0 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoLicenseFileTest.java @@ -0,0 +1,205 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Collection; +import java.util.HashSet; +import java.util.Locale; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This class tests that license information and license agreement gets generated properly + */ +public class ProductInfoLicenseFileTest { + + public static final Class c = ProductInfoLicenseFileTest.class; + public static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.info.tool"); + public static String javaExc; + public static String installRoot; + public static final Collection filesToTidy = new HashSet(); + + @Rule + public final TestName method = new TestName(); + + @BeforeClass + public static void before() throws Exception { + setupEnv(LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.info.tool")); + } + + @AfterClass + public static void after() throws Exception { + server.deleteDirectoryFromLibertyInstallRoot("lafiles"); + } + + /** + * Setup the environment. + * + * @param svr The server instance. + * + * @throws Exception + */ + public static void setupEnv(LibertyServer svr) throws Exception { + final String METHOD_NAME = "setup"; + server = svr; + installRoot = server.getInstallRoot(); + javaExc = System.getProperty("java.home") + "/bin/java"; + Log.entering(c, METHOD_NAME); + Log.info(c, METHOD_NAME, "java: " + javaExc); + Log.info(c, METHOD_NAME, "installRoot: " + installRoot); + + // Create a directory to store the output files. + File toolsOutputDir = new File(installRoot + "/tool.output.dir"); + toolsOutputDir.mkdir(); + } + + /** + * Tests that the license information gets generated properly + * + * @throws Exception + */ + @Test + public void testLicenseInformation() throws Exception { + Log.entering(c, method.getMethodName()); + + if (!verifyLicenseFilesExists()) { + Log.info(c, method.getMethodName(), "The lafiles directory does not exist in installdir. Skipping."); + return; + } + + testLicenseInfoContents(installRoot + "/bin/productInfo", new String[] { "viewLicenseInfo" }, installRoot); + Log.exiting(c, method.getMethodName()); + } + + /** + * Tests that the agreement information gets generated properly + * + * @throws Exception + */ + @Test + public void testLicenseAgreement() throws Exception { + Log.entering(c, method.getMethodName()); + + if (!verifyLicenseFilesExists()) { + Log.info(c, method.getMethodName(), "The lafiles directory does not exist in installdir. Skipping."); + return; + } + testLicenseAgreementContents(installRoot + "/bin/productInfo", new String[] { "viewLicenseAgreement" }, installRoot); + Log.exiting(c, method.getMethodName()); + } + + /** + * Tests the command productInfo produces license information correctly + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testLicenseInfoContents(String cmd, String[] parms, String workDir) throws Exception { + Log.entering(c, method.getMethodName()); + + if (!verifyLicenseFilesExists()) { + Log.info(c, method.getMethodName(), "The lafiles directory does not exist in installdir. Skipping."); + return; + } + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po); + assertEquals("License information should be generated", po.getReturnCode(), 0); + + Locale locale = Locale.getDefault(); + String lang = locale.getLanguage(); + Log.info(ProductInfoLicenseFileTest.class, "localelanguage", lang); + + assertTrue("FAIL: License information doesnt exist:", new File(installRoot + "/lafiles/" + "LI_" + lang).exists()); + assertEquals("License locale is not en or not LI:", "LI_" + lang, new File(installRoot + "/lafiles/" + "LI_" + lang).getName()); + Log.exiting(c, method.getMethodName()); + } + + /** + * Tests the command productInfo produces license agreement correctly + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testLicenseAgreementContents(String cmd, String[] parms, String workDir) throws Exception { + Log.entering(c, method.getMethodName()); + + if (!verifyLicenseFilesExists()) { + Log.info(c, method.getMethodName(), "The lafiles directory does not exist in installdir. Skipping."); + return; + } + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po); + assertEquals("License agreement should be generated", po.getReturnCode(), 0); + + Locale locale = Locale.getDefault(); + String lang = locale.getLanguage(); + Log.info(ProductInfoLicenseFileTest.class, "localelanguage", lang); + + assertTrue("FAIL: License agreement doesnt exist:", new File(installRoot + "/lafiles/" + "LA_" + lang).exists()); + assertEquals("License locale is not en or not LA:", "LA_" + lang, new File(installRoot + "/lafiles/" + "LA_" + lang).getName()); + Log.exiting(c, method.getMethodName()); + } + + /** + * Prints an extended debug output. + * + * @param po The programOutput + * @param fileName + * @throws Exception + */ + public void logInfo(ProgramOutput po) throws Exception { + String methodName = "logInfo"; + Log.info(c, methodName, "Return Code: " + po.getReturnCode() + ". STDOUT: " + po.getStdout()); + + if (po.getReturnCode() != 0) { + Log.info(c, methodName, "STDERR: " + po.getStderr()); + } + } + + private boolean verifyLicenseFilesExists() { + boolean licenseFileExists = false; + File folder = new File(installRoot + "/lafiles/"); + + if (folder.exists()) { + for (File fileEntry : folder.listFiles()) { + if (fileEntry.exists() && !(fileEntry.getName().startsWith("com.ibm"))) { + licenseFileExists = true; + } else { + licenseFileExists = false; + } + Log.info(ProductInfoLicenseFileTest.class, method.getMethodName(), fileEntry.getName() + "status:" + licenseFileExists); + } + } + return licenseFileExists; + } +} diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoToolTest.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoToolTest.java new file mode 100755 index 00000000000..c268fe9c82c --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoToolTest.java @@ -0,0 +1,126 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Properties; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServerFactory; + +public class ProductInfoToolTest extends ProductToolTestCommon { + + @BeforeClass + public static void beforeClassSetup() throws Exception { + setupEnv(LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.info.tool")); + setupProductExtensions(SETUP_ALL_PROD_EXTS); + + } + + /** + * Test that productInfo version will display information for all installed products. + * This includes core, product extensions in default usr location and other installed product extensions. + * + * @throws Exception + */ + @Test + public void testProdInfoToolPrintProductVersionForAllProductsInstalled() throws Exception { + testPrintProductVersionForAllProductsInstalled(installRoot + "/bin/productInfo", new String[] { "version" }, installRoot); + } + + /** + * Test that productInfo featureInfo will display a list of all installed features. + * This includes core, product extensions in default usr location and other installed product extensions. + * + * @throws Exception + */ + @Test + public void testProdInfoToolPrintFeatureInfoForAllProductsInstalled() throws Exception { + testPrintFeatureInfoForAllProductsInstalled(installRoot + "/bin/productInfo", new String[] { "featureInfo" }, installRoot); + } + + /** + * Test that productInfo version will display ifix information for all installed products. + * This includes core, product extensions in default usr location and other installed product extensions. + * + * @throws Exception + */ + @Test + public void testProdInfoToolPrintProductVersionIfixesForAllProductsInstalled() throws Exception { + testPrintProductVersionIfixesForAllProductsInstalled(installRoot + "/bin/productInfo", new String[] { "version", "--ifixes" }, installRoot); + } + + /** + * + * Tests the command that lists the installed features for all products installed + * does not have duplicates in the list. + * + * @throws Exception + */ + @Test + public void testPrintFeatureInfoForAllProductsInstalledNoDuplicates() throws Exception { + final String METHOD_NAME = "testPrintFeatureInfoForAllProductsInstalledNoDuplicates"; + Log.entering(c, METHOD_NAME); + String cmd = installRoot + "/bin/productInfo"; + String[] parms = new String[] { "featureInfo" }; + + ProgramOutput po = server.getMachine().execute(cmd, parms, installRoot); + logInfo(po); + String stdout = po.getStdout(); + assertTrue("The output should contain only one copy of the usr product feature: usertest-1.0 [1.0.0].", + stdout.indexOf("usertest [1.0.0]") == stdout.lastIndexOf("usertest [1.0.0]")); + assertTrue("The output should contain only one copy of the product feature: prodtest-1.0 [1.0.0].", + stdout.indexOf("prodtest-1.0 [1.0.0]") == stdout.lastIndexOf("prodtest-1.0 [1.0.0]")); + assertTrue("The output should contain only one copy of the core features: check servlet-3.0 [1.0.0].", + stdout.indexOf("servlet-3.0 [1.0.0]") == stdout.lastIndexOf("servlet-3.0 [1.0.0]")); + + Log.exiting(c, METHOD_NAME); + } + + @Test + /** + * This test validates that the productInfo script functions correctly when the CDPATH environment variable + * is present. + * + * @throws Exception + */ + public void testProdInfoToolWithCDPATH() throws Exception { + final String METHOD_NAME = "testProdInfoToolWithCDPATH"; + Log.entering(c, METHOD_NAME); + + // issuing the command from the Liberty install root while supplying the bin directory as + // part of the command itself causes the productInfo script to cd to the bin directory, which + // is where we noticed problems when CDPATH is set + String executionDir = server.getInstallRoot(); + String command = "bin" + File.separator + "productInfo"; + + String[] parms = new String[1]; + parms[0] = "version"; + + Properties envVars = new Properties(); + envVars.put("CDPATH", "."); + + ProgramOutput po = server.getMachine().execute(command, parms, executionDir, envVars); + Log.info(c, METHOD_NAME, "stdout = " + po.getStdout()); + Log.info(c, METHOD_NAME, "stderr = " + po.getStderr()); + + assertTrue("productInfo does not contain the correct output", po.getStdout().contains("Product name")); + + Log.exiting(c, METHOD_NAME); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoValidateTest.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoValidateTest.java new file mode 100755 index 00000000000..293023ead7c --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductInfoValidateTest.java @@ -0,0 +1,67 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import static org.junit.Assert.assertTrue; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class ProductInfoValidateTest { + + public static Class c = ProductInfoValidateTest.class; + //don't really need a server for this test, but need to get the install paths + public static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.product.utility.test.validate.server"); + + private static String installRoot; + + @BeforeClass + public static void setup() throws Exception { + final String METHOD_NAME = "setup"; + installRoot = server.getInstallRoot(); + Log.entering(c, METHOD_NAME); + Log.info(c, METHOD_NAME, "installRoot: " + installRoot); + } + + /** + * Tests that we can run the productInfo validate command without exception. + * Does not verify the output of the command, only that there were no exceptions + * during the run of the command. + * + * @throws Exception + */ + @Test + public void testProductInfoValidate() throws Exception { + final String METHOD_NAME = "testProductInfoValidate"; + Log.entering(c, METHOD_NAME); + String cmd = installRoot + "/bin/productInfo"; + String[] parms = new String[] { "validate" }; + + ProgramOutput po = server.getMachine().execute(cmd, parms, installRoot); + Log.info(c, METHOD_NAME, "productInfo validate stdout: "); + Log.info(c, METHOD_NAME, po.getStdout()); + Log.info(c, METHOD_NAME, "productInfo validate stderr: "); + Log.info(c, METHOD_NAME, po.getStderr()); + assertTrue("The productInfo validate command returned an error code, see autoFVT/results/output.txt log for detailed output", po.getReturnCode() == 0); + + Log.exiting(c, METHOD_NAME); + } + +} diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductToolTestCommon.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductToolTestCommon.java new file mode 100755 index 00000000000..729cef8cb77 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductToolTestCommon.java @@ -0,0 +1,265 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Collection; +import java.util.HashSet; + +import org.junit.AfterClass; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; + +/** + * + */ +public abstract class ProductToolTestCommon { + public static final Class c = ProductToolTestCommon.class; + public static LibertyServer server; + public static String javaExc; + public static String installRoot; + + // ETC product extension related variables. + public static final String PRODUCT_FEATURE_PATH = "producttest/lib/features/"; + public static final String PRODUCT_VERSIONS_PATH = "producttest/lib/versions/"; + public static final String PRODUCT_BUNDLE_PATH = "producttest/lib/"; + public static final String PRODUCT_EXTENSIONS_PATH = "etc/extensions/"; + public static final String PRODUCT_FEATURE_PROPERTIES_FILE = "testproduct.properties"; + public static final String PRODUCT_VERSIONS_PROPERTIES_FILE = "producttest.properties"; + public static final String PRODUCT_FEATURE_PRODTEST_MF = "prodtest-1.0.mf"; + public static final String PRODUCT_FEATURE_PRODTEST_JAR = "com.ibm.ws.prodtest.internal_1.0.jar"; + public static final String PRODUCT_EXT_NAME = "testproduct"; + + // USR product extension related properties: + public static final String USR_PRODUCT_BUNDLE_PATH = "usr/extension/lib/"; + public static final String USR_PRODUCT_FEATURE_PATH = "usr/extension/lib/features/"; + public static final String USR_PRODUCT_VERSIONS_PATH = "usr/extension/lib/versions/"; + public static final String USR_PRODUCT_FEATURE_NAME = "usertest.with.versions.props.file"; + public static final String USR_PRODUCT_FEATURE_MF = "user.ext.version.info.mf"; + public static final String USR_PRODUCT_BUNDLE_JAR = "userProdExt_1.0.0.jar"; + public static final String USR_PRODUCT_VERSIONS_PROPERTIES_FILE = "user.ext.version.info.properties"; + + // Product pre-set return codes as set in: + // com.ibm.ws.kernel.feature.internal.cmdline.ReturnCode, + // com.ibm.ws.kernel.feature.internal.generator.FeatureListOptions. + public static final int PRODUCT_EXT_NOT_FOUND = 26; + public static final int PRODUCT_EXT_NOT_DEFINED = 27; + public static final int PRODUCT_EXT_NO_FEATURES_FOUND = 28; + + // Other variables. + public static final String CORE_PRODUCT_NAME = "core"; + public static final String USR_PRODUCT_NAME = "usr"; + public static final int SETUP_PROD_EXT = 1; + public static final int SETUP_USR_PROD_EXT = 2; + public static final int SETUP_ALL_PROD_EXTS = 3; + public static final Collection filesToTidy = new HashSet(); + + /** + * Setup the environment. + * + * @param svr The server instance. + * + * @throws Exception + */ + public static void setupEnv(LibertyServer svr) throws Exception { + final String METHOD_NAME = "setup"; + server = svr; + installRoot = server.getInstallRoot(); + javaExc = System.getProperty("java.home") + "/bin/java"; + Log.entering(c, METHOD_NAME); + Log.info(c, METHOD_NAME, "java: " + javaExc); + Log.info(c, METHOD_NAME, "installRoot: " + installRoot); + + // Create a directory to store the output files. + File toolsOutputDir = new File(installRoot + "/tool.output.dir"); + toolsOutputDir.mkdir(); + } + + /** + * Setup product extensions. + * + * @param setupOption The option that determines what preset product extension will be installed. + * + * @throws Exception + */ + public static void setupProductExtensions(int setupOption) throws Exception { + final String METHOD_NAME = "setupProductExtensions"; + Log.exiting(c, METHOD_NAME); + boolean setupAll = false; + switch (setupOption) { + case SETUP_ALL_PROD_EXTS: + setupAll = true; + case SETUP_PROD_EXT: + // Copy the product's feature manifest. + server.copyFileToLibertyInstallRoot(PRODUCT_FEATURE_PATH, "productFeatures/" + PRODUCT_FEATURE_PRODTEST_MF); + assertTrue("product feature: " + PRODUCT_FEATURE_PRODTEST_MF + " should have been copied to: " + PRODUCT_FEATURE_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_FEATURE_PATH + PRODUCT_FEATURE_PRODTEST_MF)); + // Copy the product's bundle jar. + server.copyFileToLibertyInstallRoot(PRODUCT_BUNDLE_PATH, "productBundles/" + PRODUCT_FEATURE_PRODTEST_JAR); + assertTrue("product bundle: " + PRODUCT_FEATURE_PRODTEST_JAR + " should have been copied to: " + PRODUCT_BUNDLE_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_BUNDLE_PATH + PRODUCT_FEATURE_PRODTEST_JAR)); + // Copy the product's extension properties file. + server.copyFileToLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH, "productProperties/" + PRODUCT_FEATURE_PROPERTIES_FILE); + assertTrue("product extension props file: " + PRODUCT_FEATURE_PROPERTIES_FILE + " should have been copied to: " + PRODUCT_EXTENSIONS_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_EXTENSIONS_PATH + PRODUCT_FEATURE_PROPERTIES_FILE)); + // Copy the product's version properties file. + server.copyFileToLibertyInstallRoot(PRODUCT_VERSIONS_PATH, "productVersionProperties/" + PRODUCT_VERSIONS_PROPERTIES_FILE); + assertTrue("product version props file: " + PRODUCT_VERSIONS_PROPERTIES_FILE + " should have been copied to: " + PRODUCT_VERSIONS_PATH, + server.fileExistsInLibertyInstallRoot(PRODUCT_VERSIONS_PATH + PRODUCT_VERSIONS_PROPERTIES_FILE)); + + Log.info(c, METHOD_NAME, "Product extension: " + PRODUCT_EXT_NAME + " has been installed."); + if (!setupAll) { + break; + } + case SETUP_USR_PROD_EXT: + // install a (usr) product extension. + ProgramOutput po = server.installFeature(null, USR_PRODUCT_FEATURE_NAME); + String stdout = po.getStdout(); + if (!stdout.contains("CWWKF1000I")) { + assertEquals("The feature: " + USR_PRODUCT_FEATURE_NAME + " should have been installed. stdout:\r\n" + po.getStdout() + "\r\n" + po.getStderr(), 0, + po.getReturnCode()); + } + assertTrue("The " + USR_PRODUCT_FEATURE_MF + " feature manifest should exist.", + server.fileExistsInLibertyInstallRoot(USR_PRODUCT_FEATURE_PATH + USR_PRODUCT_FEATURE_MF)); + assertTrue("The " + USR_PRODUCT_BUNDLE_JAR + " bundle should exist.", server.fileExistsInLibertyInstallRoot(USR_PRODUCT_BUNDLE_PATH + USR_PRODUCT_BUNDLE_JAR)); + assertTrue("The " + USR_PRODUCT_VERSIONS_PROPERTIES_FILE + " bundle should exist.", + server.fileExistsInLibertyInstallRoot(USR_PRODUCT_VERSIONS_PATH + USR_PRODUCT_VERSIONS_PROPERTIES_FILE)); + + Log.info(c, METHOD_NAME, "Product extension: " + USR_PRODUCT_FEATURE_NAME + " has been installed in usr"); + + break; + default: + throw new Exception("Invalid setupOption: " + setupOption); + + } + + Log.exiting(c, METHOD_NAME); + } + + /** + * Cleans up the installation from any files that may have been left around. + * + * @throws Exception + */ + @AfterClass + public static void AfterClassCleanup() throws Exception { + final String METHOD_NAME = "cleanup"; + + Log.entering(c, METHOD_NAME); + + if (server.isStarted()) + server.stopServer(); + + server.deleteDirectoryFromLibertyInstallRoot("usr/extension/"); + server.deleteDirectoryFromLibertyInstallRoot("producttest"); + server.deleteDirectoryFromLibertyInstallRoot("etc/extensions"); + server.deleteDirectoryFromLibertyInstallRoot("tool.output.dir"); + + for (String filePath : filesToTidy) { + server.deleteFileFromLibertyInstallRoot(filePath); + } + filesToTidy.clear(); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the command to print product information such as product name and version. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testPrintProductVersionForAllProductsInstalled(String cmd, String[] parms, String workDir) throws Exception { + final String METHOD_NAME = "testPrintProductVersionForAllProductsInstalled"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po); + String stdout = po.getStdout(); + assertTrue("The output should contain usr product name: XYZ User Product.", stdout.contains("XYZ User Product")); + assertTrue("The output should contain usr product version: 1.0.0.", stdout.contains("1.0.0")); + assertTrue("The output should contain product name: ACMEProductTest.", stdout.contains("ACMEProductTest")); + assertTrue("The output should contain product version: 9.8.8.9.", stdout.contains("9.8.8.9")); + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the command to print product information such as product name and version. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testPrintProductVersionIfixesForAllProductsInstalled(String cmd, String[] parms, String workDir) throws Exception { + final String METHOD_NAME = "testPrintProductVersionForAllProductsInstalled"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po); + String stdout = po.getStdout(); + assertTrue("The output should contain usr product name: XYZ User Product.", stdout.contains("XYZ User Product")); + assertTrue("The output should contain usr product version: 1.0.0.", stdout.contains("1.0.0")); + assertTrue("The output should contain product name: ACMEProductTest.", stdout.contains("ACMEProductTest")); + assertTrue("The output should contain product version: 9.8.8.9.", stdout.contains("9.8.8.9")); + Log.exiting(c, METHOD_NAME); + } + + /** + * Tests the command that list the installed features for all products installed. + * + * @param cmd The command to execute. + * @param parms The parameters for the command. + * @param workDir The working directory where the command is to be issued. + * + * @throws Exception + */ + public void testPrintFeatureInfoForAllProductsInstalled(String cmd, String[] parms, String workDir) throws Exception { + final String METHOD_NAME = "testPrintFeatureInfoForAllProductsInstalled"; + Log.entering(c, METHOD_NAME); + + ProgramOutput po = server.getMachine().execute(cmd, parms, workDir); + logInfo(po); + String stdout = po.getStdout(); + assertTrue("The output should contain usr product feature heading: Product Extension: usr.", stdout.contains("Product Extension: usr")); + assertTrue("The output should contain usr product feature: user.ext.version.info [1.0.0].", stdout.contains("user.ext.version.info [1.0.0]")); + assertTrue("The output should contain product feature heading: Product Extension: testproduct.", stdout.contains("Product Extension: testproduct")); + assertTrue("The output should contain product feature: prodtest-1.0 [1.0.0].", stdout.contains("prodtest-1.0 [1.0.0]")); + + Log.exiting(c, METHOD_NAME); + } + + /** + * Prints an extended debug output. + * + * @param po The programOutput + * @param fileName + * @throws Exception + */ + public void logInfo(ProgramOutput po) throws Exception { + String methodName = "logInfo"; + Log.info(c, methodName, "Return Code: " + po.getReturnCode() + ". STDOUT: " + po.getStdout()); + + if (po.getReturnCode() != 0) { + Log.info(c, methodName, "STDERR: " + po.getStderr()); + } + } +} diff --git a/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductUtilToolTest.java b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductUtilToolTest.java new file mode 100755 index 00000000000..f84806da31b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/fat/src/com/ibm/ws/product/utility/fat/ProductUtilToolTest.java @@ -0,0 +1,53 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.fat; + +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServerFactory; + +public class ProductUtilToolTest extends ProductToolTestCommon { + + @BeforeClass + public static void beforeClassSetup() throws Exception { + setupEnv(LibertyServerFactory.getLibertyServer("com.ibm.ws.kernel.feature.fat.util.tool")); + setupProductExtensions(SETUP_ALL_PROD_EXTS); + + } + + /** + * Test that ws-productutil.jar version will display information for all installed products. + * This includes core, product extensions in default usr location and other installed product extensions. + * + * @throws Exception + */ + @Test + public void testProdUtilToolPrintProductVersionForAllProductsInstalled() throws Exception { + testPrintProductVersionForAllProductsInstalled(javaExc, + new String[] { "-jar", installRoot + "/bin/tools/ws-productutil.jar", "version" }, + installRoot); + } + + /** + * Test that ws-productutil.jar featureInfo will display a list of all installed features. + * This includes core, product extensions in default usr location and other installed product extensions. + * + * @throws Exception + */ + @Test + public void testProdUtilToolPrintFeatureInfoForAllProductsInstalled() throws Exception { + testPrintFeatureInfoForAllProductsInstalled(javaExc, + new String[] { "-jar", installRoot + "/bin/tools/ws-productutil.jar", "featureInfo" }, + installRoot); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.esa b/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.esa new file mode 100755 index 00000000000..05653fcc822 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.esa differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.with.versions.props.file.esa b/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.with.versions.props.file.esa new file mode 100755 index 00000000000..284b5458db4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/features/usertest.with.versions.props.file.esa differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_cs b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_cs new file mode 100755 index 00000000000..04cdb53a945 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_cs differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_de b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_de new file mode 100755 index 00000000000..06e0bfa021f Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_de differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_el b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_el new file mode 100755 index 00000000000..bfaab3fb744 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_el differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_en b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_en new file mode 100755 index 00000000000..862d183280c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_en differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_es b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_es new file mode 100755 index 00000000000..6bbe59a266c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_es differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_fr b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_fr new file mode 100755 index 00000000000..120b31ca869 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_fr differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_in b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_in new file mode 100755 index 00000000000..ad7a5b2e495 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_in differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_it b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_it new file mode 100755 index 00000000000..faff1a330d4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_it differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ja b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ja new file mode 100755 index 00000000000..1df9b49079a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ja differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ko b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ko new file mode 100755 index 00000000000..7e31f7fc242 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ko differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_lt b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_lt new file mode 100755 index 00000000000..4108a4badcc Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_lt differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pl b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pl new file mode 100755 index 00000000000..3152ccb3a35 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pl differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pt b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pt new file mode 100755 index 00000000000..3fccbeffa8c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_pt differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ru b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ru new file mode 100755 index 00000000000..01ba7e0d52c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_ru differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_sl b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_sl new file mode 100755 index 00000000000..e63dd4789b3 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_sl differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_tr b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_tr new file mode 100755 index 00000000000..c80dafb18df Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_tr differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh new file mode 100755 index 00000000000..beeb8557b10 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh_TW b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh_TW new file mode 100755 index 00000000000..9f95d22b82e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LA_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_cs b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_cs new file mode 100755 index 00000000000..2e9618e0d5c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_cs differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_de b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_de new file mode 100755 index 00000000000..bbe9181847b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_de differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_el b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_el new file mode 100755 index 00000000000..6829b8fea29 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_el differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_en b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_en new file mode 100755 index 00000000000..431157f0e0e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_en differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_es b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_es new file mode 100755 index 00000000000..0e42d4c4eb5 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_es differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_fr b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_fr new file mode 100755 index 00000000000..20bf2fac823 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_fr differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_in b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_in new file mode 100755 index 00000000000..f793986fe27 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_in differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_it b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_it new file mode 100755 index 00000000000..4dec02ff3d4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_it differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ja b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ja new file mode 100755 index 00000000000..dcfa4c21f68 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ja differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ko b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ko new file mode 100755 index 00000000000..952cccb8115 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ko differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_lt b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_lt new file mode 100755 index 00000000000..a2b4cfcec4a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_lt differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pl b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pl new file mode 100755 index 00000000000..6f59bf8cb61 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pl differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pt b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pt new file mode 100755 index 00000000000..e9e5f1db403 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_pt differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ru b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ru new file mode 100755 index 00000000000..a8c645ca2aa Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_ru differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_sl b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_sl new file mode 100755 index 00000000000..c42d8c30ef0 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_sl differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_tr b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_tr new file mode 100755 index 00000000000..aff41b0d16d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_tr differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh new file mode 100755 index 00000000000..32f29d044b2 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh_TW b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh_TW new file mode 100755 index 00000000000..1a3124ab929 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/LI_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/notices b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/notices new file mode 100755 index 00000000000..accdd6bba9d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/lafiles/notices differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/productBundles/com.ibm.ws.prodtest.internal_1.0.jar b/dev/com.ibm.ws.product.utility_fat/publish/files/productBundles/com.ibm.ws.prodtest.internal_1.0.jar new file mode 100755 index 00000000000..85a6fa4f6ad Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/publish/files/productBundles/com.ibm.ws.prodtest.internal_1.0.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/productFeatures/prodtest-1.0.mf b/dev/com.ibm.ws.product.utility_fat/publish/files/productFeatures/prodtest-1.0.mf new file mode 100755 index 00000000000..21b5ef9153b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/files/productFeatures/prodtest-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: prodtest-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: com.ibm.ws.prodtest.internal; location:="lib/com.ibm.ws.prodtest.internal_1.0.jar" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/productProperties/testproduct.properties b/dev/com.ibm.ws.product.utility_fat/publish/files/productProperties/testproduct.properties new file mode 100755 index 00000000000..1b80aa40d23 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/files/productProperties/testproduct.properties @@ -0,0 +1,2 @@ +com.ibm.websphere.productId=bigProduct +com.ibm.websphere.productInstall=wlp/producttest/ diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/producttest.properties b/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/producttest.properties new file mode 100755 index 00000000000..d7bc0dcba66 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/producttest.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.acme.product.test +com.ibm.websphere.productOwner=ACME +com.ibm.websphere.productVersion=9.8.8.9 +com.ibm.websphere.productName=ACMEProductTest +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/usertest.properties b/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/usertest.properties new file mode 100755 index 00000000000..ac6e3e932b6 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/files/productVersionProperties/usertest.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.acme.user.test +com.ibm.websphere.productOwner=ACME +com.ibm.websphere.productVersion=8.7.7.8 +com.ibm.websphere.productName=ACMEUserTest +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.info.tool/bootstrap.properties b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.info.tool/bootstrap.properties new file mode 100755 index 00000000000..a809f012e2e --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.info.tool/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.util.tool/bootstrap.properties b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.util.tool/bootstrap.properties new file mode 100755 index 00000000000..a809f012e2e --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.kernel.feature.fat.util.tool/bootstrap.properties @@ -0,0 +1,2 @@ +com.ibm.ws.kernel.feature.enforce.public=true +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.product.utility.test.validate.server/bootstrap.properties b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.product.utility.test.validate.server/bootstrap.properties new file mode 100755 index 00000000000..4f1ae5a2e10 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/publish/servers/com.ibm.ws.product.utility.test.validate.server/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_cs b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_cs new file mode 100755 index 00000000000..04cdb53a945 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_cs differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_de b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_de new file mode 100755 index 00000000000..06e0bfa021f Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_de differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_el b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_el new file mode 100755 index 00000000000..bfaab3fb744 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_el differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_en b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_en new file mode 100755 index 00000000000..862d183280c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_en differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_es b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_es new file mode 100755 index 00000000000..6bbe59a266c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_es differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_fr b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_fr new file mode 100755 index 00000000000..120b31ca869 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_fr differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_in b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_in new file mode 100755 index 00000000000..ad7a5b2e495 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_in differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_it b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_it new file mode 100755 index 00000000000..faff1a330d4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_it differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ja b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ja new file mode 100755 index 00000000000..1df9b49079a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ja differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ko b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ko new file mode 100755 index 00000000000..7e31f7fc242 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ko differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_lt b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_lt new file mode 100755 index 00000000000..4108a4badcc Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_lt differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pl b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pl new file mode 100755 index 00000000000..3152ccb3a35 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pl differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pt b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pt new file mode 100755 index 00000000000..3fccbeffa8c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_pt differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ru b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ru new file mode 100755 index 00000000000..01ba7e0d52c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_ru differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_sl b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_sl new file mode 100755 index 00000000000..e63dd4789b3 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_sl differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_tr b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_tr new file mode 100755 index 00000000000..c80dafb18df Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_tr differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh new file mode 100755 index 00000000000..beeb8557b10 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh_TW b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh_TW new file mode 100755 index 00000000000..9f95d22b82e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LA_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_cs b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_cs new file mode 100755 index 00000000000..2e9618e0d5c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_cs differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_de b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_de new file mode 100755 index 00000000000..bbe9181847b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_de differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_el b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_el new file mode 100755 index 00000000000..6829b8fea29 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_el differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_en b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_en new file mode 100755 index 00000000000..431157f0e0e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_en differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_es b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_es new file mode 100755 index 00000000000..0e42d4c4eb5 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_es differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_fr b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_fr new file mode 100755 index 00000000000..20bf2fac823 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_fr differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_in b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_in new file mode 100755 index 00000000000..f793986fe27 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_in differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_it b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_it new file mode 100755 index 00000000000..4dec02ff3d4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_it differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ja b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ja new file mode 100755 index 00000000000..dcfa4c21f68 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ja differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ko b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ko new file mode 100755 index 00000000000..952cccb8115 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ko differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_lt b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_lt new file mode 100755 index 00000000000..a2b4cfcec4a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_lt differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pl b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pl new file mode 100755 index 00000000000..6f59bf8cb61 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pl differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pt b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pt new file mode 100755 index 00000000000..e9e5f1db403 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_pt differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ru b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ru new file mode 100755 index 00000000000..a8c645ca2aa Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_ru differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_sl b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_sl new file mode 100755 index 00000000000..c42d8c30ef0 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_sl differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_tr b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_tr new file mode 100755 index 00000000000..aff41b0d16d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_tr differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh new file mode 100755 index 00000000000..32f29d044b2 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh_TW b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh_TW new file mode 100755 index 00000000000..1a3124ab929 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/LI_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/notices b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/notices new file mode 100755 index 00000000000..accdd6bba9d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/notices differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testFile b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testFile new file mode 100755 index 00000000000..0c8ec66607e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testFile differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testfile1 b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testfile1 new file mode 100755 index 00000000000..d22d8a162c1 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/lafiles/testfile1 differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/md5Tests/TestFile.txt b/dev/com.ibm.ws.product.utility_fat/resources/md5Tests/TestFile.txt new file mode 100755 index 00000000000..bce167b4099 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/md5Tests/TestFile.txt @@ -0,0 +1 @@ +Please do *NOT* change the content of this file! \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/TwoAparsArchiveFixPack.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/TwoAparsArchiveFixPack.jar new file mode 100755 index 00000000000..73df83be1d0 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/TwoAparsArchiveFixPack.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/fixes/badDate.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/fixes/badDate.xml new file mode 100755 index 00000000000..6f06ddbca5b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/fixes/badDate.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip new file mode 100755 index 00000000000..81647df3695 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar new file mode 100755 index 00000000000..3223d5164dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml new file mode 100755 index 00000000000..772a4570186 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix with a missing file + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..abbcb9ca0dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..1b4b6ef8dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/fixes/noApar.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/fixes/noApar.xml new file mode 100755 index 00000000000..521da57aa08 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/fixes/noApar.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + iFix with no problem element so not apar list + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/foo.txt b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/foo.txt new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..abbcb9ca0dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..1b4b6ef8dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml new file mode 100755 index 00000000000..c6d82afacfd --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml @@ -0,0 +1,17 @@ + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/foo.txt b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/foo.txt new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml new file mode 100755 index 00000000000..0c75511c557 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/foo.txt b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/foo.txt new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties new file mode 100755 index 00000000000..c98455a766d --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.other +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=Other Product +com.ibm.websphere.productInstallType= +com.ibm.websphere.productEdition= \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml new file mode 100755 index 00000000000..43d13f99705 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix with a static file who's date is a long way into the future so the file will be older and therefore not valid + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/foo.txt b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/foo.txt new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..abbcb9ca0dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..1b4b6ef8dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml new file mode 100755 index 00000000000..c2f9394e9f3 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix that is applicable to an old version of WAS + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/foo.txt b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/foo.txt new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..abbcb9ca0dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..1b4b6ef8dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip new file mode 100755 index 00000000000..b998aa53dcd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar new file mode 100755 index 00000000000..3223d5164dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar new file mode 100755 index 00000000000..3223d5164dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml new file mode 100755 index 00000000000..bc373d18ca8 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..098bb14b19b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..831626ac335 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar new file mode 100755 index 00000000000..3223d5164dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar new file mode 100755 index 00000000000..3223d5164dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml new file mode 100755 index 00000000000..bc373d18ca8 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml new file mode 100755 index 00000000000..ce99d7e52cf --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + iFix 2 with one APAR + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..098bb14b19b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..831626ac335 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_fat/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/.classpath b/dev/com.ibm.ws.product.utility_test/.classpath new file mode 100644 index 00000000000..bd880329225 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/.classpath.gradle b/dev/com.ibm.ws.product.utility_test/.classpath.gradle new file mode 100644 index 00000000000..bd880329225 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/.gitignore b/dev/com.ibm.ws.product.utility_test/.gitignore new file mode 100644 index 00000000000..106ad11d242 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.gitignore @@ -0,0 +1,5 @@ +bundles +dist +/*.log* +/coverage.ec +/lib diff --git a/dev/com.ibm.ws.product.utility_test/.project b/dev/com.ibm.ws.product.utility_test/.project new file mode 100755 index 00000000000..019b18480f0 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.product.utility_test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..845c3083c7d --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +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.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c874b581698 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.product.utility_test/bnd.bnd b/dev/com.ibm.ws.product.utility_test/bnd.bnd new file mode 100755 index 00000000000..f8cbc41aa16 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/bnd.bnd @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.logging.core;version=latest, \ + com.ibm.ws.product.utility;version=latest diff --git a/dev/com.ibm.ws.product.utility_test/bnd.bnd.gradle b/dev/com.ibm.ws.product.utility_test/bnd.bnd.gradle new file mode 100755 index 00000000000..f8cbc41aa16 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/bnd.bnd.gradle @@ -0,0 +1,22 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.logging.core;version=latest, \ + com.ibm.ws.product.utility;version=latest diff --git a/dev/com.ibm.ws.product.utility_test/build-unittest.xml b/dev/com.ibm.ws.product.utility_test/build-unittest.xml new file mode 100755 index 00000000000..4d6b82ee7c5 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/build-unittest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_test/build.gradle b/dev/com.ibm.ws.product.utility_test/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_test/delivery.sets b/dev/com.ibm.ws.product.utility_test/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_cs b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_cs new file mode 100755 index 00000000000..04cdb53a945 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_cs differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_de b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_de new file mode 100755 index 00000000000..06e0bfa021f Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_de differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_el b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_el new file mode 100755 index 00000000000..bfaab3fb744 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_el differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_en b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_en new file mode 100755 index 00000000000..862d183280c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_en differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_es b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_es new file mode 100755 index 00000000000..6bbe59a266c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_es differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_fr b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_fr new file mode 100755 index 00000000000..120b31ca869 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_fr differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_in b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_in new file mode 100755 index 00000000000..ad7a5b2e495 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_in differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_it b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_it new file mode 100755 index 00000000000..faff1a330d4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_it differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ja b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ja new file mode 100755 index 00000000000..1df9b49079a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ja differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ko b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ko new file mode 100755 index 00000000000..7e31f7fc242 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ko differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_lt b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_lt new file mode 100755 index 00000000000..4108a4badcc Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_lt differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pl b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pl new file mode 100755 index 00000000000..3152ccb3a35 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pl differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pt b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pt new file mode 100755 index 00000000000..3fccbeffa8c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_pt differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ru b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ru new file mode 100755 index 00000000000..01ba7e0d52c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_ru differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_sl b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_sl new file mode 100755 index 00000000000..e63dd4789b3 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_sl differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_tr b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_tr new file mode 100755 index 00000000000..c80dafb18df Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_tr differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh new file mode 100755 index 00000000000..beeb8557b10 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh_TW b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh_TW new file mode 100755 index 00000000000..9f95d22b82e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LA_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_cs b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_cs new file mode 100755 index 00000000000..2e9618e0d5c Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_cs differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_de b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_de new file mode 100755 index 00000000000..bbe9181847b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_de differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_el b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_el new file mode 100755 index 00000000000..6829b8fea29 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_el differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_en b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_en new file mode 100755 index 00000000000..431157f0e0e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_en differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_es b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_es new file mode 100755 index 00000000000..0e42d4c4eb5 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_es differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_fr b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_fr new file mode 100755 index 00000000000..20bf2fac823 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_fr differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_in b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_in new file mode 100755 index 00000000000..f793986fe27 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_in differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_it b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_it new file mode 100755 index 00000000000..4dec02ff3d4 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_it differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ja b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ja new file mode 100755 index 00000000000..dcfa4c21f68 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ja differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ko b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ko new file mode 100755 index 00000000000..952cccb8115 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ko differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_lt b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_lt new file mode 100755 index 00000000000..a2b4cfcec4a Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_lt differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pl b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pl new file mode 100755 index 00000000000..6f59bf8cb61 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pl differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pt b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pt new file mode 100755 index 00000000000..e9e5f1db403 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_pt differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ru b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ru new file mode 100755 index 00000000000..a8c645ca2aa Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_ru differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_sl b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_sl new file mode 100755 index 00000000000..c42d8c30ef0 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_sl differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_tr b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_tr new file mode 100755 index 00000000000..aff41b0d16d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_tr differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh new file mode 100755 index 00000000000..32f29d044b2 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh_TW b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh_TW new file mode 100755 index 00000000000..1a3124ab929 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/LI_zh_TW differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/notices b/dev/com.ibm.ws.product.utility_test/resources/lafiles/notices new file mode 100755 index 00000000000..accdd6bba9d Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/notices differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/testFile b/dev/com.ibm.ws.product.utility_test/resources/lafiles/testFile new file mode 100755 index 00000000000..0c8ec66607e Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/testFile differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/lafiles/testfile1 b/dev/com.ibm.ws.product.utility_test/resources/lafiles/testfile1 new file mode 100755 index 00000000000..d22d8a162c1 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/lafiles/testfile1 differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/md5Tests/TestFile.txt b/dev/com.ibm.ws.product.utility_test/resources/md5Tests/TestFile.txt new file mode 100755 index 00000000000..bce167b4099 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/md5Tests/TestFile.txt @@ -0,0 +1 @@ +Please do *NOT* change the content of this file! \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/TwoAparsArchiveFixPack.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/TwoAparsArchiveFixPack.jar new file mode 100755 index 00000000000..73df83be1d0 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/TwoAparsArchiveFixPack.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/fixes/badDate.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/fixes/badDate.xml new file mode 100755 index 00000000000..6f06ddbca5b --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/fixes/badDate.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/badDate/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip new file mode 100755 index 00000000000..81647df3695 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/invalidZip/lib/versions/wlp_fp8509_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar new file mode 100755 index 00000000000..3223d5164dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/a_1.1.0.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml new file mode 100755 index 00000000000..772a4570186 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/fixes/missingFeatureJar.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix with a missing file + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..abbcb9ca0dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..1b4b6ef8dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/missingFeatureJar/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/fixes/noApar.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/fixes/noApar.xml new file mode 100755 index 00000000000..521da57aa08 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/fixes/noApar.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + iFix with no problem element so not apar list + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/foo.txt b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/foo.txt new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..abbcb9ca0dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..1b4b6ef8dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noApar/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml new file mode 100755 index 00000000000..c6d82afacfd --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/fixes/noOffering.xml @@ -0,0 +1,17 @@ + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/foo.txt b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/foo.txt new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noOffering/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml new file mode 100755 index 00000000000..0c75511c557 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/fixes/noProperties.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/foo.txt b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/foo.txt new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties new file mode 100755 index 00000000000..c98455a766d --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/noProperties/lib/versions/OtherProps.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.other +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=Other Product +com.ibm.websphere.productInstallType= +com.ibm.websphere.productEdition= \ No newline at end of file diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml new file mode 100755 index 00000000000..43d13f99705 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/fixes/oldStaticFile.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix with a static file who's date is a long way into the future so the file will be older and therefore not valid + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/foo.txt b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/foo.txt new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..abbcb9ca0dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..1b4b6ef8dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldStaticFile/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml new file mode 100755 index 00000000000..c2f9394e9f3 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/fixes/oldStaticFile.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + iFix that is applicable to an old version of WAS + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/foo.txt b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/foo.txt new file mode 100755 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..abbcb9ca0dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..1b4b6ef8dd9 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oldVersion/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip new file mode 100755 index 00000000000..b998aa53dcd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneFixPackThreeApars/lib/versions/wlp_fp8505_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar new file mode 100755 index 00000000000..3223d5164dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/a_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar new file mode 100755 index 00000000000..3223d5164dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/b_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml new file mode 100755 index 00000000000..bc373d18ca8 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/fixes/iFix1.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..098bb14b19b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..831626ac335 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/oneIFixTwoFP/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar new file mode 100755 index 00000000000..3223d5164dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/a_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar new file mode 100755 index 00000000000..3223d5164dd Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/b_1.1.0.v20120424-1542.jar differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml new file mode 100755 index 00000000000..bc373d18ca8 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + iFix 1 with two APARs + + + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml new file mode 100755 index 00000000000..ce99d7e52cf --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix2.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + iFix 2 with one APAR + + + + + + + + + diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties new file mode 100755 index 00000000000..ad8cd7d7339 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/WebSphereApplicationServer.properties @@ -0,0 +1,6 @@ +com.ibm.websphere.productId=com.ibm.websphere.appserver +com.ibm.websphere.productOwner=IBM +com.ibm.websphere.productVersion=8.5.0.0 +com.ibm.websphere.productName=WebSphere Application Server +com.ibm.websphere.productInstallType=Archive +com.ibm.websphere.productEdition= diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip new file mode 100755 index 00000000000..098bb14b19b Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8501_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip new file mode 100755 index 00000000000..831626ac335 Binary files /dev/null and b/dev/com.ibm.ws.product.utility_test/resources/mockInstalls/twoIFixesThreeAparsTwoFP/lib/versions/wlp_fp8502_aparIds.zip differ diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/BaseCommandTaskTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/BaseCommandTaskTest.java new file mode 100755 index 00000000000..89e2377f3ab --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/BaseCommandTaskTest.java @@ -0,0 +1,164 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.Test; + +import junit.framework.Assert; + +public class BaseCommandTaskTest { + private static final String SUPPORTED_OPTION = "--supportedOption"; + private static final String BAD_PREFIX_OPTION = "attemptToSupportOptionWithBadPrefix"; + private static final String TOTALLY_UNSUPPORTED_OPTION = "GIBBERISH!$!^@$@%$"; + private static final String SUCCESS_MESSAGE = "SUCCESS!"; + + private final Mockery mock = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + + private final CommandConsole commandConsole = mock.mock(CommandConsole.class, "commandConsole"); + + /* + * The test command should only print a success message because no options should be detected. + */ + @Test + public void testNoOptions() { + ExecutionContextImpl context = createExecutionContext(new String[] {}); + mock.checking(new Expectations() { + { + one(commandConsole).printlnInfoMessage(SUCCESS_MESSAGE); + } + }); + new TestCommandTask().execute(context); + } + + /* + * The test command should indicate that it found the supported option but it should not detect a + * value for it. + */ + @Test + public void testSupportedOptionNoValue() { + ExecutionContextImpl context = createExecutionContext(new String[] { SUPPORTED_OPTION }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnInfoMessage("found" + SUPPORTED_OPTION); + one(commandConsole).printlnInfoMessage(SUCCESS_MESSAGE); + } + }); + new TestCommandTask().execute(context); + } + + /* + * The test command should indicate that it found the supported option AND that it has an associated + * value. + */ + @Test + public void testSupportedOptionWithValue() { + ExecutionContextImpl context = createExecutionContext(new String[] { SUPPORTED_OPTION + "=test" }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnInfoMessage("found" + SUPPORTED_OPTION); + one(commandConsole).printlnInfoMessage("value=test"); + one(commandConsole).printlnInfoMessage(SUCCESS_MESSAGE); + } + }); + new TestCommandTask().execute(context); + } + + /* + * This one is a bit tricky. The test command is *claiming* that it supports BAD_PREFIX_OPTION (look at the + * "getSupportedOptions" method), but the expected result is that BAD_PREFIX_OPTION should not pass validation + * and should result in an error message. This is to protect against developers who add future command tasks and + * who aren't aware that all options should be standardized and start with the "--" prefix. They might code their + * command task to support an option without the appropriate prefix, but the command will not actually work. + */ + @Test + public void testBadPrefixOption() { + ExecutionContextImpl context = createExecutionContext(new String[] { SUPPORTED_OPTION + "=test", BAD_PREFIX_OPTION }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnErrorMessage("CWWKE0514E: An invalid option, " + BAD_PREFIX_OPTION + ", was supplied on the command line. Valid options are: [--output, " + SUPPORTED_OPTION + "]"); + } + }); + new TestCommandTask().execute(context); + } + + /** + * Obviously, since the user is passing in a totally unsupported option, the test should complain about it. + */ + @Test + public void testTotallyUnsupportedOption() { + ExecutionContextImpl context = createExecutionContext(new String[] { SUPPORTED_OPTION + "=test", TOTALLY_UNSUPPORTED_OPTION }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnErrorMessage("CWWKE0514E: An invalid option, " + TOTALLY_UNSUPPORTED_OPTION + ", was supplied on the command line. Valid options are: [--output, " + SUPPORTED_OPTION + "]"); + } + }); + new TestCommandTask().execute(context); + } + + private ExecutionContextImpl createExecutionContext(String[] args) { + ExecutionContextImpl context = new ExecutionContextImpl(commandConsole, args, null); + return context; + } + + public static class TestCommandTask extends BaseCommandTask { + /** {@inheritDoc} */ + @Override + public Set getSupportedOptions() { + return new HashSet(Arrays.asList(SUPPORTED_OPTION, + BAD_PREFIX_OPTION)); + } + + /** {@inheritDoc} */ + @Override + public String getTaskName() { + return null; + } + + /** {@inheritDoc} */ + @Override + public String getTaskDescription() { + return null; + } + + /** {@inheritDoc} */ + @Override + public String getTaskHelp() { + return null; + } + + /** {@inheritDoc} */ + @Override + public void doExecute(ExecutionContext context) { + if (context.optionExists(SUPPORTED_OPTION)) { + context.getCommandConsole().printlnInfoMessage("found" + SUPPORTED_OPTION); + String value = context.getOptionValue(SUPPORTED_OPTION); + if (value != null && !value.isEmpty()) { + context.getCommandConsole().printlnInfoMessage("value=" + value); + } + } + Assert.assertFalse("Option " + BAD_PREFIX_OPTION + " should not exist", context.optionExists(BAD_PREFIX_OPTION)); + context.getCommandConsole().printlnInfoMessage(SUCCESS_MESSAGE); + } + } +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/ExecutionContextTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/ExecutionContextTest.java new file mode 100755 index 00000000000..cbc777d3db6 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/ExecutionContextTest.java @@ -0,0 +1,58 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility; + +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.Test; + +import junit.framework.Assert; + +public class ExecutionContextTest { + + private final Mockery mock = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + + private final CommandConsole commandConsole = mock.mock(CommandConsole.class, "commandConsole"); + + private final CommandTaskRegistry commandTaskRegistry = new CommandTaskRegistry(); + + @Test + public void testParsingOptions() throws Exception { + String[] arguments = { "--help", "--output=a.txt", "--encode=us", "abc" }; + ExecutionContext executionContext = createExecutionContext(arguments); + Assert.assertEquals("The expected option value of --output should be a.txt", "a.txt", executionContext.getOptionValue("--output")); + Assert.assertEquals("The expected option value of --encode should be us", "us", executionContext.getOptionValue("--encode")); + + Assert.assertTrue("The --help option should exist in the parsed result", executionContext.optionExists("--help")); + Assert.assertTrue("The abc option should exist in the parsed result", executionContext.optionExists("abc")); + + Assert.assertFalse("The --INVALID should not exist in the parsed result", executionContext.optionExists("--INVALID")); + } + + @Test + public void testEmptyParsingOptions() throws Exception { + String[] arguments = {}; + ExecutionContext executionContext = createExecutionContext(arguments); + Assert.assertFalse("The --INVALID should not be existing in the parsed result", executionContext.optionExists("--INVALID")); + Assert.assertFalse("The abc should not be existing in the parsed result", executionContext.optionExists("abc")); + } + + private ExecutionContext createExecutionContext(String[] args) { + return new ExecutionContextImpl(commandConsole, args, commandTaskRegistry); + } + +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/HelpCommandTaskTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/HelpCommandTaskTest.java new file mode 100755 index 00000000000..68572f6d9c1 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/HelpCommandTaskTest.java @@ -0,0 +1,126 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility; + +import java.util.HashSet; +import java.util.Set; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.ibm.ws.product.utility.extension.HelpCommandTask; + +public class HelpCommandTaskTest { + + private final Mockery mock = new JUnit4Mockery() { + { + setImposteriser(ClassImposteriser.INSTANCE); + } + }; + + private final CommandConsole commandConsole = mock.mock(CommandConsole.class, "commandConsole"); + + private final CommandTaskRegistry commandTaskRegistry = new CommandTaskRegistry(); + + @Before + public void setUp() { + commandTaskRegistry.registerCommandTask("test", TestCommandTask.class); + } + + @After + public void tearDown() { + commandTaskRegistry.clear(); + } + + @Test + public void testEmptyArguments() { + ExecutionContextImpl context = createExecutionContext(new String[0]); + mock.checking(new Expectations() { + { + one(commandConsole).printlnInfoMessage(""); + one(commandConsole).printlnInfoMessage("Usage: testScript {testTaskName} [options]"); + one(commandConsole).printlnInfoMessage(CommandConstants.LINE_SEPARATOR + "Actions:" + CommandConstants.LINE_SEPARATOR + CommandConstants.LINE_SEPARATOR + + " " + "testTaskName" + CommandConstants.LINE_SEPARATOR + "testTaskDescription" + + CommandConstants.LINE_SEPARATOR + CommandConstants.LINE_SEPARATOR + "Options:" + + CommandConstants.LINE_SEPARATOR + + "\tUse help [actionName] for detailed option information of each action."); + } + }); + new HelpCommandTask().execute(context); + } + + @Test + public void testTaskName() { + ExecutionContextImpl context = createExecutionContext(new String[] { "test" }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnInfoMessage("testTaskHelp"); + one(commandConsole).printlnInfoMessage(""); + } + }); + new HelpCommandTask().doExecute(context); + } + + @Test + public void testInvalidTaskName() { + ExecutionContextImpl context = createExecutionContext(new String[] { "invalidTaskName" }); + mock.checking(new Expectations() { + { + one(commandConsole).printlnErrorMessage(""); + one(commandConsole).printlnErrorMessage("CWWKE0502E: Unknown task: invalidTaskName."); + } + }); + new HelpCommandTask().doExecute(context); + } + + private ExecutionContextImpl createExecutionContext(String[] args) { + ExecutionContextImpl context = new ExecutionContextImpl(commandConsole, args, commandTaskRegistry); + context.setAttribute(CommandConstants.SCRIPT_NAME, "testScript"); + return context; + } + + public static class TestCommandTask implements CommandTask { + /** {@inheritDoc} */ + @Override + public Set getSupportedOptions() { + return new HashSet(); + } + + /** {@inheritDoc} */ + @Override + public String getTaskName() { + return "testTaskName"; + } + + /** {@inheritDoc} */ + @Override + public String getTaskDescription() { + return "testTaskDescription"; + } + + /** {@inheritDoc} */ + @Override + public String getTaskHelp() { + return "testTaskHelp"; + } + + /** {@inheritDoc} */ + @Override + public void execute(ExecutionContext context) {} + + } +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/LicenseUtilityTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/LicenseUtilityTest.java new file mode 100755 index 00000000000..e8fa18a697c --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/LicenseUtilityTest.java @@ -0,0 +1,128 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.junit.Before; +import org.junit.Test; + +/** + * Units tests for LicenseUtility that displays License Information and License Agreement + */ +public class LicenseUtilityTest { + + private final LicenseUtility utility = new LicenseUtility(); + String TEST_FILE_NAME = "lafiles/testfile1"; + String LICENSE_DIR = "lafiles"; + String EMPTY_LICENSE_DIR = "emptyLAFiles"; + String INVALID_TEST_FILE_NAME = "lafiles/invalidFile"; + + private Mockery mockery; + private CommandConsole console; + + /** + * This method is run before each test to make the {@link #mockery} object with a mocked {@link #console} and {@link #context} and you can retrieve the console via a call + * {@link ExecutionContext#getCommandConsole()} + */ + @Before + public void createMockery() { + this.mockery = new Mockery(); + this.console = mockery.mock(CommandConsole.class); + } + + @Test + public void testShowLicenseFile() throws FileNotFoundException, URISyntaxException { + File testFile = new File(ClassLoader.getSystemResource(TEST_FILE_NAME).toURI()); + InputStream is = new FileInputStream(testFile); + + this.mockery.checking(new Expectations() { + { + one(console).printlnInfoMessage("hewey"); + one(console).printlnInfoMessage("dewey"); + one(console).printlnInfoMessage("luey"); + one(console).printlnInfoMessage(""); + } + }); + utility.showLicenseFile(is, console); + } + + @Test + public void testDisplayLicenseFile() throws FileNotFoundException, URISyntaxException { + File testFile = new File(ClassLoader.getSystemResource(TEST_FILE_NAME).toURI()); + InputStream is = new FileInputStream(testFile); + + this.mockery.checking(new Expectations() { + { + one(console).printlnInfoMessage("hewey"); + one(console).printlnInfoMessage("dewey"); + one(console).printlnInfoMessage("luey"); + one(console).printlnInfoMessage(""); + } + }); + utility.displayLicenseFile(is, console); + + createMockery(); + this.mockery.checking(new Expectations() { + { + one(console).printErrorMessage(with(any(String.class))); + } + }); + utility.displayLicenseFile(null, console); + + } + + @Test + public void testGetLicenseFile() throws URISyntaxException, IOException { + + File licenseDir = new File(ClassLoader.getSystemResource(LICENSE_DIR).toURI()); + File licenseInfo = utility.getLicenseFile(licenseDir, "LI"); + assertTrue("FAIL: License info doesnt exist:", licenseInfo.exists()); + + Locale locale = Locale.getDefault(); + String lang = locale.getLanguage(); + + assertEquals("License locale is not en or not LI:", "LI_" + lang, licenseInfo.getName()); + + File licenseAgreement = utility.getLicenseFile(licenseDir, "LA"); + assertTrue("FAIL: License agreement doesnt exist:", licenseAgreement.exists()); + assertEquals("License locale is not en or not LA:", "LA_" + lang, licenseAgreement.getName()); + } + + @Test + @SuppressWarnings("static-access") + public void testWordWrap() { + + String fullLine = "This is a test string for testing the license agreement and license information word wrap"; + List actualLine = utility.wordWrap(fullLine, null); + + List expectedLine = new ArrayList(); + expectedLine.add("This is a test string for testing the license agreement and license, information word wrap"); + assertEquals("FAIL: wordWrap is not wrapping line properly:", actualLine.toString(), expectedLine.toString()); + + List actualLine1 = utility.wordWrap("", null); + assertEquals("FAIL: wordWrap is not returning empty:", actualLine1.toString(), "[]"); + } +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/MD5UtilsTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/MD5UtilsTest.java new file mode 100755 index 00000000000..7f44de59fd8 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/MD5UtilsTest.java @@ -0,0 +1,58 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility; + +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; + +import junit.framework.Assert; + +import org.junit.Test; + +import com.ibm.ws.product.utility.extension.MD5Utils; + +/** + * Test the MD5 Utilities works as expect. + */ +public class MD5UtilsTest { + + private static final String TEST_STR = "abc"; + private static final String TEST_STR_MD5_VALUE = "900150983cd24fb0d6963f7d28e17f72"; + + private static final String TEST_FILE_NAME = "md5Tests/TestFile.txt"; + private static final String TEST_FILE_MD5_VALUE = "91d4999210e9ffa1444b37b9ca8364b2"; + + @Test + public void testGetMD5String() { + String calculatedValue = MD5Utils.getMD5String(TEST_STR); + Assert.assertEquals("The expected MD5 value of string abc is " + TEST_STR_MD5_VALUE, TEST_STR_MD5_VALUE, calculatedValue); + } + + @Test + public void testGetFileMD5String() { + File testFile; + String calculatedValue; + try { + testFile = new File(ClassLoader.getSystemResource(TEST_FILE_NAME).toURI()); + calculatedValue = MD5Utils.getFileMD5String(testFile); + } catch (URISyntaxException e) { + Assert.fail("Can not find mock file!"); + return; + } catch (IOException e) { + Assert.fail("Can not read mock file!"); + return; + } + Assert.assertEquals("The expected MD5 value of file " + testFile.getName(), TEST_FILE_MD5_VALUE, calculatedValue); + } + +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixCompareCommandTaskTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixCompareCommandTaskTest.java new file mode 100755 index 00000000000..15cd3cd5f69 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixCompareCommandTaskTest.java @@ -0,0 +1,690 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.extension; + +import java.io.File; +import java.net.URISyntaxException; +import java.net.URL; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.junit.Before; +import org.junit.Test; + +import com.ibm.ws.product.utility.CommandConsole; +import com.ibm.ws.product.utility.CommandConstants; +import com.ibm.ws.product.utility.ExecutionContext; + +/** + * + */ +public class IFixCompareCommandTaskTest { + + private Mockery mockery; + private ExecutionContext context; + private CommandConsole console; + + /** + * This method is run before each test to make the {@link #mockery} object with a mocked {@link #console} and {@link #context} and you can retrieve the console via a call + * {@link ExecutionContext#getCommandConsole()} + */ + @Before + public void createMockery() { + this.mockery = new Mockery(); + this.context = mockery.mock(ExecutionContext.class); + this.console = mockery.mock(CommandConsole.class); + this.mockery.checking(new Expectations() { + { + allowing(context).getCommandConsole(); + will(returnValue(console)); + // Some messages are spaced out a bit so always allow "" + allowing(console).printlnInfoMessage(""); + } + }); + } + + /** + * This test makes sure that when you have matching APARs to iFixes then the compare --target works correctly when comparing with directory install + * + * @throws URISyntaxException + */ + @Test + public void testCompareToMatchingApars() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL threeAparInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File threeAparInstallFile = new File(threeAparInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(threeAparInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + threeAparInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + threeAparInstallFile.getAbsolutePath() + " and in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [iFix1]")); + oneOf(console).printlnInfoMessage(with("2 in the iFix(es): [iFix1]")); + oneOf(console).printlnInfoMessage(with("3 in the iFix(es): [iFix2]")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test checks that when we compare two images with iFixes we use the iFixes in the target when working out if all + * the fixes exist in the target install. + * + * @throws URISyntaxException + */ + @Test + public void testCompareIncludesIFixes() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL threeAparInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File threeAparInstallFile = new File(threeAparInstallFileLocation.toURI()); + URL oneIFixTwoFP = this.getClass().getClassLoader().getResource("mockInstalls/oneIFixTwoFP"); + final File threeAparFixPackFile = new File(oneIFixTwoFP.toURI()); + this.setUpTargetMockery(threeAparInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("Some of the iFixes in the image at " + threeAparInstallFile.getAbsolutePath() + " are missing in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + threeAparInstallFile.getAbsolutePath() + " but are missing in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("3 in the iFix(es): [iFix2]")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + threeAparInstallFile.getAbsolutePath() + " and in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [iFix1]")); + oneOf(console).printlnInfoMessage(with("2 in the iFix(es): [iFix1]")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when you have some APARs in iFixes then the compare --target works correctly when comparing with archive install + * + * @throws URISyntaxException + */ + @Test + public void testCompareToMissingApars() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL installLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File installFile = new File(installLocation.toURI()); + URL fpLocation = this.getClass().getClassLoader().getResource("mockInstalls/TwoAparsArchiveFixPack.jar"); + final File fpFile = new File(fpLocation.toURI()); + this.setUpTargetMockery(installFile, fpFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("Some of the iFixes in the image at " + installFile.getAbsolutePath() + " are missing in the image at " + + fpFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + installFile.getAbsolutePath() + " but are missing in the image at " + + fpFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("2 in the iFix(es): [iFix1]")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + installFile.getAbsolutePath() + " and in the image at " + + fpFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [iFix1]")); + oneOf(console).printlnInfoMessage(with("3 in the iFix(es): [iFix2]")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + public static final class APARTestData { + public final String description; + public final String aparsOption; + public final String[] presentApars; + public final String[] missingApars; + public final String resultText; + + public APARTestData(String description, String aparsOption, String[] presentApars, String[] missingApars) { + this.description = description; + this.aparsOption = aparsOption; + this.presentApars = presentApars; + this.missingApars = missingApars; + this.resultText = getResultText(this.presentApars, this.missingApars); + } + + public static final String ALL_APARS_PRESENT_TEXT = "All of the APARs are in the installation."; + public static final String MISSING_APARS_PREFIX = "The following APARs are not in the installation: ["; + public static final String MISSING_APARS_DELIM = ", "; + public static final String MISSING_APARS_SUFFIX = "]."; + + public static String getResultText(String[] presentApars, String[] missingApars) { + if ((missingApars == null) || (missingApars.length == 0)) { + return ALL_APARS_PRESENT_TEXT; + } + + StringBuilder builder = new StringBuilder(MISSING_APARS_PREFIX); + for (int aparNo = 0; aparNo < missingApars.length; aparNo++) { + if (aparNo > 0) { + builder.append(MISSING_APARS_DELIM); + } + builder.append(missingApars[aparNo]); + } + builder.append(MISSING_APARS_SUFFIX); + + return builder.toString(); + } + } + + public static final String[] EMPTY_STRINGS = new String[] {}; + + public static final APARTestData[] COMPREHENSIVE_APAR_TEST_DATA = + new APARTestData[] { new APARTestData("empty", "", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("spaces", " ", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("tabs", "\t\t\t", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("bare comma", ",", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("comma and spaces", " , ", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("comma and tabs", "\t,\t", EMPTY_STRINGS, EMPTY_STRINGS), + new APARTestData("one absent", "PM99999", EMPTY_STRINGS, new String[] { "PM99999" }), + new APARTestData("one absent, extra spaces", " PM99999 ", EMPTY_STRINGS, new String[] { "PM99999" }), + new APARTestData("one absent, extra tabs", "\t\tPM99999\t\t", EMPTY_STRINGS, new String[] { "PM99999" }), + new APARTestData("multiple absent", "PM99999,PM99998", EMPTY_STRINGS, new String[] { "PM99999", "PM99998" }), + new APARTestData("multiple absent, extra spaces", " PM99999 , PM99998 ", EMPTY_STRINGS, new String[] { "PM99999", "PM99998" }), + new APARTestData("duplicate absent", "PM99999,PM99998,PM99999", EMPTY_STRINGS, new String[] { "PM99999", "PM99998" }), + new APARTestData("one present", "1", new String[] { "1" }, EMPTY_STRINGS), + new APARTestData("one present, one absent, comma delimited", "1,PM99999", new String[] { "1" }, new String[] { "PM99999" }), + new APARTestData("one present, one absent, space delimited", "1 PM99999", new String[] { "1" }, new String[] { "PM99999" }), + new APARTestData("one present, one absent, tab delimited", "1\tPM99999", new String[] { "1" }, new String[] { "PM99999" }), + new APARTestData("two present, one absent, space delimited", "1 10 PM99999", new String[] { "1", "10" }, new String[] { "PM99999" }), + new APARTestData("two present, one absent, mixed delimiters", "1,10 PM99999", new String[] { "1", "10" }, new String[] { "PM99999" }) + }; + + @Test + public void testCompareAparsAllPresent() throws URISyntaxException { + // Use the sample data with two ifixes and three APARs + APARTestData testData = new APARTestData("three present", "1,4,10", new String[] { "1", "4", "10" }, EMPTY_STRINGS); + runAparsTest(testData); // throws URISyntaxException + } + + @Test + public void testCompareAparsSomeMissing() throws URISyntaxException { + APARTestData testData = new APARTestData("two present, one absent", "1,4,apar5", new String[] { "1", "4" }, new String[] { "apar5" }); + runAparsTest(testData); // throws URISyntaxException + } + + @Test + public void testAparsComprehensive() throws URISyntaxException { + for (int testNo = 0; testNo < COMPREHENSIVE_APAR_TEST_DATA.length; testNo++) { + if (testNo > 0) { + createMockery(); // Get this for free on the first test. Recreate for the remaining tests. + } + runAparsTest(COMPREHENSIVE_APAR_TEST_DATA[testNo]); // throws URISyntaxException + } + } + + public void runAparsTest(final APARTestData productInfoData) throws URISyntaxException { + URL installLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File installFile = new File(installLocation.toURI()); + mockery.checking(new Expectations() { + { + allowing(context).getAttribute(with(CommandConstants.WLP_INSTALLATION_LOCATION), with(File.class)); + will(returnValue(installFile)); + allowing(context).optionExists(with("--target")); + will(returnValue(false)); + allowing(context).optionExists(with("--apars")); + will(returnValue(true)); + allowing(context).optionExists(with("--verbose")); + will(returnValue(false)); + allowing(context).getOptionValue(with("--apars")); + will(returnValue(productInfoData.aparsOption)); + } + }); + + // Verify the specified expected result. + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage(with(productInfoData.resultText)); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * Test to make sure when no input is provided an error is output + * + * @throws URISyntaxException + */ + @Test + public void testNoOptionsSet() throws URISyntaxException { + // Add expectations for no input + mockery.checking(new Expectations() { + { + allowing(context).optionExists(with("--target")); + will(returnValue(false)); + allowing(context).optionExists(with("--apars")); + will(returnValue(false)); + } + }); + + // Add expectations for the error + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + with("Unable to compare because of invalid usage of command, one of --target or --apars\nmust be supplied.")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * Test to make sure when no input is provided an error is output + * + * @throws URISyntaxException + */ + @Test + public void testToOptionDoesNotExist() throws URISyntaxException { + // Add expectations for to an invalid location + URL installLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File installFile = new File(installLocation.toURI()); + final File missingFile = new File(installFile, "foo"); + this.setUpTargetMockery(installFile, missingFile); + + // Add expectations for the error + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + with("Installation file " + missingFile.getAbsolutePath() + " does not exist.")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * Tests that when the to points to a file then there is a warning + * + * @throws URISyntaxException + */ + @Test + public void testInvalidToOption() throws URISyntaxException { + // Add expectations for to an invalid location + URL installLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File installFile = new File(installLocation.toURI()); + final File illegalFile = new File(this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP/lib/fixes/iFix1.xml").toURI()); + this.setUpTargetMockery(installFile, illegalFile); + + // Add expectations for the error + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + with("The install location " + illegalFile.getAbsolutePath() + " is not a directory or archive file (.jar or .zip)")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * Tests that when the to points to an install directory that has an invalid APAR ID zip in it then there is an appropriate error + * + * @throws URISyntaxException + */ + @Test + public void testInvalidZip() throws URISyntaxException { + // Add expectations for to an invalid location + URL installLocation = this.getClass().getClassLoader().getResource("mockInstalls/twoIFixesThreeAparsTwoFP"); + final File installFile = new File(installLocation.toURI()); + final File illegalFile = new File(this.getClass().getClassLoader().getResource("mockInstalls/invalidZip").toURI()); + this.setUpTargetMockery(installFile, illegalFile); + + // Add expectations for the error + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + with("The installation location " + + illegalFile.getAbsolutePath() + + " is invalid. It contains an archive for listing APARs (wlp_fp8509_aparIds.zip) but no file listing the APARs inside it aparIds.csv.")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when you have a <file> element that has a badly formatted date then it produces the right error + * + * @throws URISyntaxException + */ + @Test + public void testInvalidTimeInFile() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL badDateInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/badDate"); + final File badDateInstallFile = new File(badDateInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(badDateInstallFile, threeAparFixPackFile, true); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + badDateInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + badDateInstallFile.getAbsolutePath() + " and in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [badDate]")); + oneOf(console).printlnErrorMessage( + "Unable to read iFix information for badDate so cannot check if the iFix is still installed"); + oneOf(console).printlnErrorMessage( + "The following iFix(es) were not included in the comparison because their XML is invalid (use --verbose option for more information): [badDate]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when you don't have any properties for WAS versions then that check is skipped + * + * @throws URISyntaxException + */ + @Test + public void testNoProperties() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL noPropertiesInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/noProperties"); + final File noPropertiesInstallFile = new File(noPropertiesInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(noPropertiesInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + "Unable to obtain version for the current install so cannot check if iFixes are applicable to this installation. The exception message is: No properties were found with productId 'com.ibm.websphere.appserver'"); + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + noPropertiesInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + noPropertiesInstallFile.getAbsolutePath() + " and in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [noProperties]")); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when there is an XML with no offering element that you get a warning + * + * @throws URISyntaxException + */ + @Test + public void testNoOffering() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL noOfferingInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/noOffering"); + final File noOfferingInstallFile = new File(noOfferingInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(noOfferingInstallFile, threeAparFixPackFile, true); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + "The iFix XML meta data for noOffering does not contain an offering element so cannot check that the iFix is valid for this installation"); + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + noOfferingInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("The following iFixes are in the image at " + noOfferingInstallFile.getAbsolutePath() + " and in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage(with("1 in the iFix(es): [noOffering]")); + oneOf(console).printlnErrorMessage( + "The following iFix(es) were not included in the comparison because their XML is invalid (use --verbose option for more information): [noOffering]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when there is an XML with no problem element that you get a warning + * + * @throws URISyntaxException + */ + @Test + public void testNoApar() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL noAparInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/noApar"); + final File noAparInstallFile = new File(noAparInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(noAparInstallFile, threeAparFixPackFile, true); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnErrorMessage( + "The iFix noApar does not have any APARs listed in elements in the meta data XML"); + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + noAparInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnErrorMessage( + "The following iFix(es) were not included in the comparison because their XML is invalid (use --verbose option for more information): [noApar]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test is the same as the previous test so it makes sure that when there is an XML with no problem element that you get a warning but there is no verbose option so it + * should not give details of what is wrong in the XML. + * + * @throws URISyntaxException + */ + @Test + public void testNoApar_noVerbose() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL noAparInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/noApar"); + final File noAparInstallFile = new File(noAparInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(noAparInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + noAparInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnErrorMessage( + "The following iFix(es) were not included in the comparison because their XML is invalid (use --verbose option for more information): [noApar]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when there is a feature JAR in the XML that isn't on the disk then that iFix is ignored + * + * @throws URISyntaxException + */ + @Test + public void testMissingFeatureJar() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL missingFeatureInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/missingFeatureJar"); + final File missingFeatureInstallFile = new File(missingFeatureInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(missingFeatureInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + missingFeatureInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage( + "The following iFix(es) were not included in the comparison because the files listed in the are no longer present or are out of date: [missingFeatureJar]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when there is a non-feature JAR file that is older than the time stamp in the XML then the test fails. This test will start failing in 2022 if the + * files timestamps are recreated when check out of RTC! + * + * @throws URISyntaxException + */ + @Test + public void testOldStaticFile() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL oldStaticFileInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oldStaticFile"); + final File oldStaticFileInstallFile = new File(oldStaticFileInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(oldStaticFileInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + oldStaticFileInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage( + "The following iFix(es) were not included in the comparison because the files listed in the are no longer present or are out of date: [oldStaticFile]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * This test makes sure that when there is an iFix that is applicable to an old version of WAS then it isn't included in the test + * + * @throws URISyntaxException + */ + @Test + public void testOldVersion() throws URISyntaxException { + // Add expectations to all the command to get the install location and compare to location + URL oldVersionInstallFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oldVersion"); + final File oldVersionInstallFile = new File(oldVersionInstallFileLocation.toURI()); + URL threeAparFixPackFileLocation = this.getClass().getClassLoader().getResource("mockInstalls/oneFixPackThreeApars"); + final File threeAparFixPackFile = new File(threeAparFixPackFileLocation.toURI()); + this.setUpTargetMockery(oldVersionInstallFile, threeAparFixPackFile); + + // Add expectations for the result + mockery.checking(new Expectations() { + { + oneOf(console).printlnInfoMessage( + with("All of the iFixes in the image at " + oldVersionInstallFile.getAbsolutePath() + " are present in the image at " + + threeAparFixPackFile.getAbsolutePath() + ".")); + oneOf(console).printlnInfoMessage( + "The following iFix(es) were not included in the comparison because it is not applicable to this version of WebSphere Application Server: [oldVersion]"); + } + }); + + // Run the test + IFixCompareCommandTask testObject = new IFixCompareCommandTask(); + testObject.doExecute(context); + mockery.assertIsSatisfied(); + } + + /** + * Sets up the mockery to allow the --target to be run by itself defaulting verbose to false + * + * @param installLocation The install location for the main product + * @param targetFile The fix pack to put in the target + */ + private void setUpTargetMockery(final File installLocation, final File targetFile) { + setUpTargetMockery(installLocation, targetFile, false); + } + + /** + * Sets up the mockery to allow the --target to be run by itself + * + * @param installLocation The install location for the main product + * @param targetFile The fix pack to put in the target + * @param verbose true if the command should be run in verbose mode + */ + private void setUpTargetMockery(final File installLocation, final File targetFile, final boolean verbose) { + mockery.checking(new Expectations() { + { + allowing(context).getAttribute(with(CommandConstants.WLP_INSTALLATION_LOCATION), with(File.class)); + will(returnValue(installLocation)); + allowing(context).optionExists(with("--target")); + will(returnValue(true)); + allowing(context).optionExists(with("--apars")); + will(returnValue(false)); + allowing(context).optionExists(with("--verbose")); + will(returnValue(verbose)); + allowing(context).getOptionValue(with("--target")); + will(returnValue(targetFile.getAbsolutePath())); + } + }); + } + +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixUtilsTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixUtilsTest.java new file mode 100755 index 00000000000..98437da6e55 --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/IFixUtilsTest.java @@ -0,0 +1,444 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.extension; + +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +import test.common.SharedOutputManager; + +import com.ibm.ws.kernel.boot.cmdline.Utils; +import com.ibm.ws.kernel.feature.internal.subsystem.SubsystemFeatureDefinitionImpl; +import com.ibm.ws.kernel.feature.provisioning.ProvisioningFeatureDefinition; +import com.ibm.ws.kernel.provisioning.ContentBasedLocalBundleRepository; +import com.ibm.ws.kernel.provisioning.ExtensionConstants; +import com.ibm.ws.logging.internal.BundleManifest; +import com.ibm.ws.product.utility.CommandConsole; +import com.ibm.ws.product.utility.extension.ifix.xml.BundleFile; +import com.ibm.ws.product.utility.extension.ifix.xml.IFixInfo; +import com.ibm.ws.product.utility.extension.utils.TestUtils; + +/** + * + */ +public class IFixUtilsTest { + final static SharedOutputManager outputMgr = SharedOutputManager.getInstance(); + + // This is used to create a unique directory for each test. We sometimes get failures deleting files/dirs which can + // cause the next test to fail. + private static int testInstallDirCount = 0; + // Some default File names that we'll use in the tests. + private static final File tmpDir = new File("build/unittest/tmp"); + private static File wlpDir; + private static File fixesDir; + private static File libDir; + private static File binDir; + private static File featuresDir; + private static File platformDir; + private static File toolsDir; + + public static final ValidateCommandTask task = new ValidateCommandTask(); + private static CommandConsole console = new CommandConsole() { + @Override + public boolean isInputStreamAvailable() { + return false; + } + + @Override + public String readMaskedText(String prompt) { + return null; + } + + @Override + public String readText(String prompt) { + return null; + } + + @Override + public void printInfoMessage(String message) { + System.out.print(message); + } + + @Override + public void printlnInfoMessage(String message) { + System.out.println(message); + } + + @Override + public void printErrorMessage(String errorMessage) { + System.err.print(errorMessage); + } + + @Override + public void printlnErrorMessage(String errorMessage) { + System.err.print(errorMessage); + } + }; + + @Rule + public TestRule outputRule = outputMgr; + + @BeforeClass + public static void classSetup() {} + + @Before + public void testSetup() { + + // Initially clean up. + TestUtils.delete(tmpDir); + + // We have to specify the absolute path in the wlpdir parent dir, because otherwise we get relative entries. + wlpDir = new File(tmpDir.getAbsolutePath(), "Test" + testInstallDirCount++ + "/wlp"); + fixesDir = new File(wlpDir, "lib/fixes"); + libDir = new File(wlpDir, "lib"); + binDir = new File(wlpDir, "bin"); + featuresDir = new File(libDir, "features"); + platformDir = new File(libDir, "platform"); + toolsDir = new File(libDir, "tools-internal"); + // Configure all of the required directories for the tests. + binDir.mkdirs(); + fixesDir.mkdirs(); + featuresDir.mkdirs(); + platformDir.mkdirs(); + toolsDir.mkdirs(); + + // Reflectively amend the Utils class to set the current WLP dir as the installDir field. + try { + Field getInstallField = Utils.class.getDeclaredField("installDir"); + getInstallField.setAccessible(true); + getInstallField.set(null, wlpDir); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @After + public void teardown() { + // We clear the Bundle Repositories to clear any locks on files that we need to remove. + TestUtils.refreshBundleRepository(); + TestUtils.delete(tmpDir); + } + + /** + * This test ensures that when we have a number of ifix xmls, the files that are stored are the latest versions of the files. + * + * @throws Exception + */ + @Test + public void testIfixFileCreationDateFiltering() throws Exception { + + // These are the files that are the ifix jars that have been installed into the runtime. + File test1IFixJar = TestUtils.createJarFile(libDir, "test1", "1.0.0.20130101", true, true); + File test2IFixJar = TestUtils.createJarFile(libDir, "test2", "1.0.0.20130101", true, false); + File test3IFixJar = TestUtils.createJarFile(libDir, "test3", "1.0.0.20130101", true, true); + File test4IFixJar = TestUtils.createJarFile(libDir, "test4", "1.0.0.20130101", true, false); + + // The relative paths that get stored in the xmls for each jar. + String test1IFixJarRelativePath = TestUtils.createRelativePath(test1IFixJar, wlpDir); + String test2IFixJarRelativePath = TestUtils.createRelativePath(test2IFixJar, wlpDir); + String test3IFixJarRelativePath = TestUtils.createRelativePath(test3IFixJar, wlpDir); + String test4IFixJarRelativePath = TestUtils.createRelativePath(test4IFixJar, wlpDir); + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + + // These are the files that are the ifix static files that have been installed into the runtime. + File test1StaticFile = TestUtils.createFile(new File(binDir, "staticFile1"), fileContents); + File test2StaticFile = TestUtils.createFile(new File(binDir, "staticFile2"), fileContents); + File test3StaticFile = TestUtils.createFile(new File(binDir, "staticFile3"), fileContents); + File test4StaticFile = TestUtils.createFile(new File(binDir, "staticFile4"), fileContents); + + // The relative paths that get stored in the xmls for each static file. + String test1StaticFileRelativePath = TestUtils.createRelativePath(test1StaticFile, wlpDir); + String test2StaticFileRelativePath = TestUtils.createRelativePath(test2StaticFile, wlpDir); + String test3StaticFileRelativePath = TestUtils.createRelativePath(test3StaticFile, wlpDir); + String test4StaticFileRelativePath = TestUtils.createRelativePath(test4StaticFile, wlpDir); + + // Create the first ifix xml. + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), "Test-Ifix1", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create the second ifix xml. + updateFiles.clear(); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix2.xml"), "Test-Ifix2", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + // Create the third ifix xml. + updateFiles.clear(); + updateFiles.add(""); + updateFiles.add(""); + updateFiles.add(""); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix3.xml"), "Test-Ifix3", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create the fourth ifix xml. + updateFiles.clear(); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix4.xml"), "Test-Ifix4", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create the fifth ifix xml. + updateFiles.clear(); + updateFiles.add(""); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix5.xml"), "Test-Ifix5", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create the sixth ifix xml. + updateFiles.clear(); + updateFiles.add(""); + updateFiles.add(""); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix6.xml"), "Test-Ifix6", updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Now we have to reflectively allow the processIfixXmls method to be accessed and called, as it is a private method. + Method processIFixXmlsMethod = IFixUtils.class.getDeclaredMethod("processIFixXmls", File.class, Map.class, CommandConsole.class); + processIFixXmlsMethod.setAccessible(true); + Method processLPMFXmlsMethod = IFixUtils.class.getDeclaredMethod("processLPMFXmls", File.class, CommandConsole.class); + processLPMFXmlsMethod.setAccessible(true); + Map bundleFiles = (Map) processLPMFXmlsMethod.invoke(null, wlpDir, console); + Map latestFiles = (Map) processIFixXmlsMethod.invoke(null, wlpDir, bundleFiles, console); + + // Assert that we're getting the latest versions of the jars from the expected xml files. + Assert.assertTrue("latest version of test1.1.0.0.20130101.jar should be in Test-Ifix6, but is in " + latestFiles.get(test1IFixJarRelativePath).getId(), + "Test-Ifix6".equals(latestFiles.get(test1IFixJarRelativePath).getId())); + Assert.assertTrue("latest version of test2.1.0.0.20130101.jar should be in Test-Ifix6, but is in " + latestFiles.get(test2IFixJarRelativePath).getId(), + "Test-Ifix6".equals(latestFiles.get(test2IFixJarRelativePath).getId())); + Assert.assertTrue("latest version of test3.1.0.0.20130101.jar should be in Test-Ifix5, but is in " + latestFiles.get(test3IFixJarRelativePath).getId(), + "Test-Ifix5".equals(latestFiles.get(test3IFixJarRelativePath).getId())); + Assert.assertTrue("latest version of test4.1.0.0.20130101.jar should be in Test-Ifix3, but is in " + latestFiles.get(test4IFixJarRelativePath).getId(), + "Test-Ifix3".equals(latestFiles.get(test4IFixJarRelativePath).getId())); + + Assert.assertTrue("latest version of staticFile1 should be in Test-Ifix1, but is in " + latestFiles.get(test1StaticFileRelativePath).getId(), + "Test-Ifix1".equals(latestFiles.get(test1StaticFileRelativePath).getId())); + Assert.assertTrue("latest version of staticFile2 should be in Test-Ifix3, but is in " + latestFiles.get(test2StaticFileRelativePath).getId(), + "Test-Ifix3".equals(latestFiles.get(test2StaticFileRelativePath).getId())); + Assert.assertTrue("latest version of staticFile3 should be in Test-Ifix3, but is in " + latestFiles.get(test3StaticFileRelativePath).getId(), + "Test-Ifix3".equals(latestFiles.get(test3StaticFileRelativePath).getId())); + Assert.assertTrue("latest version of staticFile4 should be in Test-Ifix4, but is in " + latestFiles.get(test4StaticFileRelativePath).getId(), + "Test-Ifix4".equals(latestFiles.get(test4StaticFileRelativePath).getId())); + + } + + /** + * This method tests the gathering of static content from different feature manifest Subsystem content headers. + * It tests a number of different types/styles of location and ensures that only the static content files are returned. + * + * @throws Exception + */ + @Test + public void testSubsystemContentStaticFiles() throws Throwable { + + Map features = new TreeMap(); + + // Configure the files we're going to check for. + File static1Bat = TestUtils.createFile(new File(binDir, "static1.bat"), new StringBuffer()); + File static2Bat = TestUtils.createFile(new File(binDir, "static2.bat"), new StringBuffer()); + File static2 = TestUtils.createFile(new File(binDir, "static2"), new StringBuffer()); + File static3Bat = TestUtils.createFile(new File(binDir, "static3.bat"), new StringBuffer()); + File staticTools3Bat = TestUtils.createFile(new File(toolsDir, "static3.bat"), new StringBuffer()); + File static4Bat = TestUtils.createFile(new File(binDir, "static4.bat"), new StringBuffer()); + File staticTool4Bat = TestUtils.createFile(new File(toolsDir, "static4.bat"), new StringBuffer()); + File static4 = TestUtils.createFile(new File(binDir, "static4"), new StringBuffer()); + File staticTools4 = TestUtils.createFile(new File(toolsDir, "static4"), new StringBuffer()); + File static5Bat = TestUtils.createFile(new File(binDir, "static5.bat"), new StringBuffer()); + File staticTools5Bat = TestUtils.createFile(new File(toolsDir, "static5.bat"), new StringBuffer()); + // We'll create this file, but it shouldn't be included in the static content. + File nonStatic5 = TestUtils.createFile(new File(toolsDir, "nonstatic5"), new StringBuffer()); + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + File test1IfixJar = TestUtils.createJarFile(libDir, "test1", "1.0.0.20130101", true, true); + File test2IfixJar = TestUtils.createJarFile(libDir, "test2", "1.0.0.20130101", true, false); + + // Create the 1st feature + Map feature1Files = new HashMap(); + feature1Files.put("bin/static1.bat", "static1.bat"); + File feature1 = TestUtils.createFeature(new File(featuresDir, "testFeature1-1.0.mf"), "testFeature1-1.0", feature1Files); + + // Once we've created the manifest, create a SubsystemFeatureDef object and then load that into the list of features that we + // pass into the processSubsystemContent method + ProvisioningFeatureDefinition fd = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature1); + features.put(fd.getSymbolicName(), fd); + + // Create the 2nd feature + Map feature2Files = new HashMap(); + feature2Files.put("bin/static2.bat", "static2.bat"); + feature2Files.put("bin/static2", "static2"); + File feature2 = TestUtils.createFeature(new File(featuresDir, "testFeature2-1.0.mf"), "testFeature2-1.0", feature2Files); + ProvisioningFeatureDefinition fd2 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature2); + features.put(fd2.getSymbolicName(), fd2); + + // Create the 2nd feature + Map feature3Files = new HashMap(); + feature3Files.put("bin/static3.bat", "static3.bat"); + feature3Files.put("lib/tools-internal/static3.bat", "static3.bat.internal"); + File feature3 = TestUtils.createFeature(new File(featuresDir, "testFeature3-1.0.mf"), "testFeature3-1.0", feature3Files); + ProvisioningFeatureDefinition fd3 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature3); + features.put(fd3.getSymbolicName(), fd3); + + // Feature 4 is put in the lib/platform dir like the kernel features + Map feature4Files = new HashMap(); + feature4Files.put("bin/static4.bat", "static4.bat"); + feature4Files.put("lib/tools-internal/static4.bat", "static4.bat.internal"); + feature4Files.put("bin/static4", "static4"); + feature4Files.put("lib/tools-internal/static4", "static4.internal"); + feature4Files.put("lib/test1_1.0.0.jar", "test1_1.0.0.jar"); + File feature4 = TestUtils.createFeature(new File(platformDir, "testFeature4-1.0.mf"), "testFeature4-1.0", feature4Files); + ProvisioningFeatureDefinition fd4 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature4); + features.put(fd4.getSymbolicName(), fd4); + + // This feature has a some static content and some non-static content. + Map feature5Files = new HashMap(); + feature5Files.put("bin/static5.bat", "static5.bat"); + feature5Files.put("lib/tools-internal/static5.bat", "static5.bat.internal"); + feature5Files.put("lib/features, lib/tools-internal", "nonstatic5.jar"); + File feature5 = TestUtils.createFeature(new File(platformDir, "testFeature5-1.0.mf"), "testFeature5-1.0", feature5Files); + ProvisioningFeatureDefinition fd5 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature5); + features.put(fd5.getSymbolicName(), fd5); + + // Remove any existing and recreate the bundle repository that will work out the latest versions of the jars. + ContentBasedLocalBundleRepository repo = TestUtils.refreshBundleRepository(); + + // Now we have to reflectively allow the processIfixXmls method to be accessed and called, as it is a private method. + Method processSubsysteContentMethod = IFixUtils.class.getDeclaredMethod("processSubsystemContent", File.class, Map.class, + ContentBasedLocalBundleRepository.class, Map.class, + Set.class, Set.class, CommandConsole.class); + processSubsysteContentMethod.setAccessible(true); + + Map allBaseBundleJarContent = new HashMap(); + Set allBundleJarContent = new HashSet(); + Set allStaticFileContent = new HashSet(); + processSubsysteContentMethod.invoke(null, wlpDir, features, repo, allBaseBundleJarContent, allBundleJarContent, allStaticFileContent, console); + + File[] expectedFiles = { static1Bat, static2Bat, static2, static3Bat, staticTools3Bat, static4Bat, static4, staticTools4, staticTool4Bat, + static5Bat, staticTools5Bat, feature1, feature2, feature3, feature4, feature5 }; + + File[] unExpectedFiles = { nonStatic5, test1Jar, test1IfixJar, test2IfixJar }; + + // Iterate over the expected files making sure they exist, and then over the unexpected file ensuring that they don't. + for (File chkFile : expectedFiles) { + Assert.assertTrue(chkFile.getAbsolutePath() + " not found in static content list", allStaticFileContent.contains(chkFile)); + } + + for (File chkFile : unExpectedFiles) { + Assert.assertFalse(chkFile.getAbsolutePath() + " was unexpectedly found in static content list", allStaticFileContent.contains(chkFile)); + } + } + + /** + * This method tests the gathering of Bundle and jar information from different feature manifest Subsystem content headers. + * It tests a number of different types/styles of location and ensures that only the jar content files are returned. + * + * @throws Exception + */ + @Test + public void testSubsystemContentBundleJarFiles() throws Throwable { + + Map features = new TreeMap(); + + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + File test2Jar = TestUtils.createJarFile(libDir, "test2", "1.0.1", false, false); + + File test1staticJar = TestUtils.createJarFile(libDir, "test1static", "1.0.0", false, false); + File test2staticJar = TestUtils.createJarFile(libDir, "test2static", "1.0.1", false, false); + + File test1staticfile = TestUtils.createFile(new File(binDir, "static1.bat"), new StringBuffer()); + File test2staticfile = TestUtils.createFile(new File(binDir, "static2"), new StringBuffer()); + File test3staticfile = TestUtils.createFile(new File(toolsDir, "static5.bat"), new StringBuffer()); + + // Create the 1st feature + Map feature1Files = new HashMap(); + feature1Files.put(null, "test1_1.0.0.jar"); + feature1Files.put("bin/static2.bat", "static2.bat"); + feature1Files.put("lib/test1static_1.0.0.jar", "test1static_1.0.0.jar"); + File feature1 = TestUtils.createFeature(new File(featuresDir, "testFeature1-1.0.mf"), "testFeature1-1.0", feature1Files); + + // Once we've created the manifest, create a SubsystemFeatureDef object and then load that into the list of features that we + // pass into the processSubsystemContent method + ProvisioningFeatureDefinition fd = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature1); + features.put(fd.getSymbolicName(), fd); + + // Create the 1st feature + Map feature2Files = new HashMap(); + feature2Files.put(null, "test2_1.0.1.jar"); + feature2Files.put("bin/static2", "static2"); + feature2Files.put("lib/test2static_1.0.1.jar", "test1static_1.0.1.jar"); + File feature2 = TestUtils.createFeature(new File(featuresDir, "testFeature2-1.0.mf"), "testFeature2-1.0", feature2Files); + + ProvisioningFeatureDefinition fd2 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature2); + features.put(fd2.getSymbolicName(), fd2); + + // Create the 1st feature + Map feature3Files = new HashMap(); + feature3Files.put("lib/tools-internal/static5.bat", "static5.bat"); + File feature3 = TestUtils.createFeature(new File(featuresDir, "testFeature3-1.0.mf"), "testFeature3-1.0", feature3Files); + + ProvisioningFeatureDefinition fd3 = new SubsystemFeatureDefinitionImpl(ExtensionConstants.CORE_EXTENSION, feature3); + features.put(fd3.getSymbolicName(), fd3); + + // Remove any existing and recreate the bundle repository that will work out the latest versions of the jars. + ContentBasedLocalBundleRepository repo = TestUtils.refreshBundleRepository(); + + // Now we have to reflectively allow the processIfixXmls method to be accessed and called, as it is a private method. + Method processSubsysteContentMethod = IFixUtils.class.getDeclaredMethod("processSubsystemContent", File.class, Map.class, + ContentBasedLocalBundleRepository.class, Map.class, + Set.class, Set.class, CommandConsole.class); + processSubsysteContentMethod.setAccessible(true); + + Map allBaseBundleJarContent = new HashMap(); + Set allBundleJarContent = new HashSet(); + Set allStaticFileContent = new HashSet(); + processSubsysteContentMethod.invoke(null, wlpDir, features, repo, allBaseBundleJarContent, allBundleJarContent, allStaticFileContent, console); + + File[] expectedFiles = { test1Jar, test2Jar, test1staticJar, test2staticJar }; + + File[] unExpectedFiles = { test1staticfile, test2staticfile, test3staticfile, feature1, feature2, feature3 }; + + // Iterate over the expected files making sure they exist, and then over the unexpected file ensuring that they don't. + for (File chkFile : expectedFiles) { + Assert.assertTrue(chkFile.getAbsolutePath() + " not found in jar content list", allBundleJarContent.contains(chkFile)); + } + + for (File chkFile : unExpectedFiles) { + Assert.assertFalse(chkFile.getAbsolutePath() + " was unexpectedly found in static content list", allBundleJarContent.contains(chkFile)); + } + } + +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/ValidateCommandTest.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/ValidateCommandTest.java new file mode 100755 index 00000000000..8cd4b542f4c --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/ValidateCommandTest.java @@ -0,0 +1,951 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.extension; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.api.Invocation; +import org.jmock.lib.action.CustomAction; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.ws.kernel.boot.cmdline.Utils; +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry; +import com.ibm.ws.product.utility.CommandConsole; +import com.ibm.ws.product.utility.CommandConstants; +import com.ibm.ws.product.utility.ExecutionContext; +import com.ibm.ws.product.utility.extension.utils.TestUtils; + +/** + * + */ +public class ValidateCommandTest { + + // This is used to create a unique directory for each test. We sometimes get failures deleting files/dirs which can + // cause the next test to fail. + private static int testInstallDirCount = 0; + // Some default File names that we'll use in the tests. + private static final File tmpDir = new File("build/unittest/tmp"); + private static File uniqueTestDir; + private static File wlpDir; + private static File libDir; + private static File binDir; + private static File fixesDir; + private static File featuresDir; + private static File platformDir; + private static File versionsDir; + private static File checksumsDir; + private static File toolsDir; + // This dir is for the ifix files which are effectively from the ifix jar file. + // We need them to generate hashes and locations in the ifix.xml + private static File ifixLibDir; + private static File ifixBinDir; + private static File ifixFeaturesDir; + + // The List that will hold the console messages from the validate command. + private static final List consoleInfoMessages = new ArrayList(); + private static final List consoleErrorMessages = new ArrayList(); + + // The JMock objects + private static Mockery mockery = null; + private static ExecutionContext context = null; + private static CommandConsole console = null; + + // A static instance of the ValidateCommandTask. + public static final ValidateCommandTask task = new ValidateCommandTask(); + + @Rule + public final TestName name = new TestName(); + + /** + * This method is run before each test to setup the mocked Liberty runtime. + */ + @Before + public void testSetup() { + + // Clean up from last test. + if (tmpDir.exists()) + TestUtils.delete(tmpDir); + + // Define unique test dir. + uniqueTestDir = new File(tmpDir, "Test" + testInstallDirCount++); + wlpDir = new File(uniqueTestDir, "wlp"); + setupMocking(); + + // Reflectively amend the Utils class to set the current WLP dir as the installDir field. + try { + Field getInstallField = Utils.class.getDeclaredField("installDir"); + getInstallField.setAccessible(true); + getInstallField.set(null, wlpDir); + } catch (Exception e) { + e.printStackTrace(); + } + + libDir = new File(wlpDir, "lib"); + binDir = new File(wlpDir, "bin"); + fixesDir = new File(libDir, "fixes"); + featuresDir = new File(libDir, "features"); + platformDir = new File(libDir, "platform"); + versionsDir = new File(libDir, "versions"); + checksumsDir = new File(versionsDir, "checksums"); + toolsDir = new File(libDir, "internal-tools"); + // This dir is for the ifix files which are effectively from the ifix jar file. + // We need them to generate hashes and locations in the ifix.xml + ifixLibDir = new File(uniqueTestDir, "lib"); + ifixBinDir = new File(uniqueTestDir, "bin"); + ifixFeaturesDir = new File(ifixLibDir, "features"); + // These dirs should make all parent dirs. + fixesDir.mkdirs(); + binDir.mkdirs(); + featuresDir.mkdirs(); + checksumsDir.mkdirs(); + ifixLibDir.mkdirs(); + ifixBinDir.mkdirs(); + ifixFeaturesDir.mkdirs(); + toolsDir.mkdirs(); + platformDir.mkdirs(); + + // Setup up the ContentBasedLocalBundleRepository + TestUtils.refreshBundleRepository(); + } + + private static void setupMocking() { + // Configure the JMock Objects. This is mainly setting up the console to store any messages that are written to + // it so we can read them back and assert that we're getting the expected messages. + mockery = new Mockery(); + context = mockery.mock(ExecutionContext.class); + console = mockery.mock(CommandConsole.class); + mockery.checking(new Expectations() { + { + //------Context expectations ------ + // Configure the Context to return the wlp location when the attribute is called. + allowing(context).getAttribute(with(CommandConstants.WLP_INSTALLATION_LOCATION), with(File.class)); + will(returnValue(wlpDir)); + + // Configure the Context to return the null when the against option value is requested. + allowing(context).getOptionValue(with("against")); + will(returnValue(null)); + + //Return the mocked CommandConsole object when the method is called on the context. + allowing(context).getCommandConsole(); + will(returnValue(console)); + + // When an info message is written to the console, write this to our list so we can parse the output in the test. + allowing(console).printlnInfoMessage(with(any(String.class))); + will(new CustomAction("Add string to collection") { + @Override + public Object invoke(Invocation invocation) throws Throwable { + consoleInfoMessages.add(((String) invocation.getParameter(0)).trim()); + return null; + } + }); + + //------Context expectations ------ + + // When an info message is written to the console, write this to our list so we can parse the output in the test. + allowing(console).printInfoMessage(with(any(String.class))); + will(new CustomAction("Add string to collection") { + @Override + public Object invoke(Invocation invocation) throws Throwable { + consoleInfoMessages.add(((String) invocation.getParameter(0)).trim()); + return null; + } + }); + + // When an error message is written to the console, write this to our list so we can parse the output in the test. + allowing(console).printlnErrorMessage(with(any(String.class))); + will(new CustomAction("Add string to collection") { + @Override + public Object invoke(Invocation invocation) throws Throwable { + consoleErrorMessages.add((String) invocation.getParameter(0)); + return null; + } + }); + + // When an error message is written to the console, write this to our list so we can parse the output in the test. + allowing(console).printErrorMessage(with(any(String.class))); + will(new CustomAction("Add string to collection") { + @Override + public Object invoke(Invocation invocation) throws Throwable { + consoleErrorMessages.add((String) invocation.getParameter(0)); + return null; + } + }); + } + }); + } + + @After + public void teardown() { + TestUtils.clearBundleRepositoryHolders(); + TestUtils.delete(tmpDir); + } + + /** + * This test proves that the ValidateCommandTask displays any IFixes that need to be reapplied when checking jar files. The ifix xml file + * also contains a Test3 ifix jar. Because we don't have a test3 jar in the runtime, it shouldn't affect whether we need to reapply the ifix or + * not. This test does a 2 step process. It checks that we do need a reapply when we are genuinely missing an ifix jar, and then we "apply" + * the ifix, and ensure that the ifix reapply msg isn't issued. This will prove that the test3 missing ifix jar isn't relevant. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForJars() throws Exception { + + // These are the files that are the ifix files that have been installed into the runtime. + File test1IFixJar = TestUtils.createJarFile(libDir, "test1", "1.0.0.20130101", true, true); + // Store the ifix jar 2 and 3 in a temp dir outside of the wlp runtime, as we want to generate hashes but don't want them in the runtime. + // We will create the runtime version of jar 2 later in the test. + File test2IFixJar = TestUtils.createJarFile(ifixLibDir, "test2", "1.0.0.20130101", true, false); + File test3IFixJar = TestUtils.createJarFile(ifixLibDir, "test3", "1.0.0.20130101", true, true); + + // These are the jars files that are put in the runtime lib dir. + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + File test2Jar = TestUtils.createJarFile(libDir, "test2", "1.0.0", false, false); + + // Generate the IFix xml file for just ifix jars + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create test feature + Map featureFiles = new HashMap(); + featureFiles.put(TestUtils.createRelativePath(test1Jar, wlpDir), test1Jar.getName()); + featureFiles.put(TestUtils.createRelativePath(test2Jar, wlpDir), test2Jar.getName()); + TestUtils.createFeature(new File(featuresDir, "test-1.0.mf"), "test-1.0", featureFiles); + + runValidateCommand(); + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks(true, "The following fixes must be reapplied: [" + ifixName1 + "]."); + + // Now "reapply" the ifix and check that the command doesn't report any issues. + File copiedTest2IfixJar = new File(libDir, test2IFixJar.getName()); + TestUtils.copyFile(test2IFixJar, copiedTest2IfixJar); + // Rerun the command after clearing the console + runValidateCommand(); + + // Check that the command has run successfully, but ensure it doesn't include the reapply Ifix msg. + assertChecks(false, "The following fixes must be reapplied: [" + ifixName1 + "]."); + } + + /** + * This test proves that the ValidateCommandTask displays any IFixes that need to be reapplied when checking static content files. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForStaticContent() throws Exception { + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + fileContents.append("This is the 2nd line of file \n"); + + String staticFile1Name = "staticFile1.bat"; + String staticFile2Name = "staticFile2"; + String staticFile3Name = "staticFile3.bat"; + // Just create the static file 1 and 2. + TestUtils.createFile(new File(binDir, staticFile1Name), fileContents); + + // Add an extra line to the static files so that we get a different hash. + fileContents.append("This is an ifix static file \n"); + + File test1IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, staticFile1Name), fileContents); + File test2IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, staticFile2Name), fileContents); + File test3IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, staticFile3Name), fileContents); + + // Generate the IFix xml files for just ifix static content + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Generate a second ifix xml for the static 3 file + String ifixName2 = "Test-Ifix2"; + updateFiles.clear(); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, "ifix2.xml"), ifixName2, updateFiles, TestUtils.generateSet("Apar4")); + + // Create test feature + Map featureContent = new HashMap(); + featureContent.put(TestUtils.createRelativePath(test1IFixStaticFile, uniqueTestDir), staticFile1Name); + featureContent.put(TestUtils.createRelativePath(test2IFixStaticFile, uniqueTestDir), staticFile2Name); + TestUtils.createFeature(new File(featuresDir, "test-1.0.mf"), "test-1.0", featureContent); + + // Create test feature 2 + Map feature2Content = new HashMap(); + feature2Content.put(TestUtils.createRelativePath(test3IFixStaticFile, uniqueTestDir), staticFile3Name); + TestUtils.createFeature(new File(featuresDir, "test-2.0.mf"), "test-2.0", feature2Content); + + // Run the command + runValidateCommand(); + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks2Ifixes(ifixName1, ifixName2); + + // Now "reapply" the the static1 file and check that the we still report an error for static2 file + File copiedTest1StaticFile = new File(binDir, test1IFixStaticFile.getName()); + TestUtils.copyFile(test1IFixStaticFile, copiedTest1StaticFile); + + // Rerun the command + runValidateCommand(); + + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks2Ifixes(ifixName1, ifixName2); + + // Now "reapply" the static2 ifix and check that the command doesn't report any issues with ifix 1. + File copiedTest2StaticFile = new File(binDir, test2IFixStaticFile.getName()); + TestUtils.copyFile(test2IFixStaticFile, copiedTest2StaticFile); + + // Rerun the command + runValidateCommand(); + + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks(true, "The following fixes must be reapplied: [" + ifixName2 + "]."); + + // Now "reapply" the static3 file which fixes the ifix2 xml and check that the command doesn't report any issues. + File copiedTest3StaticFile = new File(binDir, test3IFixStaticFile.getName()); + TestUtils.copyFile(test3IFixStaticFile, copiedTest3StaticFile); + // Rerun the command + runValidateCommand(); + // Check that the command has run successfully, but ensure it doesn't include the reapply Ifix msg. + assertChecks(false, "The following fixes must be reapplied: [" + ifixName2 + "]."); + } + + /** + * This test proves that the ValidateCommandTask doesn't display the reapplication message if the ifix files are already installed. + * + * @throws Exception + */ + @Test + public void testValidateDoesNotDisplayIfixReApplicationIfIfixInstalled() throws Exception { + + // These are the files that are the ifix files that have been installed into the runtime. + TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + File test1IFixJar = TestUtils.createJarFile(libDir, "test1", "1.0.0.20130101", true, true); + TestUtils.createJarFile(libDir, "test2", "1.0.0", false, false); + File test2IFixJar = TestUtils.createJarFile(libDir, "test2", "1.0.0.20130101", true, false); + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + fileContents.append("This is the 2nd line of file \n"); + + File test1IFixStaticFile = TestUtils.createFile(new File(binDir, "staticFile1.bat"), fileContents); + File test2IFixStaticFile = TestUtils.createFile(new File(binDir, "staticFile2"), fileContents); + + // Generate the IFix xml files for just ifix static content + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + Set update2Files = new HashSet(); + update2Files.add(""); + update2Files.add(""); + String ifixName2 = "Test-Ifix2"; + TestUtils.createIfixXML(new File(fixesDir, "ifix2.xml"), ifixName2, update2Files, TestUtils.generateSet("Apar4")); + + // Create test feature + Map featureContent = new HashMap(); + featureContent.put(TestUtils.createRelativePath(test1IFixStaticFile, uniqueTestDir), test1IFixStaticFile.getName()); + featureContent.put(TestUtils.createRelativePath(test1IFixJar, wlpDir), test1IFixJar.getName()); + TestUtils.createFeature(new File(featuresDir, "test-1.0.mf"), "test-1.0", featureContent); + + Map feature2Content = new HashMap(); + feature2Content.put(TestUtils.createRelativePath(test2IFixJar, wlpDir), test2IFixJar.getName()); + feature2Content.put(TestUtils.createRelativePath(test2IFixStaticFile, uniqueTestDir), test2IFixStaticFile.getName()); + TestUtils.createFeature(new File(featuresDir, "test2-1.0.mf"), "test2-1.0", feature2Content); + + runValidateCommand(); + assertChecks(false, null); + } + + /** + * This test proves that the ValidateCommandTask displays multiple IFixes that need to be reapplied when checking both + * static content and jars together. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForMultipleIFix() throws Exception { + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + fileContents.append("This is the 2nd line of file \n"); + // These are the static files that we'll use for the tests. They are in the runtime structure. + File test1StaticFile = TestUtils.createFile(new File(binDir, "server.bat"), fileContents); + File test2StaticFile = TestUtils.createFile(new File(binDir, "server"), fileContents); + File test3StaticFile = TestUtils.createFile(new File(binDir, "version.bat"), fileContents); + File test4StaticFile = TestUtils.createFile(new File(toolsDir, "version.bat"), fileContents); + + // Store the ifix Static files in the tmp dir, as we want to generate hashes but don't want them in the runtime. + fileContents.append("This is the 2nd line of file \n"); + File test4IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "version.bat"), fileContents); + File test5IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "nonexistantFile"), fileContents); + + // Base Bundle for test 1 + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + // Ifix Bundle for test 1 + File test1IFixJar = TestUtils.createJarFile(libDir, "test1", "1.0.0.20130101", true, true); + // Base Bundle for test 2 + File test2Jar = TestUtils.createJarFile(libDir, "test2", "1.0.0", false, false); + // Ifix Bundle for test 2 + File test2IFixJar = TestUtils.createJarFile(ifixLibDir, "test2", "1.0.0.20130101", true, false); + // Test3IfixJar isn't meant to be installed into the runtime. It is just in the ifix xml. No base bundle exists + File test3IFixJar = TestUtils.createJarFile(ifixLibDir, "test3", "1.0.0.20130101", true, true); + + // Maps that we'll store the file content info for the ifix xml files. The key is the file name, and the + // value is the actual file that we use for hashes/file size etc. + Set ifix1Content = new HashSet(); + Set ifix2Content = new HashSet(); + Set ifix3Content = new HashSet(); + Set ifix4Content = new HashSet(); + + // Load the ifix content for ifix 1. + ifix1Content.add(""); + ifix1Content.add(""); + + // Load the ifix content for ifix 2. This contains the ifix1 content as this ifix supersedes ifix1. + ifix2Content.addAll(ifix1Content); + ifix2Content.add(""); + ifix2Content.add(""); + ifix2Content.add(""); + + // Load the ifix content for ifix 3. This contains files that aren't relevant for this runtime, and should be ignored, and not + // reported as being required to be reapplied. + ifix3Content.add(""); + + // Load the ifix content for ifix 4. This also supersedes ifix 1. + ifix4Content.addAll(ifix1Content); + ifix4Content.add(""); + ifix4Content.add(""); + + // Generate the 1st IFix xml file. + File ifixFile = new File(fixesDir, "ifix1.xml"); + TestUtils.createIfixXML(ifixFile, "ifix1", ifix1Content, TestUtils.generateSet("Apar1")); + + // Generate the 2nd IFix xml file. + File ifixFile2 = new File(fixesDir, "ifix2.xml"); + TestUtils.createIfixXML(ifixFile2, "ifix2", ifix2Content, TestUtils.generateSet("Apar1", "Apar2")); + + // Generate the 3rd IFix xml file. + File ifixFile3 = new File(fixesDir, "ifix3.xml"); + TestUtils.createIfixXML(ifixFile3, "ifix3", ifix3Content, TestUtils.generateSet("Apar4")); + + // Generate the 3rd IFix xml file. + File ifixFile4 = new File(fixesDir, "ifix4.xml"); + TestUtils.createIfixXML(ifixFile4, "ifix4", ifix4Content, TestUtils.generateSet("Apar1", "Apar3")); + + // Create test feature1 + Map feature1Files = new HashMap(); + feature1Files.put(TestUtils.createRelativePath(test1StaticFile, wlpDir), test1StaticFile.getName()); + feature1Files.put(TestUtils.createRelativePath(test1Jar, wlpDir), test1Jar.getName()); + TestUtils.createFeature(new File(featuresDir, "testFeature1-1.0.mf"), "testFeature1-1.0", feature1Files); + + // Create test feature2 + Map feature2Files = new HashMap(); + feature2Files.put(TestUtils.createRelativePath(test2StaticFile, wlpDir), test2StaticFile.getName()); + feature2Files.put(TestUtils.createRelativePath(test2Jar, wlpDir), test2Jar.getName()); + TestUtils.createFeature(new File(featuresDir, "testFeature2-1.0.mf"), "testFeature2-1.0", feature2Files); + + // Create test feature4 + Map feature3Files = new HashMap(); + feature3Files.put(TestUtils.createRelativePath(test3StaticFile, wlpDir), test3StaticFile.getName()); + feature3Files.put(TestUtils.createRelativePath(test4StaticFile, wlpDir), test4StaticFile.getName() + ".internal"); + TestUtils.createFeature(new File(featuresDir, "testFeature3-1.0.mf"), "testFeature3-1.0", feature3Files); + + runValidateCommand(); + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks2Ifixes("ifix2", "ifix4"); + } + + /** + * This test proves that changes to a Manifest file will also flag an ifix reapply. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForManifestChanges() throws Exception { + + // Base Bundle for test 1 + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + // Ifix Bundle for test 2 + File test2Jar = TestUtils.createJarFile(libDir, "test2", "1.0.0", false, false); + // Base Bundle for test 3 + File test3Jar = TestUtils.createJarFile(libDir, "test3", "1.0.0", false, false); + // Ifix Bundle for test 4 + File test4Jar = TestUtils.createJarFile(libDir, "test4", "1.0.0", false, false); + + // Create test feature 1 + Map feature1Content = new HashMap(); + feature1Content.put(TestUtils.createRelativePath(test1Jar, wlpDir), test1Jar.getName()); + File feature1 = TestUtils.createFeature(new File(featuresDir, "test-1.0.mf"), "test-1.0", feature1Content); + + // Create test ifix feature 1 + Map feature1IfixContent = new HashMap(); + feature1IfixContent.put(TestUtils.createRelativePath(test2Jar, wlpDir), test2Jar.getName()); + File featureIfix1 = TestUtils.createFeature(new File(ifixFeaturesDir, "test-1.0.mf"), "test-1.0", feature1IfixContent); + + // Create test feature 2 + Map feature2Content = new HashMap(); + feature2Content.put(TestUtils.createRelativePath(test3Jar, wlpDir), test3Jar.getName()); + File feature2 = TestUtils.createFeature(new File(featuresDir, "test-2.0.mf"), "test-2.0", feature2Content); + + // Create test ifix feature 2 + Map feature2IfixContent = new HashMap(); + feature2IfixContent.put(TestUtils.createRelativePath(test4Jar, wlpDir), test4Jar.getName()); + File featureIfix2 = TestUtils.createFeature(new File(ifixFeaturesDir, "test-2.0.mf"), "test-2.0", feature2IfixContent); + + // Generate the IFix xml files for just ifix static content + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Run the command + runValidateCommand(); + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks(true, "The following fixes must be reapplied: [" + ifixName1 + "]."); + + // Now "reapply" the the static1 file and check that the we still report an error for static2 file + TestUtils.copyFile(featureIfix1, feature1); + TestUtils.copyFile(featureIfix2, feature2); + + // Rerun the command + runValidateCommand(); + + // Check that the command has run successfully, and ensure there is no reapply Ifix msg. + assertChecks(false, null); + } + + /** + * This test proves that multiple product extensions that have missing ifixes are reported. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForMultipleProductExtensions() throws Exception { + + // Setup the Alternate product extension dir. + File alternateWLPDir = new File(uniqueTestDir, "alternate/wlp"); + File alternateLibDir = new File(alternateWLPDir, "lib"); + File alternateBinDir = new File(alternateWLPDir, "bin"); + File alternateFixesDir = new File(alternateLibDir, "fixes"); + File alternateFeaturesDir = new File(alternateLibDir, "features"); + File extensionsDir = new File(wlpDir, "etc/extensions"); + + alternateFeaturesDir.mkdirs(); + alternateFixesDir.mkdirs(); + alternateBinDir.mkdirs(); + extensionsDir.mkdirs(); + + // Plug in the new alternate product extension location to the runtime. + Properties extensionProps = new Properties(); + extensionProps.put("com.ibm.websphere.productInstall", alternateWLPDir.getAbsolutePath()); + extensionProps.put("com.ibm.websphere.productId", "ALTERNATE"); + + FileOutputStream fos = new FileOutputStream(new File(extensionsDir, "alternate.properties")); + try { + extensionProps.store(fos, "testing extension props"); + } catch (IOException ioe) { + ioe.printStackTrace(); + } finally { + if (fos != null) + fos.close(); + } + + // These are the files that are the ifix files that have been installed into the runtime using a properties file. + File test1Jar = TestUtils.createJarFile(alternateLibDir, "test1", "1.0.0", false, false); + File test1IFixJar = TestUtils.createJarFile(ifixLibDir, "test1", "1.0.0.20130101", true, true); + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + + File test1IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "staticFile1.bat"), fileContents); + + // Generate the IFix xml files for just ifix static content + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(alternateFixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Create test feature + Map featureContent = new HashMap(); + featureContent.put(TestUtils.createRelativePath(test1IFixStaticFile, uniqueTestDir), test1IFixStaticFile.getName()); + featureContent.put(TestUtils.createRelativePath(test1Jar, alternateWLPDir), test1Jar.getName()); + TestUtils.createFeature(new File(alternateFeaturesDir, "test-1.0.mf"), "test-1.0", featureContent); + + // Add the new repository for the alternate location. + BundleRepositoryRegistry.addBundleRepository(alternateWLPDir.getAbsolutePath(), "alternate"); + + // Run the validate command. + runValidateCommand(); + + // Check we have the expected error message + assertChecks(true, "The following fixes must be reapplied: [" + ifixName1 + "]."); + + // "Re-apply the ifix" + TestUtils.copyFile(test1IFixJar, new File(alternateLibDir, test1IFixJar.getName())); + TestUtils.copyFile(test1IFixStaticFile, new File(alternateBinDir, test1IFixStaticFile.getName())); + runValidateCommand(); + + // Check that the command is now happy and not reporting any reapplication msgs + assertChecks(false, null); + } + + /** + * This test proves that the correct file is checked when it is included in multiple ifix xmls. We work out the entry with the newest date + * and log the hash/location to use for checking. + * + * @throws Exception + */ + @Test + public void testValidateDisplaysIfixReApplicationForSameFileInMultipleIfixes() throws Exception { + + // Store the ifix jars in a temp dir outside of the wlp runtime, as we want to generate hashes but don't want them in the runtime. + // We will create the runtime version of jar 2 later in the test. + File test1IFixJar = TestUtils.createJarFile(ifixLibDir, "test1", "1.0.0.20130101", true, true); + File test2IFixJar = TestUtils.createJarFile(ifixLibDir, "test1", "1.0.0.20130201", true, false); + File test3IFixJar = TestUtils.createJarFile(ifixLibDir, "test1", "1.0.0.20130301", true, true); + + // Create the static files + StringBuffer fileContents = new StringBuffer(); + fileContents.append("This is the 1st line of file \n"); + fileContents.append("This is the 2nd line of file \n"); + + File test1IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "server.bat"), fileContents); + + // Create the 1st ifix.xml. It has the latest version of the test1 ifix jar. + Set updateFiles = new HashSet(); + updateFiles.add(""); + updateFiles.add(""); + String ifixName1 = "Test-Ifix1"; + TestUtils.createIfixXML(new File(fixesDir, "ifix1.xml"), ifixName1, updateFiles, TestUtils.generateSet("Apar1", "Apar2", "Apar3")); + + // Amend the static files so we get different hashes for each ifix xml. + fileContents.append("This is the 3rd line of file \n"); + + File test2IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "server.bat"), fileContents); + // Create the 2nd ifix.xml. This has been superseded and doen't have latest version of any of the files. + Set updateFiles2 = new HashSet(); + updateFiles2.add(""); + updateFiles2.add(""); + String ifixName2 = "Test-Ifix2"; + TestUtils.createIfixXML(new File(fixesDir, "ifix2.xml"), ifixName2, updateFiles2, TestUtils.generateSet("Apar4")); + + // Amend the static files so we get different hashes for each ifix xml. + fileContents.append("This is the 4th line of file \n"); + File test3IFixStaticFile = TestUtils.createFile(new File(ifixBinDir, "server.bat"), fileContents); + + // Create the 3rd ifix.xml. This has the latest version of server.bat. + Set updateFiles3 = new HashSet(); + updateFiles3.add(""); + updateFiles3.add(""); + String ifixName3 = "Test-Ifix3"; + TestUtils.createIfixXML(new File(fixesDir, "ifix3.xml"), ifixName3, updateFiles3, TestUtils.generateSet("Apar5")); + + // These are the jars files that are put in the runtime lib dir. + File test1Jar = TestUtils.createJarFile(libDir, "test1", "1.0.0", false, false); + + // Create test feature + Map featureFiles = new HashMap(); + featureFiles.put(TestUtils.createRelativePath(test1IFixStaticFile, uniqueTestDir), test1IFixStaticFile.getName()); + featureFiles.put(null, test1Jar.getName()); + TestUtils.createFeature(new File(featuresDir, "test-1.0.mf"), "test-1.0", featureFiles); + + runValidateCommand(); + // Check that the command has run successfully, and ensure it includes the reapply Ifix msg. + assertChecks2Ifixes(ifixName1, ifixName3); + + TestUtils.copyFile(test3IFixStaticFile, new File(binDir, test3IFixStaticFile.getName())); + TestUtils.copyFile(test3IFixJar, new File(libDir, test3IFixJar.getName())); + + runValidateCommand(); + // Check that the command has run successfully, and ensure no reapply Ifix msg is issued. + assertChecks(false, null); + } + + /** + * When a fix has been applied we need to use the latest version of the hashcode for validation. + * This test checks that the latest hash is used (and hence validation passes) for a static file + * after an ifix has been applied. + */ + @Test + public void testStaticContentIfixHashValidation() { + //mock up a feature + String featureName = "testIfixHash-1.0"; + File testFeatureFile = generateIfixFeatureWithChecksum(featureName); + + //create a "fixed" version of the feature manifest file + File fixedTestFeatureFile = generateAugmentedFeatureManifest(featureName, testFeatureFile, "SomeNewMfHeader: someFakeValue"); + + // Create an ifix.xml. It has the latest version of the feature manifest we are testing. + generateSingleFixXml(fixedTestFeatureFile, "TF0001", "2013-08-21 11:15", "Apar1"); + + //copy the fix file, equivalent to an archive install of the ifix + TestUtils.copyFile(fixedTestFeatureFile, testFeatureFile); + + //run the validation + runValidateCommand(); + + //check that validation succeeds and there are no reapply messages + assertChecks(false, null); + } + + /** + * This test ensures that date ordering works when multiple fixes are made to the same file + */ + @Test + public void testStaticContentMultipleIfixHashValidation() { + performMultipleFixTest(false); + } + + /** + * This test ensures that two fixes to the same static file with the same date still results + * in the correct hash being used for validation. + * This is testing for an issue caused because some fixes were published with incorrect (and constant) + * date information for some static files. + */ + @Test + public void testStaticContentMultipleIfixHashValidationSameDate() { + performMultipleFixTest(true); + } + + private void generateSingleFixXml(File fixFile, String ifixName, String date, String... apars) { + // Create an ifix.xml. It has the latest version of the feature manifest we are testing. + Set updateFiles = new HashSet(); + updateFiles.add(""); + TestUtils.createIfixXML(new File(fixesDir, ifixName + ".xml"), ifixName, updateFiles, TestUtils.generateSet(apars)); + } + + /** + * We need to run two very similar tests so we just common it up in this method + * + * @param useSameDateForSecondFix + */ + private void performMultipleFixTest(boolean useSameDateForSecondFix) { + //mock up a feature + String featureName = "testIfixHash-1.0"; + File testFeatureFile = generateIfixFeatureWithChecksum(featureName); + + //create a "fixed" version of the feature manifest file + File fixedTestFeatureFile = generateAugmentedFeatureManifest(featureName, testFeatureFile, "SomeNewMfHeader: someFakeValue"); + + // Create an ifix.xml + generateSingleFixXml(fixedTestFeatureFile, "TF0001", "2013-08-21 11:15", "Apar1"); + + // Now perform a second patch of the same file + File secondFixTestFeatureFile = generateAugmentedFeatureManifest(featureName, testFeatureFile, "AnotherNewMfHeader: differentValue"); + // Create another ifix.xml + generateSingleFixXml(secondFixTestFeatureFile, "TF0002", "2013-08-21 " + (useSameDateForSecondFix ? "11:15" : "12:15"), "Apar1", "Apar2"); + + //copy the fix file, equivalent to an archive install of the ifix + TestUtils.copyFile(secondFixTestFeatureFile, testFeatureFile); + + //run the validation + runValidateCommand(); + + //check that validation succeeds and there are no reapply messages + assertChecks(false, null); + } + + /** + * This method creates a mock feature manifest and the appropriate checksum file + * + * @param featureName + * @return + */ + private File generateIfixFeatureWithChecksum(String featureName) { + String featureMfName = featureName + ".mf"; + + //create a test feature + Map featureFiles = new HashMap(); + File testFeatureFile = TestUtils.createFeature(new File(featuresDir, featureName + ".mf"), featureName, featureFiles); + + //create a checksum for the original feature + String originalMfHash = TestUtils.generateHash(testFeatureFile); + StringBuffer csFileContent = new StringBuffer(); + csFileContent.append("lib/features/" + featureMfName); + csFileContent.append("="); + csFileContent.append(originalMfHash); + TestUtils.createFile(new File(featuresDir, "checksums/com.ibm.websphere.appserver." + featureName + ".cs"), csFileContent); + + return testFeatureFile; + } + + /** + * This method augments a feature manifest with some new content, to immitate the patching of a static file + * + * @param featureName + * @param featureFile + * @param newContent + * @return + */ + private File generateAugmentedFeatureManifest(String featureName, File featureFile, String newContent) { + StringBuffer fixContent = new StringBuffer(); + fixContent.append(newContent + "\n"); + //create the new file + File fixedTestFeatureFile = TestUtils.createFile(new File(ifixFeaturesDir, featureName + ".mf"), fixContent); + //append the rest of the feature content to our "fix" + TestUtils.copyFile(featureFile, fixedTestFeatureFile, true); + return fixedTestFeatureFile; + } + + /** + * This method asserts that the right messages are in the console logs. + * WARNING THIS ONLY WORKS FOR 1 IFIX the ifixes are a set not a list so could be in any order. + * + * @param ifixAppliedMessage - This boolean indicates whether the ifix reapply message is expected or not. + * If not, we assert that it isn't in the list. + * @parem ifixReApplicationMsg - The message to ensure is or isn't in the console logs. If the ifixReApplicationMsg is null, we just check that the + * "The following fixes must be reapplied:" prefix is either present or not present depending on the ifixApplicationMessage boolean. + */ + private void assertChecks(boolean ifixAppliedMessage, String ifixReApplicationMsg) { + + String ifixReApplicationMessagePrefix = "The following fixes must be reapplied:"; + // Assert that we always get a successful run of the command. + Assert.assertTrue("The console info messages don't contain message \"Product validation completed successfully.\": " + Arrays.toString(consoleInfoMessages.toArray()), + consoleInfoMessages.contains("Product validation completed successfully.")); + + if (ifixAppliedMessage) { + if (ifixReApplicationMsg == null) { + Assert.assertTrue("The console info messages don't contain message \"" + ifixReApplicationMessagePrefix + "\": " + + Arrays.toString(consoleInfoMessages.toArray()), + messagePrefixPresentInLogs(consoleInfoMessages, ifixReApplicationMessagePrefix)); + } else { + Assert.assertTrue("The console info messages don't contain message \"" + ifixReApplicationMsg + "\": " + + Arrays.toString(consoleInfoMessages.toArray()), consoleInfoMessages.contains(ifixReApplicationMsg)); + } + } else { + if (ifixReApplicationMsg == null) { + Assert.assertFalse("The console info messages unexpectedly contains message \"" + ifixReApplicationMessagePrefix + "\": " + + Arrays.toString(consoleInfoMessages.toArray()), + messagePrefixPresentInLogs(consoleInfoMessages, ifixReApplicationMessagePrefix)); + } else { + Assert.assertFalse("The console info messages unexpectedly contains message \"" + ifixReApplicationMsg + "\": " + + Arrays.toString(consoleInfoMessages.toArray()), consoleInfoMessages.contains(ifixReApplicationMsg)); + } + } + } + + /** + * This method asserts that 2 Ifixes are in the console logs in either order. + * It looks for strings of the form "The following fixes must be reapplied: [ifixName1,ifixName2]." + * or in the reverse order. If we ever needed to check for more than 2 ifies we should re-write this to take a list. + * + * @param ifixName1 - + * @parem ifixName2 - + */ + private void assertChecks2Ifixes(String ifixName1, String ifixName2) { + + String ifixReApplicationMessagePrefix = "The following fixes must be reapplied:"; + // Assert that we always get a successful run of the command. + Assert.assertTrue("The console info messages don't contain message \"Product validation completed successfully.\": " + Arrays.toString(consoleInfoMessages.toArray()), + consoleInfoMessages.contains("Product validation completed successfully.")); + + String message1 = "The following fixes must be reapplied: [" + ifixName1 + ", " + ifixName2 + "]."; + String message2 = "The following fixes must be reapplied: [" + ifixName2 + ", " + ifixName1 + "]."; + + Assert.assertTrue("The console info messages don't contain message \"" + message1 + "\" or \"" + message2 + "\": " + + Arrays.toString(consoleInfoMessages.toArray()), + consoleInfoMessages.contains(message1) || consoleInfoMessages.contains(message2)); + } + + /** + * This method checks all of the strings in the list of msgs, and checks to see if any entry starts with the specified prefix. + * + * @param msgs - The list of Strings to check + * @param msgPrefix - The prefix to check. + * @return - A boolean indicating whether any of the strings starts with the message prefix. + */ + private boolean messagePrefixPresentInLogs(List msgs, String msgPrefix) { + boolean msgFound = false; + for (String msg : msgs) { + if (msg.startsWith(msgPrefix)) + msgFound = true; + } + return msgFound; + } + + /** + * Run the validate Command after clearing the logs. + */ + private void runValidateCommand() { + consoleInfoMessages.clear(); + consoleErrorMessages.clear(); + TestUtils.refreshBundleRepository(); + task.doExecute(context); + //log the output in case we need to debug + List output = new ArrayList(); + output.addAll(consoleInfoMessages); + output.addAll(consoleErrorMessages); + System.out.println("====== Validate results for test " + name.getMethodName() + "======"); + for (String line : output) { + System.out.println(line); + } + } +} diff --git a/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/utils/TestUtils.java b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/utils/TestUtils.java new file mode 100755 index 00000000000..53400770c2d --- /dev/null +++ b/dev/com.ibm.ws.product.utility_test/unittest/src/com/ibm/ws/product/utility/extension/utils/TestUtils.java @@ -0,0 +1,406 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.product.utility.extension.utils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.lang.reflect.Field; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarOutputStream; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry; +import com.ibm.ws.kernel.provisioning.ContentBasedLocalBundleRepository; +import com.ibm.ws.kernel.provisioning.BundleRepositoryRegistry.BundleRepositoryHolder; +import com.ibm.ws.product.utility.extension.MD5Utils; + +/** + * + */ +public class TestUtils { + + // The pattern we use to break out the symbolic name and version from an ifix update xml element. + private static final Pattern updateSymbolicNameVersionPattern = Pattern.compile(".*id=\"(.*?)_(.*?)\\.jar.*"); + // The pattern we use to get the attrs from the ifix xml file element. + private static final Pattern updateAttrPattern = Pattern.compile(""); + + /** + * This method generates the ifix xml files that contain the files that are in the ifix install. This method also + * builds the Liberty Profile Metadata files for any jars supplied. + * + * @param ifixFile - The Ifix File to write to. + * @param ifixName - The name of the ifix + * @param updates - A Set of string containing the update file names. + * @param ifixApars - A set of String containing the apar numbers. + */ + public static void createIfixXML(File ifixFile, String ifixName, Set updates, Set ifixApars) { + + // The ifix xml buffer + StringBuffer ifixBuffer = new StringBuffer(); + // The Liberty profile metadata buffer if it is needed. + StringBuffer lpmfBuffer = new StringBuffer(); + + ifixBuffer.append("\n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" Web application response times are very slow\n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + for (String apar : ifixApars) + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + ifixBuffer.append(" \n"); + + lpmfBuffer.append("\n"); + lpmfBuffer.append(" \n"); + + for (String update : updates) { + ifixBuffer.append(" " + update + "\n"); + + // If the current update is a jar file, then work out the symbolicname and version and write the values out to the + // Liberty Profile Metadata file. + if (update.contains(".jar\"")) { + Matcher symbolicNameMatcher = updateSymbolicNameVersionPattern.matcher(update); + Matcher updateAttrMatcher = updateAttrPattern.matcher(update); + if (symbolicNameMatcher.matches() && updateAttrMatcher.matches()) { + String updateAttrString = updateAttrMatcher.group(1); + String symbolicName = symbolicNameMatcher.group(1); + if (symbolicName.contains("/")) + symbolicName = symbolicName.substring(symbolicName.lastIndexOf("/") + 1); + + lpmfBuffer.append(" \n"); + } + } + } + + ifixBuffer.append(" \n"); + ifixBuffer.append("\n"); + + lpmfBuffer.append(" \n"); + lpmfBuffer.append("\n"); + + createFile(ifixFile, ifixBuffer, false); + String ifixABSPath = ifixFile.getAbsolutePath(); + File lpmfFile = new File(ifixABSPath.substring(0, ifixABSPath.lastIndexOf(".")) + ".lpmf"); + createFile(lpmfFile, lpmfBuffer, false); + } + + /** + * This writes a StringBuffer out to the required file. The file is always overwritten. + * + * @param fileToWrite - The file to write the buffer to. + * @param buffer - A String buffer containing the contents of the file + */ + public static File createFile(File fileToWrite, StringBuffer buffer) { + return createFile(fileToWrite, buffer, false); + } + + /** + * This writes a StringBuffer out to the required file. + * + * @param fileToWrite - The file to write the buffer to. + * @param buffer - A String buffer containing the contents of the file + * @param append - Whether we should be appending to the file or overwriting it. + */ + public static File createFile(File fileToWrite, StringBuffer buffer, boolean append) { + FileOutputStream fos = null; + try { + //make any non-existent dirs + fileToWrite.getParentFile().mkdirs(); + + fos = new FileOutputStream(fileToWrite, append); + fos.write(buffer.toString().getBytes()); + } catch (Exception e) { + e.printStackTrace(System.err); + } finally { + if (fos != null) { + try { + fos.close(); + } catch (Exception e) { + e.printStackTrace(System.err); + } + } + } + return fileToWrite; + } + + /** + * This method deletes a file or directory. If a directory is passed it deletes the directory and + * all subdirectories and their contents. + * + * @param file - The file/Directory to delete. + */ + public static void delete(File file) { + // If this is a directory, then iterate over each element and recursively call this method for the child. + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (files != null) { + for (File child : files) { + delete(child); + } + } + } + + boolean deleted = file.delete(); + if (!deleted) + System.out.println("Unable to delete " + file.getAbsolutePath()); + } + + /** + * This method generates a hash for the requested file. + * + * @param file - The file to hash + * @return - A String containing the hash of the file. + */ + public static String generateHash(File file) { + String result = ""; + try { + result = MD5Utils.getFileMD5String(file); + } catch (Exception e) { + e.printStackTrace(System.err); + } + + return result; + } + + /** + * This method creates a jar which is symbolicName_version.jar which just contains a manifest. It adds ifix headers if required. + * + * @param directory - The directory in which to put the jar file + * @param symbolicName - The symbolic Name of the jar file + * @param version - The String representation of the version + * @param ifixJar - A boolean to indicate whether this is an ifix jar + * @param testFix - A boolean to indicate whether this is a test ifix or not. + * @return - The jar file. + */ + public static File createJarFile(File directory, String symbolicName, String version, boolean ifixJar, boolean testFix) { + + JarOutputStream jos = null; + FileOutputStream fos = null; + + File newJarFile = new File(directory, symbolicName + "_" + version + ".jar"); + + try { + fos = new FileOutputStream(newJarFile); + jos = new JarOutputStream(fos); + + // Create the manifest for the bundle. + String manifestFileName = "META-INF/MANIFEST.MF"; + //Generate the manifest using a StringBuffer. + StringBuffer buffer = new StringBuffer(); + buffer.append("Manifest-Version: 1.0\n"); + buffer.append("Bundle-SymbolicName: " + symbolicName + "\n"); + buffer.append("Bundle-Version: " + version + "\n"); + + if (ifixJar) { + if (testFix) { + buffer.append("IBM-Test-Fixes: apar1\n"); + } else { + buffer.append("IBM-Interim-Fixes: apar2\n"); + } + } + buffer.append("Bundle-ManifestVersion: 2\n\n"); + + // write out the jarEntry for the manifest. + JarEntry jarEntry = new JarEntry(manifestFileName); + jarEntry.setTime(System.currentTimeMillis()); + jos.putNextEntry(jarEntry); + jos.write(buffer.toString().getBytes()); + } catch (Exception e) { + e.printStackTrace(System.err); + } finally { + if (jos != null) { + try { + jos.close(); + } catch (Exception e) { + e.printStackTrace(System.err); + } + } + + if (fos != null) { + try { + fos.close(); + } catch (Exception e) { + e.printStackTrace(System.err); + } + } + + } + + return newJarFile; + } + + /** + * This method generate a set with the vars args supplied. + * + * @param elements The elements to be put in the set. + * @return The set containing the elements. + */ + public static Set generateSet(E... elements) { + Set result = new HashSet(); + for (E element : elements) + result.add(element); + + return result; + } + + /** + * This method creates a relative pathname based on an actual file and a toplevel dir. + * It also transforms "\"'s to "/"'s. + * + * So actual file c:\test\installroot\lib\file1.xml and topLevelDir of c:\test\installroot + * would return a value of lib/file1.xml. + * + * @param actualFile - The actual file we're creating a relative pathname for. + * @param topLevelDir - The Top level Dir that we remove from the actual pathname. + * @return - A relative pathname from the toplevel dir. + */ + public static String createRelativePath(File actualFile, File topLevelDir) { + String relativeFileName = actualFile.getAbsolutePath().substring(topLevelDir.getAbsolutePath().length() + 1); + if (relativeFileName.contains("\\")) + relativeFileName = relativeFileName.replace("\\", "/"); + + return relativeFileName; + } + + /** + * This method generates a test feature with the required subsystem content headers + * + * @param featureFile - The actual Feature File. + * @param featureName - the name of the feature + * @param subsystemContent - A Map of subsystem content.The key is the location string, and the value is the file name. + * @return - The file for the feature. + */ + public static File createFeature(File featureFile, String featureName, Map subsystemContent) { + // Create test feature + StringBuffer featureContents = new StringBuffer(); + featureContents.append("Subsystem-ManifestVersion: 1\n"); + featureContents.append("IBM-ShortName: " + featureName + "\n"); + featureContents.append("Subsystem-Type: osgi.subsystem.feature\n"); + featureContents.append("Subsystem-SymbolicName: com.ibm.websphere.appserver." + featureName + "\n"); + featureContents.append("Subsystem-Version: 1.0.0\n"); + featureContents.append("IBM-Feature-Version: 2\n"); + boolean writeHeader = true; + // Iterate over the subsystem content and add it to the header. We need to ensure that the 1st entry is prefixed with the header + // name and all entries have ,\n unless it is the last entry, which just has \n. + for (Map.Entry entry : subsystemContent.entrySet()) { + if (writeHeader) { + featureContents.append("Subsystem-Content:"); + writeHeader = false; + } else { + featureContents.append(",\n"); + } + String location = entry.getKey(); + String fileName = entry.getValue(); + if (fileName.endsWith(".jar")) { + String[] jarParts = fileName.split("_"); + if (fileName.contains("static")) { + featureContents.append(" " + jarParts[0] + "; location:=\"" + location + "\"; type=\"jar\""); + } else { + featureContents.append(" " + jarParts[0] + "; version=\"[1,1.0.100)\""); + } + } else { + featureContents.append(" " + fileName + "; location:=\"" + location + "\"; type=\"file\""); + } + } + featureContents.append("\n"); + + return createFile(featureFile, featureContents, false); + } + + /** + * This method refreshes the Bundle repository that is used to identify files that are within the liberty runtime. + * We have to refresh this because if we add a file to the runtime, it won't get picked up unless the repo is cleaned and + * it re-reads the dirs. This is effectively bouncing the liberty server. + * + * @return + */ + public static ContentBasedLocalBundleRepository refreshBundleRepository() { + + clearBundleRepositoryHolders(); + BundleRepositoryRegistry.initializeDefaults("server1", true); + return BundleRepositoryRegistry.getInstallBundleRepository(); + } + + /** + * This method clears the existing repositoryHolders from the BundleRepositoryRegistry. This behaves as though we were bouncing the + * Liberty server. + */ + public static void clearBundleRepositoryHolders() { + // Remove any existing and recreate the bundle repository that will work out the latest versions of the jars. + try { + Field repositoryHoldersField = BundleRepositoryRegistry.class.getDeclaredField("repositoryHolders"); + repositoryHoldersField.setAccessible(true); + Map m = (Map) repositoryHoldersField.get(null); + m.clear(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void copyFile(File originalFile, File destFile) { + copyFile(originalFile, destFile, false); + } + + /** + * This method copies the original file to the new destination. + * + * @param originalFile - The file to copy + * @param destFile - The location of the new file. + */ + public static void copyFile(File originalFile, File destFile, boolean appendToDest) { + FileInputStream fis = null; + FileOutputStream fos = null; + try { + fis = new FileInputStream(originalFile); + fos = new FileOutputStream(destFile, appendToDest); + + byte[] bytes = new byte[4096]; + int readBytes; + while ((readBytes = fis.read(bytes)) >= 0) { + fos.write(bytes, 0, readBytes); + } + fos.flush(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + if (fos != null) { + try { + fos.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + } +} diff --git a/dev/com.ibm.ws.repository.resolver_fat/.classpath b/dev/com.ibm.ws.repository.resolver_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.resolver_fat/.classpath.gradle b/dev/com.ibm.ws.repository.resolver_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.resolver_fat/.gitignore b/dev/com.ibm.ws.repository.resolver_fat/.gitignore new file mode 100644 index 00000000000..b47a9937a4d --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.gitignore @@ -0,0 +1,5 @@ +/dist +/bundles +/lib +/*.log* +/bootstrapping.properties diff --git a/dev/com.ibm.ws.repository.resolver_fat/.project b/dev/com.ibm.ws.repository.resolver_fat/.project new file mode 100755 index 00000000000..6fc7204fd8c --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.repository.resolver_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..99f26c0203a --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..845c3083c7d --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +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.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c874b581698 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd b/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd new file mode 100644 index 00000000000..fba254439ad --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd @@ -0,0 +1,25 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + org.eclipse.osgi;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.org.apache.aries.util.1.1.2;version=latest, \ + com.ibm.ws.product.utility;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.repository.test.utils;version=latest, \ + com.ibm.ws.repository.resolver;version=latest diff --git a/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd.gradle b/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..fba254439ad --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/bnd.bnd.gradle @@ -0,0 +1,25 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + org.eclipse.osgi;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.org.apache.aries.util.1.1.2;version=latest, \ + com.ibm.ws.product.utility;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.liberty;version=latest, \ + com.ibm.ws.repository.test.utils;version=latest, \ + com.ibm.ws.repository.resolver;version=latest diff --git a/dev/com.ibm.ws.repository.resolver_fat/build-test.xml b/dev/com.ibm.ws.repository.resolver_fat/build-test.xml new file mode 100755 index 00000000000..4cbb3559e5e --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/build-test.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.resolver_fat/build.gradle b/dev/com.ibm.ws.repository.resolver_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/FATSuite.java b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/FATSuite.java new file mode 100755 index 00000000000..4c92b02c6f7 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/FATSuite.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.resolver; + +import org.junit.ClassRule; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import com.ibm.ws.repository.base.servers.LarsServerRule; +import com.ibm.ws.repository.base.servers.MassiveServerRule; +import com.ibm.ws.repository.resolver.internal.RepositoryResolveContextFatTest; + +@RunWith(Suite.class) +@SuiteClasses({ + RepositoryResolverTest.RepositoryResolverTestLars.class, + RepositoryResolverTest.RepositoryResolverTestMassive.class, + RepositoryResolverTest.RepositoryResolverTestDirectory.class, + RepositoryResolveContextFatTest.RepositoryResolveContextFatTestLars.class, + RepositoryResolveContextFatTest.RepositoryResolveContextFatTestMassive.class, + RepositoryResolveContextFatTest.RepositoryResolveContextFatTestDirectory.class, +}) +public class FATSuite { + + @ClassRule + public static LarsServerRule larsResource; + static { + if (!System.getProperty("java.version").startsWith("1.6")) { + larsResource = new LarsServerRule(); + } + } + + @ClassRule + public static MassiveServerRule massiveResource = new MassiveServerRule(); + +} diff --git a/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/RepositoryResolverTest.java b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/RepositoryResolverTest.java new file mode 100755 index 00000000000..8803fdf6ede --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/RepositoryResolverTest.java @@ -0,0 +1,2496 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.resolver; + +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasProperty; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.junit.Assume.assumeTrue; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.jmock.Mockery; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.osgi.service.resolver.ResolutionException; + +import com.ibm.ws.kernel.feature.provisioning.ProvisioningFeatureDefinition; +import com.ibm.ws.kernel.productinfo.ProductInfo; +import com.ibm.ws.kernel.productinfo.ProductInfoParseException; +import com.ibm.ws.product.utility.extension.ifix.xml.IFixInfo; +import com.ibm.ws.product.utility.extension.ifix.xml.UpdatedFile; +import com.ibm.ws.repository.base.NoRepoAvailableException; +import com.ibm.ws.repository.base.servers.DirectoryConnectionRule; +import com.ibm.ws.repository.base.servers.LarsConnectionRule; +import com.ibm.ws.repository.base.servers.MassiveConnectionRule; +import com.ibm.ws.repository.base.servers.RestRepositoryConnectionRule; +import com.ibm.ws.repository.common.enums.InstallPolicy; +import com.ibm.ws.repository.common.enums.ResourceType; +import com.ibm.ws.repository.connections.ProductDefinition; +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RepositoryConnectionList; +import com.ibm.ws.repository.connections.SimpleProductDefinition; +import com.ibm.ws.repository.connections.liberty.ProductInfoProductDefinition; +import com.ibm.ws.repository.exceptions.RepositoryBackendException; +import com.ibm.ws.repository.exceptions.RepositoryException; +import com.ibm.ws.repository.exceptions.RepositoryResourceException; +import com.ibm.ws.repository.resolver.RepositoryResolutionException.MissingRequirement; +import com.ibm.ws.repository.resolver.internal.resource.LpmResource; +import com.ibm.ws.repository.resolver.ResolverTestUtils; +import com.ibm.ws.repository.resources.RepositoryResource; +import com.ibm.ws.repository.resources.internal.EsaResourceImpl; +import com.ibm.ws.repository.resources.internal.IfixResourceImpl; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; +import com.ibm.ws.repository.resources.internal.SampleResourceImpl; +import com.ibm.ws.repository.strategies.writeable.BaseStrategy; + +/** + * Tests for {@link RepositoryResolver} + */ +public class RepositoryResolverTest { + + private int _count = 0; + + private RepositoryConnectionList _loginInfoList; + + @Rule + public RestRepositoryConnectionRule connection; + + private RepositoryConnection getConnection() { + return connection.getConnection(); + } + + public static class RepositoryResolverTestMassive extends RepositoryResolverTest { + public RepositoryResolverTestMassive() { + connection = new MassiveConnectionRule(FATSuite.massiveResource); + } + } + + public static class RepositoryResolverTestLars extends RepositoryResolverTest { + public RepositoryResolverTestLars() { + if (FATSuite.larsResource != null) { + connection = new LarsConnectionRule(FATSuite.larsResource); + } + } + } + + public static class RepositoryResolverTestDirectory extends RepositoryResolverTest { + public RepositoryResolverTestDirectory() { + connection = new DirectoryConnectionRule(); + } + } + + /** + * Don't run tests if the connection is null. This will happen where + * (for example) it is a LARS connection running on a Java 6 VM. + */ + @Before + public void skipIfNullConnection() { + assumeTrue(connection != null); + } + + @Before + public void setupLoginInfo() throws NoRepoAvailableException { + // Unlike most tests resolver wants to use a collection of LoginInfoResources so create one and use that instead + if (connection != null) { + _loginInfoList = new RepositoryConnectionList(getConnection()); + } + } + + /** + * Test to make sure a single feature can be obtained from Massive by symbolic name + * + * @throws Throwable + */ + @Test + public void testSingleFeatureBySymbolicName() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure a single feature can be obtained from Massive by short name + * + * @throws ResolutionException + * @throws RepositoryException + */ + @Test + public void testSingleFeatureByShortName() throws RepositoryException, ResolutionException { + String symbolicName = "com.ibm.ws.test-1.0"; + String shortName = "test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, shortName, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(shortName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure a single feature can be obtained from Massive by short name with the wrong case + * + * @throws ResolutionException + * @throws RepositoryException + */ + @Test + public void testSingleFeatureByWrongCasedShortName() throws RepositoryException, ResolutionException { + String symbolicName = "com.ibm.ws.test-1.0"; + String shortName = "teST-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, shortName, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve("TEst-1.0"); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure that if a feature is already installed you get an empty collection back. + * + * @throws RepositoryException + */ + @Test + public void testFeatureThatIsAlreadyInstalled() throws RepositoryException { + String symbolicName = "com.ibm.ws.test-1.0"; + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, symbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("The resource is already installed so should not of been returned", 0, resolvedResources.size()); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Test to make sure a single feature can be obtained from Massive by symbolic name and version + * + * @throws ResolutionException + * @throws RepositoryException + */ + @Test + public void testSingleFeatureBySymbolicNameAndVersion() throws RepositoryException, ResolutionException { + // Add two test resources to massive, we want to make sure we get the right one + String symbolicName = "com.ibm.ws.test-1.0"; + String correctVersion = "1.0.0.0"; + createEsaResource(symbolicName, null, "1.0.0.1"); + EsaResourceImpl correctResource = createEsaResource(symbolicName, null, correctVersion); + + // Now see if we can resolve it! + String toResolve = symbolicName + "/" + correctVersion; + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(toResolve); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied at the right version", resolvedResources.iterator().next().contains(correctResource)); + } + + /** + * Test a feature dependency in the repo + */ + @Test + public void testFeatureDependencyInRepo() throws RepositoryException, ResolutionException { + // Add two test resources to massive, we want to make sure they both are returned in the right order + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + EsaResourceImpl dependencyResource = createEsaResource(secondSymbolicName, null, "1.0.0.1"); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resource", 2, resolvedResources.iterator().next().size()); + assertEquals("The dependency should be installed first", dependencyResource, resolvedResources.iterator().next().get(0)); + assertEquals("The resource being resolved should be installed second", firstResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Test a feature dependency in the install + */ + @Test + public void testFeatureDependencyInInstall() throws RepositoryException, ResolutionException { + // Add one test resource to massive, but make a dependency to an already installed feature + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, secondSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertEquals("The resource being resolved should be the one in the list", firstResource, resolvedResources.iterator().next().get(0)); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Test when there are two features with the same symbolic name that the latest one is picked + */ + @Test + public void testFeaturePicked() throws RepositoryException, ResolutionException { + // Add two test resources to massive, we want to make sure we get the right one + String symbolicName = "com.ibm.ws.test-1.0"; + createEsaResource(symbolicName, null, "1.0.0.0"); + EsaResourceImpl secondResource = createEsaResource(symbolicName, null, "1.0.0.1"); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one with the latest version", resolvedResources.iterator().next().contains(secondResource)); + } + + /** + * Test when there is a feature dependency installed and in the repo then the one in the install is picked + */ + @Test + public void testFeatureDependencyInInstallPicked() throws RepositoryException, ResolutionException { + // Add two test resources to massive, and one to the install the resolver should not return the dependency feature from Massive even if it's a better version + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + createEsaResource(secondSymbolicName, null, "1.0.0.1"); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, secondSymbolicName, null, "1.0.0.0"); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertEquals("The resource being resolved should be the one in the list", firstResource, resolvedResources.iterator().next().get(0)); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Test applies to is used to work out the best feature to install + * + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testFeatureWithAppliesToFilters() throws RepositoryException, ResolutionException, IOException, ProductInfoParseException { + // Add two test resources to massive, we want to make sure we get the right one, even though the second one is a higher number the first should be picked as it applies to the correct product + String symbolicName = "com.ibm.ws.test-1.0"; + createEsaResource(symbolicName, null, "1.0.0.1", null, "com.ibm.ws.test.product; productVersion=5.0.0.1; productEdition=DEVELOPERS"); + EsaResourceImpl correctResource = createEsaResource(symbolicName, null, "1.0.0.0", null, "com.ibm.ws.test.product; productVersion=5.0.0.0; productEdition=DEVELOPERS"); + + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.ws.test.product", "DEVELOPERS", "5.0.0.0", null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one with the correct applies to", resolvedResources.iterator().next().contains(correctResource)); + } + + /** + * Tests that if you have a dependency in the install and a different dependency in the repo then it all works ok + */ + @Test + public void testFeatureDependencyInInstallAndRepo() throws RepositoryException, ResolutionException { + // Add two test resources to massive, and one different dependency to the install the resolver should return the dependency feature from Massive + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(secondSymbolicName); + dependencies.add(thirdSymbolicName); + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, dependencies, null); + EsaResourceImpl dependencyInMassive = createEsaResource(secondSymbolicName, null, null); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, thirdSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resource", 2, resolvedResources.iterator().next().size()); + assertEquals("The dependency in massive should be installed first", dependencyInMassive, resolvedResources.iterator().next().get(0)); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(1)); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Tests that when you have a chain of feature dependencies then they are all returned and in the right order + */ + @Test + public void testChainedFeatureDependencies() throws RepositoryException, ResolutionException { + // Add three test resources in a chain to massive + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + EsaResourceImpl firstDependency = createEsaResource(secondSymbolicName, null, null, Collections.singleton(thirdSymbolicName), null); + EsaResourceImpl secondDependency = createEsaResource(thirdSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be three resolved resource", 3, resolvedResources.iterator().next().size()); + assertEquals("The final dependency in massive should be installed first", secondDependency, resolvedResources.iterator().next().get(0)); + assertEquals("The first dependency in massive should be installed second", firstDependency, resolvedResources.iterator().next().get(1)); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(2)); + } + + /** + * Tests that when you have a chain of feature dependencies with multiple features depending on the end of the chain then the install order is still correct + */ + @Test + public void testChainedFeatureDependenciesWithMultipleRoutes() throws RepositoryException, ResolutionException { + // Add four test resources in a chain to massive with the final resource having two routes to it + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + String fourthSymbolicName = "com.ibm.ws.test.third.dep-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(secondSymbolicName); + dependencies.add(thirdSymbolicName); + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, dependencies, null); + EsaResourceImpl firstDependency = createEsaResource(secondSymbolicName, null, null, Collections.singleton(fourthSymbolicName), null); + EsaResourceImpl secondDependency = createEsaResource(thirdSymbolicName, null, null, Collections.singleton(fourthSymbolicName), null); + EsaResourceImpl finalDependency = createEsaResource(fourthSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be four resolved resource", 4, resolvedResources.iterator().next().size()); + assertEquals("The final dependency in massive should be installed first", finalDependency, resolvedResources.iterator().next().get(0)); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(3)); + + // The order of the middle two doesn't matter as long as they are in the middle somewhere + assertTrue("The first dependency should be in the resolved list", resolvedResources.iterator().next().contains(firstDependency)); + assertTrue("The second dependency should be in the resolved list", resolvedResources.iterator().next().contains(secondDependency)); + } + + /** + * Test an iFix dependency in the repo + */ + @Test + public void testFixDependencyInRepo() throws RepositoryException, ResolutionException { + // Add a test resource to massive with a dependency on an iFix + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, Collections.singleton(fixId)); + IfixResourceImpl iFixResource = createIFixResource(fixId, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resources", 2, resolvedResources.iterator().next().size()); + assertEquals("The iFix needs to be installed first", iFixResource, resolvedResources.iterator().next().get(0)); + assertEquals("The feature should be installed second", testResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Test an iFix dependency in the install + */ + @Test + public void testFixDependencyInInstall() throws RepositoryException, ResolutionException { + // Add a test resource to massive with a dependency on an iFix that is already installed + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, Collections.singleton(fixId)); + + IFixInfo iFixInfo = new IFixInfo(null, null, Collections.singleton(fixId), null, null, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections.singleton(iFixInfo), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resources", 1, resolvedResources.iterator().next().size()); + assertEquals("The feature should be in the resolved list", testResource, resolvedResources.iterator().next().get(0)); + } + + /** + * Test when there are two iFixes for the same fix that the latest one is picked + */ + @Test + public void testBestIFixPicked() throws RepositoryException, ResolutionException { + // Add a test resource to massive with a dependency on an iFix but where there are two fixes to the same iFix + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, Collections.singleton(fixId)); + createIFixResource(fixId, null, new Date(1)); + IfixResourceImpl newIFixResource = createIFixResource(fixId, null, new Date(10000000)); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resources", 2, resolvedResources.iterator().next().size()); + assertEquals("The new iFix needs to be installed first", newIFixResource, resolvedResources.iterator().next().get(0)); + assertEquals("The feature should be installed second", testResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Test when there are two iFixes for the same fix that the one with a date set is picked over a null value + */ + @Test + public void testIFixWithDateSetPicked() throws RepositoryException, ResolutionException { + // Add a test resource to massive with a dependency on an iFix but where there are two fixes to the same iFix + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, Collections.singleton(fixId)); + createIFixResource(fixId, null, null); + IfixResourceImpl newIFixResource = createIFixResource(fixId, null, new Date(1)); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resources", 2, resolvedResources.iterator().next().size()); + assertEquals("The new iFix needs to be installed first", newIFixResource, resolvedResources.iterator().next().get(0)); + assertEquals("The feature should be installed second", testResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Test when there is an iFix dependency installed and in the repo then the one in the install is picked + */ + @Test + public void testFixDependencyInInstallPicked() throws RepositoryException, ResolutionException { + // Add a test resource to massive with a dependency on an iFix that is in the install and massive and make sure that it picks the install one even when the massive one is later + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, Collections.singleton(fixId)); + createIFixResource(fixId, null, new Date(10000000)); + + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + UpdatedFile updatedFile = new UpdatedFile(null, 0, dateFormat.format(new Date(0)), null); + IFixInfo iFixInfo = new IFixInfo(null, null, Collections.singleton(fixId), null, null, null, Collections.singleton(updatedFile)); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections.singleton(iFixInfo), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resources", 1, resolvedResources.iterator().next().size()); + assertEquals("The feature should be in the resolved list", testResource, resolvedResources.iterator().next().get(0)); + } + + /** + * Test applies to is used to work out the best fix to install + * + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testFixWithAppliesToFilters() throws RepositoryException, ResolutionException, IOException, ProductInfoParseException { + // Add a test resource to massive with a dependency on an iFix but where there are two fixes to the same iFix + String symbolicName = "com.ibm.ws.test-1.0"; + String fixId = "PM00001"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null, null, "com.ibm.ws.test.product", null, false, Collections.singleton(fixId)); + + createIFixResource(fixId, "com.ibm.ws.test.product; productVersion=5.0.0.1; productEdition=DEVELOPERS", new Date(10000000)); + IfixResourceImpl correctIFix = createIFixResource(fixId, "com.ibm.ws.test.product; productVersion=5.0.0.0; productEdition=DEVELOPERS", new Date(0)); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new SimpleProductDefinition("com.ibm.ws.test.product", "5.0.0.0", null, null, "DEVELOPERS")), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resources", 2, resolvedResources.iterator().next().size()); + assertEquals("The iFix needs to be installed first", correctIFix, resolvedResources.iterator().next().get(0)); + assertEquals("The feature should be installed second", testResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Tests that if you have an IFix dependency in the install and a different dependency in the repo then it all works ok + */ + @Test + public void testFixDependencyInInstallAndRepo() throws RepositoryException, ResolutionException { + // Create a feature with two iFix dependencies, one in massive, the other in the install + String symbolicName = "com.ibm.ws.test-1.0"; + String fix1Id = "PM00001"; + String fix2Id = "PM00002"; + Collection fixIds = new HashSet(); + fixIds.add(fix1Id); + fixIds.add(fix2Id); + EsaResourceImpl testResource = createEsaResource(symbolicName, fixIds); + IfixResourceImpl iFixResource = createIFixResource(fix1Id, null, null); + + IFixInfo iFixInfo = new IFixInfo(null, null, Collections.singleton(fix2Id), null, null, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections.singleton(iFixInfo), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be two resolved resources", 2, resolvedResources.iterator().next().size()); + assertEquals("The iFix should be installed first", iFixResource, resolvedResources.iterator().next().get(0)); + assertEquals("The feature should be installed second", testResource, resolvedResources.iterator().next().get(1)); + + } + + /** + * Tests that if you have multiple IFix dependencies in the repo then it all works ok + */ + @Test + public void testMultipleFixDependencyInRepo() throws RepositoryException, ResolutionException { + // Create a feature with two iFix dependencies, one in massive, the other in the install + String symbolicName = "com.ibm.ws.test-1.0"; + String fix1Id = "PM00001"; + String fix2Id = "PM00002"; + Collection fixIds = new HashSet(); + fixIds.add(fix1Id); + fixIds.add(fix2Id); + EsaResourceImpl testResource = createEsaResource(symbolicName, fixIds); + IfixResourceImpl iFixResource = createIFixResource(fix1Id, null, null); + IfixResourceImpl iFix2Resource = createIFixResource(fix2Id, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + List orderedResourceList = resolvedResources.iterator().next(); + assertEquals("There should be three resolved resources", 3, orderedResourceList.size()); + assertEquals("The feature should be installed last", testResource, resolvedResources.iterator().next().get(2)); + assertTrue("The iFix should be installed before the feature", orderedResourceList.contains(iFixResource)); + assertTrue("The second iFix should be installed before the feature", orderedResourceList.contains(iFix2Resource)); + + } + + /** + * Tests that when you have a chain of feature dependencies that each have a required fix then they are all returned and in the right order, the features at each level should + * always be installed first + */ + @Test + public void testChainedFixDependencies() throws RepositoryException, ResolutionException { + // Kitchen sink test, specifically testing that iFix and feature dependencies at the same level are returned in the right order + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + String fourthSymbolicName = "com.ibm.ws.test.fourth.dep-1.0"; + String fix1Id = "PM00001"; + String fix2Id = "PM00002"; + String fix3Id = "PM00003"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null, null, false, + Collections.singleton(fix1Id)); + EsaResourceImpl firstDependency = createEsaResource(secondSymbolicName, null, null, Collections.singleton(thirdSymbolicName), null, null, false, + Collections.singleton(fix2Id)); + EsaResourceImpl secondDependency = createEsaResource(thirdSymbolicName, null, null, Collections.singleton(fourthSymbolicName), null, null, false, + Collections.singleton(fix3Id)); + IfixResourceImpl iFix1Resource = createIFixResource(fix1Id, null, null); + IfixResourceImpl iFix2Resource = createIFixResource(fix2Id, null, null); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, fourthSymbolicName, null, null); + IFixInfo iFixInfo = new IFixInfo(null, null, Collections.singleton(fix3Id), null, null, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections.singleton(iFixInfo), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be five resolved resource", 5, resolvedResources.iterator().next().size()); + assertEquals("The final feature dependency in massive should be installed first", secondDependency, resolvedResources.iterator().next().get(0)); + assertEquals("The final iFix dependency should be installed second (after the feature it might fix)", iFix2Resource, resolvedResources.iterator().next().get(1)); + assertEquals("The middle feature dependency in massive should be installed third", firstDependency, resolvedResources.iterator().next().get(2)); + assertEquals("The middle iFix dependency should be installed fourth (after the feature it might fix)", iFix1Resource, resolvedResources.iterator().next().get(3)); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(4)); + + mockery.assertIsSatisfied(); + + } + + /** + * Make sure the resolution error message is fairly helpful + * + * @throws RepositoryException + */ + @Test + public void testResolutionMessage() throws RepositoryException { + String missingSymbolicName = "does.not.exist"; + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(missingSymbolicName); + fail("The resource does not exist so should not resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + missingSymbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(missingSymbolicName)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound().contains(missingSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the feature itself " + + e.getAllRequirementsResourcesNotFound(), missingSymbolicName, missingRequirement.requirementName); + assertNull("The exception should say there is no resource that owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Test to make sure if it isn't a top level feature that is missing you get the right message + */ + @Test + public void testResolutionMessageDeepFeatureMissing() throws RepositoryException { + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.other.dep-1.0"; + createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + RepositoryResourceImpl secondResource = createEsaResource(secondSymbolicName, null, "1.0.0.1", Collections.singleton(thirdSymbolicName), null); + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(Collections.singleton(firstSymbolicName)); + fail("The resource does not exist so should not resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state the top level feature that couldn't be resolved but it is: " + e.getMessage(), + e.getMessage().contains("resource=" + firstSymbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(firstSymbolicName)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertThat("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound(), contains(thirdSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the third feature " + + e.getAllRequirementsResourcesNotFound(), thirdSymbolicName, missingRequirement.requirementName); + assertEquals("The exception should include the resource that owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), secondResource, missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Test to make sure if you get further by doing a short name resolution you get the right message + */ + @Test + public void testResolutionShortNameTopLevel() throws RepositoryException { + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String firstShortName = "test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + RepositoryResourceImpl resource = createEsaResource(firstSymbolicName, firstShortName, null, Collections.singleton(secondSymbolicName), null); + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(Collections.singleton(firstShortName)); + fail("The resource does not exist so should not resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state the top level feature that couldn't be resolved but it is: " + e.getMessage(), + e.getMessage().contains("resource=" + firstShortName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(firstShortName)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound().contains(secondSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the second feature " + + e.getAllRequirementsResourcesNotFound(), secondSymbolicName, missingRequirement.requirementName); + assertEquals("The exception should include the resource that owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), resource, missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Test to make sure if you get further by doing a case insensitive short name resolution you get the right message + */ + @Test + public void testResolutionCaseInsensitiveShortNameTopLevel() throws RepositoryException { + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String firstShortName = "teST-1.0"; + String otherCaseShortName = "TEst-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + RepositoryResourceImpl resource = createEsaResource(firstSymbolicName, firstShortName, null, Collections.singleton(secondSymbolicName), null); + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(Collections.singleton(otherCaseShortName)); + fail("The resource does not exist so should not resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state the top level feature that couldn't be resolved but it is: " + e.getMessage(), + e.getMessage().contains("resource=" + otherCaseShortName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed but was: " + e.getTopLevelFeaturesNotResolved(), + e.getTopLevelFeaturesNotResolved().contains(otherCaseShortName)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertThat("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound(), contains(secondSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the second feature " + + e.getAllRequirementsResourcesNotFound(), secondSymbolicName, missingRequirement.requirementName); + assertEquals("The exception should include the resource that owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), resource, missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Make sure that iFixes cannot be directly resolved. Note this is a largely artificial restriction added because only feature manager is going to be used instead of a liberty + * package manager. There is nothing intrinsic in the resolver that stops iFixes being resolved except the {@link LpmResource} says it is only looking for features. + * + * @throws RepositoryException + */ + @Test + public void testFixesDontResolve() throws RepositoryException { + String fixId = "PM00001"; + createIFixResource(fixId, null, null); + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(fixId); + fail("The resource being searched for is an IFix so shouldn't resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + fixId)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(fixId)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound().contains(fixId)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the fix " + + e.getAllRequirementsResourcesNotFound(), fixId, missingRequirement.requirementName); + assertNull("The exception should state that no resource owns the requirement " + + e.getAllRequirementsResourcesNotFound(), missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Test to make sure multiple features can be resolved in a single step. + * + * @throws RepositoryException + * @throws ResolutionException + */ + @Test + public void testMultipleFeatures() throws RepositoryException, ResolutionException { + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.second-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null); + EsaResourceImpl secondResource = createEsaResource(secondSymbolicName, null, null); + Collection namesToResolve = new HashSet(); + namesToResolve.add(firstSymbolicName); + namesToResolve.add(secondSymbolicName); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(namesToResolve); + assertEquals("There should be a list of resources for each top level feature", 2, resolvedResources.size()); + Collection allResolvedResources = new ArrayList(); + for (List massiveResourceList : resolvedResources) { + allResolvedResources.addAll(massiveResourceList); + } + assertEquals("There should be two resolved resource", 2, allResolvedResources.size()); + assertTrue("The first resource should be resolve", allResolvedResources.contains(firstResource)); + assertTrue("The second resource should be resolve", allResolvedResources.contains(secondResource)); + } + + /** + * Test to make sure multiple features with one missing throws an exception + * + * @throws RepositoryException + * @throws ResolutionException + */ + @Test + public void testMultipleFeaturesWithOneMissing() throws RepositoryException, ResolutionException { + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.missing-1.0"; + createEsaResource(firstSymbolicName, null, null); + Collection namesToResolve = new HashSet(); + namesToResolve.add(firstSymbolicName); + namesToResolve.add(secondSymbolicName); + + // Now see if we can resolve it! + try { + new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList).resolve(namesToResolve); + fail("Missing the second feature so should have failed to resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The exception should contain the info about the missing resource but was: " + e.getMessage(), e.getMessage().contains("resource=" + secondSymbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(secondSymbolicName)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound().contains(secondSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the third feature " + + e.getAllRequirementsResourcesNotFound(), secondSymbolicName, missingRequirement.requirementName); + assertNull("The exception should state no resource owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Test to make sure we can resolve multiple features using a mix of short and symbolic names + * + * @throws RepositoryException + */ + @Test + public void testMultipleFeaturesShortAndSymbolic() throws RepositoryException { + String firstSymbolicName = "com.ibm.ws.testa-1.0"; + String firstShortName = "TestA-1.0"; + String secondSymbolicName = "com.ibm.ws.testb-1.0"; + String secondShortName = "TestB-1.0"; + String thirdSymbolicName = "com.ibm.ws.testc-1.0"; + String thirdShortName = "TestC-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, firstShortName, null); + EsaResourceImpl secondResource = createEsaResource(secondSymbolicName, secondShortName, null); + EsaResourceImpl thirdResource = createEsaResource(thirdSymbolicName, thirdShortName, null); + + Collection namesToResolve = new HashSet(); + namesToResolve.add(firstSymbolicName); + namesToResolve.add(secondShortName); + namesToResolve.add(thirdShortName.toLowerCase()); + + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(namesToResolve); + // Flatten the list of resolvedResources + Set flatResolvedResources = new HashSet(); + for (List massiveResourceList : resolvedResources) { + flatResolvedResources.addAll(massiveResourceList); + } + + assertEquals("There should be three resolved resources", 3, flatResolvedResources.size()); + assertTrue("The first resource should be resolved", flatResolvedResources.contains(firstResource)); + assertTrue("The second resource should be resolved", flatResolvedResources.contains(secondResource)); + assertTrue("The third resource should be resolved", flatResolvedResources.contains(thirdResource)); + } + + /** + * Test to make sure an auto feature is not automatically installed if its capabilities are not met + * + * @throws Throwable + */ + @Test + public void testAutoFeatureNotSatisfied() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the unsatisfied auto-resource + createEsaResource("not.satisfied", null, null, null, null, Collections.singleton("does.not.exist"), true, null); + + // Now see if we can resolve just the single feature + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure an auto feature is not automatically installed if its capabilities are not met due to a missing iFix + * + * @throws Throwable + */ + @Test + public void testAutoFeatureNotSatisfiedWhenIFixMissing() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the resource that depends on an iFix + createEsaResource("auto.feature.with.ifix.dep", null, null, null, null, Collections.singleton(symbolicName), true, Collections.singleton("PM00001")); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure an auto feature is automatically installed if its capabilities are met by what is being installed + * + * @throws Throwable + */ + @Test + public void testAutoFeatureSatisfiedByNewFeature() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = createEsaResource("satisfied.auto.feature", null, null, null, null, Collections.singleton(symbolicName), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be two lists of resources one for the feature being installed and one for the auto feature, set is:" + resolvedResources, 2, + resolvedResources.size()); + boolean foundFeatureList = false; + boolean foundAutoList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(testResource) && resolvedList.size() == 1) { + foundFeatureList = true; + } else if (resolvedList.contains(autoFeature)) { + foundAutoList = true; + assertEquals("There should be 2 resolved resources in the auto list", 2, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(1)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found feature", foundFeatureList); + assertTrue("Should have found auto", foundAutoList); + } + + /** + * Test to make sure an auto feature is automatically installed if its capabilities are met by what is being installed even if it is through an OR relationships + * + * @throws Throwable + */ + @Test + public void testAutoFeatureWithSatisfiedByNewFeatureAndOtherAutoFeature() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + String requiredAutoFeatureSymbolicName = "com.ibm.ws.auto-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + EsaResourceImpl requiredAutoFeature = createEsaResource(requiredAutoFeatureSymbolicName, null, null, null, null, Collections.singleton(symbolicName), true, null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = new EsaResourceImpl(getConnection()); + autoFeature.setProvideFeature("satisfied.auto.feature"); + autoFeature.setName("name"); + String ibmProvisionCapability = "osgi.identity; filter:=\"(&(type=osgi.subsystem.feature)(osgi.identity=" + symbolicName + + "))\", osgi.identity; filter:=\"(&(type=osgi.subsystem.feature)(osgi.identity=" + requiredAutoFeatureSymbolicName + "))\""; + autoFeature.setProvisionCapability(ibmProvisionCapability.toString()); + autoFeature.setInstallPolicy(InstallPolicy.WHEN_SATISFIED); + uploadResource(autoFeature); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be three lists of resources one for the feature being installed and one for each of the auto feature, set is:" + resolvedResources, 3, + resolvedResources.size()); + boolean foundFeatureList = false; + boolean foundAutoList = false; + boolean foundRequiredAutoList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(testResource) && resolvedList.size() == 1) { + foundFeatureList = true; + } else if (resolvedList.contains(requiredAutoFeature) && resolvedList.size() == 2) { + foundRequiredAutoList = true; + assertEquals("Required Auto should be installed last", requiredAutoFeature, resolvedList.get(1)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + } else if (resolvedList.contains(autoFeature)) { + foundAutoList = true; + assertEquals("There should be 3 resolved resources in the auto list", 3, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(2)); + assertEquals("Required auto feature should be installed", requiredAutoFeature, resolvedList.get(1)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found feature", foundFeatureList); + assertTrue("Should have found auto", foundAutoList); + assertTrue("Should have found required auto", foundRequiredAutoList); + } + + /** + * Test to make sure an auto feature is automatically installed if its capabilities are met by what is being installed even if it is through an OR relationships + * + * @throws Throwable + */ + @Test + public void testAutoFeatureWithOrSatisfiedByNewFeature() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = new EsaResourceImpl(getConnection()); + autoFeature.setProvideFeature("satisfied.auto.feature"); + autoFeature.setName("name"); + StringBuilder ibmProvisionCapability = new StringBuilder(); + ibmProvisionCapability.append("osgi.identity; filter:=\"(|(&(type=osgi.subsystem.feature)(osgi.identity=" + symbolicName + + "))(&(type=osgi.subsystem.feature)(osgi.identity=other)))\""); + autoFeature.setProvisionCapability(ibmProvisionCapability.toString()); + autoFeature.setInstallPolicy(InstallPolicy.WHEN_SATISFIED); + uploadResource(autoFeature); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be two lists of resources one for the feature being installed and one for the auto feature, set is:" + resolvedResources, 2, + resolvedResources.size()); + boolean foundFeatureList = false; + boolean foundAutoList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(testResource) && resolvedList.size() == 1) { + foundFeatureList = true; + } else if (resolvedList.contains(autoFeature)) { + foundAutoList = true; + assertEquals("There should be 2 resolved resources in the auto list", 2, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(1)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found feature", foundFeatureList); + assertTrue("Should have found auto", foundAutoList); + } + + /** + * Test to make sure an auto feature that is satisified by a feature in massive that is not in the install list doesn't cause that feature to be installed + * + * @throws Throwable + */ + @Test + public void testAutoFeatureDoesntPullInMoreFeatures() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + String symbolicNameForCapability = "com.ibm.ws.capabilit-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + createEsaResource(symbolicNameForCapability, null, null); + + // Now add the auto feature + createEsaResource("satisfiable.auto.feature", null, null, null, null, Collections.singleton(symbolicNameForCapability), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resources", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resources should contain the one we were looking for", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure when an auto feature is satisfied but has subsystem content listing another feature then it is installed pulls in the required feature. + * + * @throws Throwable + */ + @Test + public void testAutoFeaturePullsInSubsystemContentFeatures() throws Throwable { + // Add a test resource to massive + String mainFeatureSymbolicName = "com.ibm.ws.test-1.0"; + String autoFeatureSymbolicName = "com.ibm.ws.auto-1.0"; + String dependentFeatureSymbolicName = "com.ibm.ws.dependent-1.0"; + EsaResourceImpl mainFeature = createEsaResource(mainFeatureSymbolicName, null, null); + EsaResourceImpl dependentFeature = createEsaResource(dependentFeatureSymbolicName, null, null); + + // Now add the auto feature + EsaResourceImpl autoFeature = createEsaResource(autoFeatureSymbolicName, null, null, Collections.singleton(dependentFeatureSymbolicName), null, + Collections.singleton(mainFeatureSymbolicName), true, + null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(mainFeatureSymbolicName); + assertEquals("There should be two lists of resources, set is:" + resolvedResources, 2, resolvedResources.size()); + boolean foundAutoList = false; + boolean foundMainList = false; + for (List resources : resolvedResources) { + if (resources.size() == 1) { + assertEquals(mainFeature, resources.get(0)); + foundMainList = true; + } else if (resources.size() == 3) { + assertTrue("Dependencies should be installed first " + resources, resources.contains(mainFeature)); + assertTrue("Dependencies should be installed first " + resources, resources.contains(dependentFeature)); + assertEquals("Auto feature should be installed last as it depends on the other two " + resources, autoFeature, resources.get(2)); + foundAutoList = true; + } else { + fail("Unkown list of resources: " + resources); + } + } + assertTrue(foundAutoList); + assertTrue(foundMainList); + } + + /** + * Test to make sure an auto feature is installed if it is explicitly asked for and pulls in it's dependent features. + * + * @throws Throwable + */ + @Test + public void testAutoFeatureExplicitlyAskedFor() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + String autoSymbolicName = "com.ibm.ws.auto-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = createEsaResource(autoSymbolicName, null, null, null, null, Collections.singleton(symbolicName), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(autoSymbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + List resolvedList = resolvedResources.iterator().next(); + assertEquals("There should be 2 resolved resources in the auto list", 2, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(1)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + } + + /** + * Test to make sure that if an auto feature is set to be not auto-installable then it is not installed even when it's requirements are satisfied. + * + * @throws Throwable + */ + @Test + public void testAutoFeatureNotAutoInstallable() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now add the satisified auto-resource but make it not auto installable + createEsaResource("satisfied.auto.feature", null, null, null, null, Collections.singleton(symbolicName), false, null); + + // Now see if we can resolve just the single feature + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test to make sure an auto feature is automatically installed if its capabilities are met by what is already installed + */ + @Test + public void testAutoFeatureSatisfiedByInstalledFeature() throws RepositoryException, ResolutionException { + // Add one test resource to massive, but make a dependency to an already installed feature + String repoSymbolicName = "com.ibm.ws.test-1.0"; + String installedSymbolicName = "com.ibm.ws.test.installed-1.0"; + EsaResourceImpl testResource = createEsaResource(repoSymbolicName, null, null); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, installedSymbolicName, null, null); + + // Create the auto feature requiring the installed feature + EsaResourceImpl autoFeature = createEsaResource("satisfied.auto.feature", null, null, null, null, Collections.singleton(installedSymbolicName), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections.singleton(mockFeatureDefinition), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(repoSymbolicName); + assertEquals("There should be two lists of resources as the auto feature doesn't require the massive resource, set is:" + resolvedResources, 2, resolvedResources.size()); + Collection allResolvedResources = new ArrayList(); + for (List massiveResourceList : resolvedResources) { + allResolvedResources.addAll(massiveResourceList); + } + assertEquals("There should be two resolved resources", 2, allResolvedResources.size()); + assertTrue("The resolved resources should contain the one we were looking for", allResolvedResources.contains(testResource)); + assertTrue("The resolved resources should contain the now satisified auto feature", allResolvedResources.contains(autoFeature)); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Test to make sure an auto feature is not automatically installed if it is already installed + */ + @Test + public void testAutoFeatureAlreadyInstalled() throws RepositoryException, ResolutionException { + // Add one test resource to massive, but make a dependency to an already installed feature + String repoSymbolicName = "com.ibm.ws.test-1.0"; + String requiredInstalledSymbolicName = "com.ibm.ws.test.installed-1.0"; + String autoFeatureSymbolicName = "com.ibm.ws.test.auto-1.0"; + EsaResourceImpl testResource = createEsaResource(repoSymbolicName, null, null); + Mockery mockery = new Mockery(); + ProvisioningFeatureDefinition mockFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, requiredInstalledSymbolicName, null, null); + ProvisioningFeatureDefinition mockAutoFeatureDefinition = ResolverTestUtils.mockSimpleFeatureDefinition(mockery, autoFeatureSymbolicName, null, null); + Collection installedFeatures = new HashSet(); + installedFeatures.add(mockFeatureDefinition); + installedFeatures.add(mockAutoFeatureDefinition); + + // Create the auto feature requiring the installed feature + createEsaResource(autoFeatureSymbolicName, null, null, null, null, Collections.singleton(requiredInstalledSymbolicName), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), installedFeatures, Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(repoSymbolicName); + assertEquals("There should only be a single list of resources, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertEquals("The resource being resolved should be the one in the list", testResource, resolvedResources.iterator().next().get(0)); + + // Make sure the mockery was happy + mockery.assertIsSatisfied(); + } + + /** + * Test to make sure if an auto feature needs two other features from the repo then everything works + */ + @Test + public void testAutoFeatureNeedingTwoFeatures() throws RepositoryException { + // Add two test resources to massive + String symbolicName1 = "com.ibm.ws.test.one-1.0"; + EsaResourceImpl testResource1 = createEsaResource(symbolicName1, null, null); + String symbolicName2 = "com.ibm.ws.test.two-1.0"; + EsaResourceImpl testResource2 = createEsaResource(symbolicName2, null, null); + + // Now add the soon-to-be-satisfied auto feature + Collection requiredFeatures = new HashSet(); + requiredFeatures.add(symbolicName1); + requiredFeatures.add(symbolicName2); + EsaResourceImpl autoFeature = createEsaResource("satisfied.auto.feature", null, null, null, null, requiredFeatures, true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(requiredFeatures); + assertEquals("There should be three lists of resources one for each of the features asked for and one for the auto feature, set is:" + resolvedResources, 3, + resolvedResources.size()); + + boolean found1List = false; + boolean found2List = false; + boolean foundAutoList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(testResource1) && resolvedList.size() == 1) { + found1List = true; + } else if (resolvedList.contains(testResource2) && resolvedList.size() == 1) { + found2List = true; + } else if (resolvedList.contains(autoFeature)) { + foundAutoList = true; + assertEquals("There should be 3 resolved resources in the auto list", 3, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(2)); + assertTrue("1 should be installed", resolvedList.contains(testResource1)); + assertTrue("2 should be installed", resolvedList.contains(testResource2)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found 1", found1List); + assertTrue("Should have found 2", found2List); + assertTrue("Should have found auto", foundAutoList); + } + + /** + * Test to make sure if an auto feature needs two other features from the repo but one is missing then it isn't installed + */ + @Test + public void testAutoFeaturePartiallySatisfied() throws RepositoryException { + // Add two test resources to massive + String symbolicName1 = "com.ibm.ws.test.one-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName1, null, null); + String symbolicName2 = "com.ibm.ws.test.two-1.0"; + + // Now add the soon-to-be-satisfied auto feature + Collection requiredFeatures = new HashSet(); + requiredFeatures.add(symbolicName1); + requiredFeatures.add(symbolicName2); + createEsaResource("satisfied.auto.feature", null, null, null, null, requiredFeatures, true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName1); + assertEquals("There should only be a single list of resources as the auto feature isn't satisified, set is:" + resolvedResources, 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertEquals("The resource being resolved should be the one in the list", testResource, resolvedResources.iterator().next().get(0)); + } + + /** + * Test to make sure an auto feature is automatically along with any iFixes it needs + * + * @throws Throwable + */ + @Test + public void testAutoFeatureRequiringIFix() throws Throwable { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + String fixId = "PM00010"; + IfixResourceImpl iFixResource = createIFixResource(fixId, null, null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = createEsaResource("satisfied.auto.feature", null, null, null, null, Collections.singleton(symbolicName), true, Collections.singleton(fixId)); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be two lists of resources one for the feature being installed and one for the auto feature, set is:" + resolvedResources, 2, + resolvedResources.size()); + boolean foundFeatureList = false; + boolean foundAutoList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(testResource) && resolvedList.size() == 1) { + foundFeatureList = true; + } else if (resolvedList.contains(autoFeature)) { + foundAutoList = true; + assertEquals("There should be 3 resolved resources in the auto list", 3, resolvedList.size()); + assertEquals("Auto should be installed last", autoFeature, resolvedList.get(2)); + assertEquals("Main feature should be installed first", testResource, resolvedList.get(0)); + assertEquals("IFix should be installed second", iFixResource, resolvedList.get(1)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found feature", foundFeatureList); + assertTrue("Should have found auto", foundAutoList); + } + + /** + * This method tests that a resolver can be used more than once. + * + * @throws RepositoryException + */ + @Test + public void testCaching() throws RepositoryException { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> firstResolution = resolver.resolve(symbolicName); + assertEquals("There should only be a single list of resources", 1, firstResolution.size()); + List firstResolutionList = firstResolution.iterator().next(); + assertEquals("There should be one resolved resource", 1, firstResolutionList.size()); + assertTrue("The resolved resource should be the one we supplied", firstResolutionList.contains(testResource)); + + Collection> secondResolution = resolver.resolve(symbolicName); + assertEquals("Multiple invocations of resolve should return the same result", firstResolution, secondResolution); + } + + /** + * Tests if you have two intersecting feature dependencies then they appear in both lists + */ + @Test + public void testIntersectingFeatures() throws RepositoryException { + // Have a require b and c require b and ask to install a and c, both lists should contain b + String aSymbolicName = "com.ibm.ws.test.A-1.0"; + String bSymbolicName = "com.ibm.ws.test.B-1.0"; + String cSymbolicName = "com.ibm.ws.test.C-1.0"; + EsaResourceImpl aResource = createEsaResource(aSymbolicName, null, null, Collections.singleton(bSymbolicName), null); + EsaResourceImpl bResource = createEsaResource(bSymbolicName, null, null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, null, null, Collections.singleton(bSymbolicName), null); + + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection symbolicNames = new HashSet(); + symbolicNames.add(aSymbolicName); + symbolicNames.add(cSymbolicName); + Collection> resolvedResources = resolver.resolve(symbolicNames); + assertEquals("There should be two lists of resolved resources", 2, resolvedResources.size()); + boolean foundAList = false; + boolean foundCList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(aResource)) { + foundAList = true; + assertEquals("There should be 2 resolved resources in the a list", 2, resolvedList.size()); + assertEquals("A should be installed last", aResource, resolvedList.get(1)); + assertEquals("B should be installed first", bResource, resolvedList.get(0)); + } else if (resolvedList.contains(cResource)) { + foundCList = true; + assertEquals("There should be 2 resolved resources in the c list", 2, resolvedList.size()); + assertEquals("C should be installed last", cResource, resolvedList.get(1)); + assertEquals("B should be installed first", bResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found A", foundAList); + assertTrue("Should have found C", foundCList); + } + + /** + * Tests if you have two intersecting fix dependencies then they appear in both lists + */ + @Test + public void testIntersectingFixes() throws RepositoryException { + // Have a require b (fix) and c require b and ask to install a and c, both lists should contain b + String aSymbolicName = "com.ibm.ws.test.A-1.0"; + String bFixId = "PM0000b"; + String cSymbolicName = "com.ibm.ws.test.C-1.0"; + EsaResourceImpl aResource = createEsaResource(aSymbolicName, Collections.singleton(bFixId)); + IfixResourceImpl bResource = createIFixResource(bFixId, null, null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, Collections.singleton(bFixId)); + + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection symbolicNames = new HashSet(); + symbolicNames.add(aSymbolicName); + symbolicNames.add(cSymbolicName); + Collection> resolvedResources = resolver.resolve(symbolicNames); + assertEquals("There should be two lists of resolved resources", 2, resolvedResources.size()); + boolean foundAList = false; + boolean foundCList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(aResource)) { + foundAList = true; + assertEquals("There should be 2 resolved resources in the a list", 2, resolvedList.size()); + assertEquals("A should be installed last", aResource, resolvedList.get(1)); + assertEquals("B should be installed first", bResource, resolvedList.get(0)); + } else if (resolvedList.contains(cResource)) { + foundCList = true; + assertEquals("There should be 2 resolved resources in the c list", 2, resolvedList.size()); + assertEquals("C should be installed last", cResource, resolvedList.get(1)); + assertEquals("B should be installed first", bResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found A", foundAList); + assertTrue("Should have found C", foundCList); + } + + /** + * This test makes sure that if you have two trees of features that intersect then the intersecting parts appear in both lists of stuff to install. + * + * @throws RepositoryException + */ + @Test + public void testIntersectingLists() throws RepositoryException { + // Build up a data structure like so (where -> indicates a requirement and i or f prefix state whether it is an ifix or a feature): + // fA -> fB -> iC, (fD -> iE) + // fZ -> iC, fY -> fD -> iE + // We will then ask to resolve fA and fZ and should then get back the following two lists of stuff to install: + // [iE, fD, iC, fB, fA] + // [iE, fD, fY, iC, fZ] + String fASymbolicName = "com.ibm.ws.test.A-1.0"; + String fBSymbolicName = "com.ibm.ws.test.B-1.0"; + String fDSymbolicName = "com.ibm.ws.test.D-1.0"; + String fZSymbolicName = "com.ibm.ws.test.Z-1.0"; + String fYSymbolicName = "com.ibm.ws.test.Y-1.0"; + String iCId = "PM0000C"; + String iEId = "PM0000E"; + EsaResourceImpl aResource = createEsaResource(fASymbolicName, null, null, Collections.singleton(fBSymbolicName), null); + EsaResourceImpl bResource = createEsaResource(fBSymbolicName, null, null, Collections.singleton(fDSymbolicName), null, null, false, Collections.singleton(iCId)); + EsaResourceImpl dResource = createEsaResource(fDSymbolicName, Collections.singleton(iEId)); + EsaResourceImpl zResource = createEsaResource(fZSymbolicName, null, null, Collections.singleton(fYSymbolicName), null, null, false, Collections.singleton(iCId)); + EsaResourceImpl yResource = createEsaResource(fYSymbolicName, null, null, Collections.singleton(fDSymbolicName), null); + IfixResourceImpl iCResource = createIFixResource(iCId, null, null); + IfixResourceImpl iEResource = createIFixResource(iEId, null, null); + + // Now do the resolution + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection symbolicNames = new HashSet(); + symbolicNames.add(fASymbolicName); + symbolicNames.add(fZSymbolicName); + Collection> resolvedResources = resolver.resolve(symbolicNames); + assertEquals("There should be two lists of resolved resources", 2, resolvedResources.size()); + boolean foundAList = false; + boolean foundZList = false; + for (List resolvedList : resolvedResources) { + if (resolvedList.contains(aResource)) { + foundAList = true; + assertEquals("There should be 5 resolved resources in the a list", 5, resolvedList.size()); + assertEquals("A should be installed last", aResource, resolvedList.get(4)); + assertEquals("B should be installed second last", bResource, resolvedList.get(3)); + assertEquals("C should be installed in the middle", iCResource, resolvedList.get(2)); + assertEquals("D should be installed second ", dResource, resolvedList.get(1)); + assertEquals("E should be installed first", iEResource, resolvedList.get(0)); + } else if (resolvedList.contains(zResource)) { + foundZList = true; + assertEquals("There should be 5 resolved resources in the z list", 5, resolvedList.size()); + assertEquals("A should be installed last", zResource, resolvedList.get(4)); + assertEquals("C should be installed second last", iCResource, resolvedList.get(3)); + assertEquals("Y should be installed in the middle", yResource, resolvedList.get(2)); + assertEquals("D should be installed second ", dResource, resolvedList.get(1)); + assertEquals("E should be installed first", iEResource, resolvedList.get(0)); + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found A", foundAList); + assertTrue("Should have found Z", foundZList); + } + + /** + * Test based on review of work item 118781 (comment 6) where if you have two long paths to the same object then it can appear after things that depend on it. + * + * @throws RepositoryException + * @throws RepositoryResolutionException + */ + @Test + public void testOrderingOnMultipleLongPaths() throws RepositoryResolutionException, RepositoryException { + // Construct the following dependency model in the repo: + // A -> B, C + // B -> D + // C -> E + // D -> F + // E -> F + String aSymbolicName = "com.ibm.ws.test.A-1.0"; + String bSymbolicName = "com.ibm.ws.test.B-1.0"; + String cSymbolicName = "com.ibm.ws.test.C-1.0"; + String dSymbolicName = "com.ibm.ws.test.D-1.0"; + String eSymbolicName = "com.ibm.ws.test.E-1.0"; + String fSymbolicName = "com.ibm.ws.test.F-1.0"; + Collection aDeps = new HashSet(); + aDeps.add(bSymbolicName); + aDeps.add(cSymbolicName); + EsaResourceImpl aResource = createEsaResource(aSymbolicName, null, null, aDeps, null); + EsaResourceImpl bResource = createEsaResource(bSymbolicName, null, null, Collections.singleton(dSymbolicName), null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, null, null, Collections.singleton(eSymbolicName), null); + EsaResourceImpl dResource = createEsaResource(dSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + EsaResourceImpl eResource = createEsaResource(eSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + EsaResourceImpl fResource = createEsaResource(fSymbolicName, null, null); + + // Resolve + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(aSymbolicName); + + // Test result + assertEquals("There should be a single list of resolved resources", 1, resolvedResources.size()); + List resolvedList = resolvedResources.iterator().next(); + assertEquals("There should be 6 resolved resources, list is: " + resolvedList, 6, resolvedList.size()); + assertEquals("Everything depends on f so it should be installed first, list is: " + resolvedList, fResource, resolvedList.get(0)); + assertEquals("A is at the root so should be installed last, list is: " + resolvedList, aResource, resolvedList.get(5)); + assertTrue("The list should contain B, list is: " + resolvedList, resolvedList.contains(bResource)); + assertTrue("The list should contain C, list is: " + resolvedList, resolvedList.contains(cResource)); + assertTrue("The list should contain D, list is: " + resolvedList, resolvedList.contains(dResource)); + assertTrue("The list should contain E, list is: " + resolvedList, resolvedList.contains(eResource)); + assertTrue("B depends on D so should be installed after it, list is: " + resolvedList, resolvedList.indexOf(bResource) > resolvedList.indexOf(dResource)); + assertTrue("C depends on E so should be installed after it, list is: " + resolvedList, resolvedList.indexOf(cResource) > resolvedList.indexOf(eResource)); + } + + /** + * Same as {@link #testOrderingOnMultipleLongPaths()} but with an extra dependency on the end to ensure that everything that needs to appear at the end does so. + * + * @throws RepositoryException + * @throws RepositoryResolutionException + */ + @Test + public void testOrderingOnMultipleLongPathsAndLongTail() throws RepositoryResolutionException, RepositoryException { + // Construct the following dependency model in the repo: + // A -> B, C + // B -> D + // C -> E + // D -> F + // E -> F + // F -> G + String aSymbolicName = "com.ibm.ws.test.A-1.0"; + String bSymbolicName = "com.ibm.ws.test.B-1.0"; + String cSymbolicName = "com.ibm.ws.test.C-1.0"; + String dSymbolicName = "com.ibm.ws.test.D-1.0"; + String eSymbolicName = "com.ibm.ws.test.E-1.0"; + String fSymbolicName = "com.ibm.ws.test.F-1.0"; + String gSymbolicName = "com.ibm.ws.test.G-1.0"; + Collection aDeps = new HashSet(); + aDeps.add(bSymbolicName); + aDeps.add(cSymbolicName); + EsaResourceImpl aResource = createEsaResource(aSymbolicName, null, null, aDeps, null); + EsaResourceImpl bResource = createEsaResource(bSymbolicName, null, null, Collections.singleton(dSymbolicName), null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, null, null, Collections.singleton(eSymbolicName), null); + EsaResourceImpl dResource = createEsaResource(dSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + EsaResourceImpl eResource = createEsaResource(eSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + EsaResourceImpl fResource = createEsaResource(fSymbolicName, null, null, Collections.singleton(gSymbolicName), null); + EsaResourceImpl gResource = createEsaResource(gSymbolicName, null, null); + + // Resolve + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(aSymbolicName); + + // Test result + assertEquals("There should be a single list of resolved resources", 1, resolvedResources.size()); + List resolvedList = resolvedResources.iterator().next(); + assertEquals("There should be 7 resolved resources, list is: " + resolvedList, 7, resolvedList.size()); + assertEquals("Everything depends on g through f so it should be installed first, list is: " + resolvedList, gResource, resolvedList.get(0)); + assertEquals("f should be second, list is: " + resolvedList, fResource, resolvedList.get(1)); + assertEquals("A is at the root so should be installed last, list is: " + resolvedList, aResource, resolvedList.get(6)); + assertTrue("The list should contain B, list is: " + resolvedList, resolvedList.contains(bResource)); + assertTrue("The list should contain C, list is: " + resolvedList, resolvedList.contains(cResource)); + assertTrue("The list should contain D, list is: " + resolvedList, resolvedList.contains(dResource)); + assertTrue("The list should contain E, list is: " + resolvedList, resolvedList.contains(eResource)); + assertTrue("B depends on D so should be installed after it, list is: " + resolvedList, resolvedList.indexOf(bResource) > resolvedList.indexOf(dResource)); + assertTrue("C depends on E so should be installed after it, list is: " + resolvedList, resolvedList.indexOf(cResource) > resolvedList.indexOf(eResource)); + } + + /** + *

Test for work item 129271:

+ *

Here is the scenario when a feature can not be resolved.

+ * + *

Feature A (applies-to ND 8.5.5.2 only) has a dependency on Feature B (applies-to CORE/BASE/ND 8.5.5.2 and Archive Install only).

+ * + *

When a user is trying to install Feature A from a Liberty BASE 8.5.5.2 Installation Manager installation which doesn't have Feature B installed, the resolver should throw + * an exception indicating the feature A is missing the applies-to requirement.

+ * + *

But it currently throws an exception indicating the dependent feature is not meeting the requirement.

+ * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testExceptionFromUnresolvableItemWithUnresolveableDependency() throws RepositoryException, IOException, ProductInfoParseException { + String firstSymbolicName = "com.ibm.ws.A-1.0"; + String firstAppliesTo = "com.ibm.websphere.appserver; productVersion=8.5.5.2; productEdition=\"ND\""; + String secondSymbolicName = "com.ibm.ws.B-1.0"; + RepositoryResourceImpl resource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), firstAppliesTo); + createEsaResource(secondSymbolicName, null, "1.0.0.1", null, + "com.ibm.websphere.appserver; productVersion=8.5.5.2; productEdition=\"CORE,BASE,ND\"; productInstallType=Archive"); + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.websphere.appserver", "BASE", "8.5.5.2", null, "INSTALLATION_MANAGER"); + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + try { + resolver.resolve(firstSymbolicName); + fail("The resource should not resolve and neither should it's dependency"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + firstSymbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(firstSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsNotFound().size()); + assertThat("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the first feature", + e.getAllRequirementsNotFound(), contains(firstAppliesTo)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the third feature " + + e.getAllRequirementsResourcesNotFound(), firstAppliesTo, missingRequirement.requirementName); + assertEquals("The exception should include the resource that owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), resource, missingRequirement.owningResource); + assertEquals("One product should have not been found", 1, e.getMissingProducts().size()); + assertEquals("The exception should list which products features were found for", + new ProductRequirementInformation("[8.5.5.2, 8.5.5.2]", "com.ibm.websphere.appserver", null, null, Collections.singletonList("ND")), + e.getMissingProducts().iterator().next()); + assertEquals("The exception should contain the right minimum product value", "8.5.5.2", + e.getMinimumVersionForMissingProduct("com.ibm.websphere.appserver", null, null)); + assertEquals("The exception should contain the right maximum product value", "8.5.5.2", e.getMaximumVersionForMissingProduct(null, null, null)); + } + // Just double check we can't resolve the second item either (otherwise this might be the cause of the "correct" error message coming out) + try { + resolver.resolve(secondSymbolicName); + fail("The resource should not resolve"); + } catch (RepositoryResolutionException e) { + + } + + } + + /** + *

Test to demonstrate one of the hard cases in the resolver scalability (similar to web cache monitor). The setup is this:

+ * + *

Feature A (applies-to ND, any version) depends on Feature B (applies-to ND, 8.5.5.4)

+ * + *

Then try to resolve feature A on 8.5.5.2, you should get an error saying it only applies to 8554 and not one saying that feature B is missing.

+ * + *

Note this test also provides a test for defect 173065

+ * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testExceptionFromUnresolvableDepdendencyDueToBadAppliesTo() throws RepositoryException, IOException, ProductInfoParseException { + String firstSymbolicName = "com.ibm.ws.A-1.0"; + String firstAppliesTo = "com.ibm.websphere.appserver; productEdition=\"ND\""; + String secondSymbolicName = "com.ibm.ws.B-1.0"; + String secondAppliesTo = "com.ibm.websphere.appserver; productVersion=8.5.5.4; productEdition=\"ND\""; + createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), firstAppliesTo); + RepositoryResourceImpl secondResource = createEsaResource(secondSymbolicName, null, "1.0.0.1", null, secondAppliesTo); + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.websphere.appserver", "ND", "8.5.5.2", null, "INSTALLATION_MANAGER"); + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + try { + resolver.resolve(firstSymbolicName); + fail("The resource should not resolve and neither should it's dependency"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + firstSymbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(firstSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the second feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(secondAppliesTo)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the second feature " + + e.getAllRequirementsResourcesNotFound(), secondAppliesTo, missingRequirement.requirementName); + assertEquals("The exception should say which resources owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), secondResource, missingRequirement.owningResource); + assertEquals("One product should have not been found", 1, e.getMissingProducts().size()); + assertEquals("The exception should list which products features were found for", + new ProductRequirementInformation("[8.5.5.4, 8.5.5.4]", "com.ibm.websphere.appserver", null, null, Collections.singletonList("ND")), + e.getMissingProducts().iterator().next()); + assertEquals("The exception should contain the right minimum product value", "8.5.5.4", e.getMinimumVersionForMissingProduct(null, null, null)); + assertEquals("The exception should contain the right maximum product value", "8.5.5.4", + e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", null, null)); + } + } + + /** + * This tests asks for a feature for 8552 but there are only features for 8553 and 8554 so the resolution fails, we should get information that features were found for the + * other versions though. + * + * @throws ProductInfoParseException + * @throws IOException + * @throws RepositoryException + */ + @SuppressWarnings("unchecked") + @Test + public void testFeaturesOnMultipleProductsButNotRightOne() throws IOException, ProductInfoParseException, RepositoryException { + String symbolicName = "com.ibm.ws.A-1.0"; + String firstAppliesTo = "com.ibm.websphere.appserver; productVersion=8.5.5.3; productEdition=\"BASE\""; + String secondAppliesTo = "com.ibm.websphere.appserver; productVersion=8.5.5.10; productEdition=\"ND\""; + String thirdAppliesTo = "com.ibm.websphere.appserver; productVersion=9.0.0.2; productEdition=\"ND\""; + RepositoryResourceImpl resource1 = createEsaResource(symbolicName, null, null, null, firstAppliesTo); + RepositoryResourceImpl resource2 = createEsaResource(symbolicName, null, "1.0.0.1", null, secondAppliesTo); + RepositoryResourceImpl resource3 = createEsaResource(symbolicName, null, "1.0.0.2", null, thirdAppliesTo); + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.websphere.appserver", "BASE", "8.5.5.2", null, null); + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + try { + resolver.resolve(symbolicName); + fail("The resource should not resolve and neither should it's dependency"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + symbolicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(symbolicName)); + assertEquals("Three requirements should not be found", 3, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which requirement actually wasn't found and it should include the requirement on the product for the first feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(firstAppliesTo)); + assertTrue("The exception should say which requirement actually wasn't found and it should include the requirement on the product for the second feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(secondAppliesTo)); + assertTrue("The exception should say which requirement actually wasn't found and it should include the requirement on the product for the third feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(thirdAppliesTo)); + assertEquals("Three requirements should not be found", 3, e.getAllRequirementsResourcesNotFound().size()); + Collection missingRequirements = e.getAllRequirementsResourcesNotFound(); + assertThat("All the requirements should be in the list of missing requirements", missingRequirements, + containsInAnyOrder(allOf(hasProperty("requirementName", equalTo(firstAppliesTo)), hasProperty("owningResource", equalTo(resource1))), + allOf(hasProperty("requirementName", equalTo(secondAppliesTo)), hasProperty("owningResource", equalTo(resource2))), + allOf(hasProperty("requirementName", equalTo(thirdAppliesTo)), hasProperty("owningResource", equalTo(resource3))))); + assertEquals("Two products should have not been found", 3, e.getMissingProducts().size()); + assertTrue("The exception should list that a feature for product at version 8553 was found but was: " + e.getMissingProducts(), + e.getMissingProducts().contains(new ProductRequirementInformation("[8.5.5.3, 8.5.5.3]", "com.ibm.websphere.appserver", null, null, Collections.singletonList("BASE")))); + assertTrue("The exception should list that a feature for product at version 85510 was found but was: " + e.getMissingProducts(), + e.getMissingProducts().contains(new ProductRequirementInformation("[8.5.5.10, 8.5.5.10]", "com.ibm.websphere.appserver", null, null, Collections.singletonList("ND")))); + assertTrue("The exception should list that a feature for product at version 9002 was found but was: " + e.getMissingProducts(), + e.getMissingProducts().contains(new ProductRequirementInformation("[9.0.0.2, 9.0.0.2]", "com.ibm.websphere.appserver", null, null, Collections.singletonList("ND")))); + assertEquals("The exception should contain the right minimum product value", "8.5.5.3", e.getMinimumVersionForMissingProduct(null, null, null)); + assertEquals("The exception should contain the right maximum product value", "9.0.0.2", + e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", null, null)); + assertEquals("The exception should contain the right minimum product value filtering on edition", "8.5.5.10", e.getMinimumVersionForMissingProduct(null, null, "ND")); + assertEquals("The exception should contain the right maximum product value filtering on edition", "9.0.0.2", + e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", null, "ND")); + assertEquals("The exception should contain the right minimum product value filtering on version", "8.5.5.3", + e.getMinimumVersionForMissingProduct(null, "8.5.5.0", null)); + assertEquals("The exception should contain the right maximum product value filtering on version", "8.5.5.10", + e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", "8.5.5.0", null)); + assertEquals("The exception should contain the right minimum product value filtering on version and edition", "9.0.0.2", + e.getMinimumVersionForMissingProduct(null, "9.0.0.0", "ND")); + assertEquals("The exception should contain the right maximum product value filtering on version", "9.0.0.2", + e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", "9.0.0.0", "ND")); + } + } + + /** + * Test that you can resolve a sample + * + * @throws RepositoryException + */ + @Test + public void testSample() throws RepositoryException { + String name = "testSample"; + SampleResourceImpl testResource = createAndUploadSampleResource(name); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(name); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Try to resolve a sample by it's lower case name + * + * @throws RepositoryException + */ + @Test + public void testSampleByLowerCaseShortName() throws RepositoryException { + String name = "testSampleByLowerCaseShortName"; + SampleResourceImpl testResource = createAndUploadSampleResource(name); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(name.toLowerCase()); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test you can resolve an OSI + * + * @throws RepositoryException + */ + @Test + public void testOsi() throws RepositoryException { + String name = "testOsi"; + SampleResourceImpl testResource = createSampleResource(name); + testResource.setType(ResourceType.OPENSOURCE); + uploadResource(testResource); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(name); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Test that you can resolve more than one sample at once + * + * @throws RepositoryException + */ + @Test + public void testMultipleSamples() throws RepositoryException { + String name1 = "testMultipleSamples1"; + SampleResourceImpl testResource1 = createAndUploadSampleResource(name1); + String name2 = "testMultipleSamples2"; + SampleResourceImpl testResource2 = createAndUploadSampleResource(name2); + + // Now see if we can resolve them! + Collection names = new HashSet(); + names.add(name1); + names.add(name2); + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(names); + assertEquals("There should be a two lists of resources", 2, resolvedResources.size()); + boolean found1 = false; + boolean found2 = false; + for (List list : resolvedResources) { + assertEquals("Each resolve list should only have a single resource " + list, 1, list.size()); + if (list.contains(testResource1)) { + found1 = true; + } else if (list.contains(testResource2)) { + found2 = true; + } else { + fail("Unknown resource list resolved: " + list); + } + } + assertTrue("Should have resolved the first sample", found1); + assertTrue("Should have resolved the second sample", found2); + } + + /** + * Tests that if a sample depends on a feature then it is resolved along with the feature and in the right order + */ + @Test + public void testSampleWithFeatureDependency() throws RepositoryException { + String name = "testSampleWithFeatureDependency"; + String featureSymbolicName = "com.ibm.ws.feature"; + SampleResourceImpl sampleResource = createSampleResource(name); + sampleResource.setRequireFeature(Collections.singleton(featureSymbolicName)); + uploadResource(sampleResource); + EsaResourceImpl feature = createEsaResource(featureSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(name); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + List installList = resolvedResources.iterator().next(); + assertEquals("There should be two resolved resource", 2, installList.size()); + assertEquals("The feature needs installing first so it should be first in the list", feature, installList.get(0)); + assertEquals("The sample needs installing second so it should be second in the list", sampleResource, installList.get(1)); + } + + /** + * Tests that if there is an applies to to an exact product version then it matches + * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testSampleWithAppliesToExact() throws RepositoryException, IOException, ProductInfoParseException { + runAppliesToSampleTest("testSampleWithAppliesToExact", "com.ibm.ws.test.product; productVersion=5.0.0.0; productEdition=DEVELOPERS", "5.0.0.0"); + } + + /** + * Tests that if there is an applies to to a range of product version but the product version is the min version then it matches + * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testSampleWithAppliesToRangeExactVersion() throws RepositoryException, IOException, ProductInfoParseException { + runAppliesToSampleTest("testSampleWithAppliesToRangeExactVersion", "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS", "5.0.0.0"); + } + + /** + * Tests that if there is an applies to to a range of product version and the product version is the higher than the min version then it matches + */ + @Test + public void testSampleWithAppliesToRangeHigherVersion() throws RepositoryException, IOException, ProductInfoParseException { + runAppliesToSampleTest("testSampleWithAppliesToRangeExactVersion", "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS", "6.0.0.0"); + } + + /** + * Tests that if there is an applies to to a range of product version but the product version is the min version then it matches + * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + */ + @Test + public void testFeatureWithAppliesToRangeExactVersion() throws RepositoryException, IOException, ProductInfoParseException { + String symoblicName = "com.ibm.ws.applies.to.range.exact.version"; + RepositoryResourceImpl testResource = createEsaResource(symoblicName, null, null, null, "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS"); + runTestAgainstProductDefinitionWithSingleResult(symoblicName, "5.0.0.0", testResource); + } + + /** + * Tests that if there is an applies to to a range of product version and the product version is the higher than the min version then it matches + */ + @Test + public void testFeatureWithAppliesToRangeHigherVersion() throws RepositoryException, IOException, ProductInfoParseException { + String symoblicName = "com.ibm.ws.applies.to.range.higher.version"; + RepositoryResourceImpl testResource = createEsaResource(symoblicName, null, null, null, "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS"); + runTestAgainstProductDefinitionWithSingleResult(symoblicName, "6.0.0.0", testResource); + } + + /** + * Tests that if there is an applies to to a range of product version and the product version is the lower than the min version then it throws an exception + */ + @Test + public void testFeatureWithAppliesToRangeLowerVersion() throws RepositoryException, IOException, ProductInfoParseException { + String symoblicName = "com.ibm.ws.applies.to.range.higher.version"; + String appliesTo = "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS"; + RepositoryResourceImpl testResource = createEsaResource(symoblicName, null, null, null, appliesTo); + try { + runTestAgainstProductDefinitionWithSingleResult(symoblicName, "4.0.0.0", testResource); + fail("Should have thrown an exception"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + symoblicName)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed " + e.getTopLevelFeaturesNotResolved(), e.getTopLevelFeaturesNotResolved().contains(symoblicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the second feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(appliesTo)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the applies to " + + e.getAllRequirementsResourcesNotFound(), appliesTo, missingRequirement.requirementName); + assertEquals("The exception should say which resources owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), testResource, missingRequirement.owningResource); + assertEquals("There should only be one product that couldn't be resolved", 1, e.getMissingProducts().size()); + assertTrue("The exception should list which products features were found for: " + e.getMissingProducts(), + e.getMissingProducts().contains(new ProductRequirementInformation("5.0.0.0", "com.ibm.ws.test.product", null, null, Collections.singletonList("DEVELOPERS")))); + assertEquals("The exception should contain the right minimum product value", "5.0.0.0", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should have no max product version for an unbounded range", e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", null, null)); + } + } + + /** + * Test that when you have multiple features that are applicable to a given version the correct one is picked. For more comprehensive ordering tests are done in the + * FeatureResourceTest unit test so this is a sniff test to make sure a basic rule is applied when integrated into the resolver. + * + * @throws RepositoryException + * @throws ProductInfoParseException + * @throws IOException + * @throws RepositoryResolutionException + */ + @Test + public void testRightFeaturePicked() throws RepositoryResolutionException, IOException, ProductInfoParseException, RepositoryException { + String symoblicName = "com.ibm.ws.applies.to.range.higher.version"; + createEsaResource(symoblicName, null, null, null, "com.ibm.ws.test.product; productVersion=5.0.0.0+; productEdition=DEVELOPERS"); + RepositoryResourceImpl exactTestResource = createEsaResource(symoblicName, null, null, null, "com.ibm.ws.test.product; productVersion=6.0.0.0; productEdition=DEVELOPERS"); + runTestAgainstProductDefinitionWithSingleResult(symoblicName, "6.0.0.0", exactTestResource); + } + + /** + * Tests the exception when a sample with a higher applies to than the current product + * + * @throws ProductInfoParseException + * @throws IOException + * @throws RepositoryException + */ + @Test + public void testSampleWrongProductVersion() throws IOException, ProductInfoParseException, RepositoryException { + String name = "testSampleWrongProductVersion"; + SampleResourceImpl testResource = createSampleResource(name); + String appliesTo = "com.ibm.ws.test.product; productVersion=6.0.0.0+; productEdition=DEVELOPERS"; + testResource.setAppliesTo(appliesTo); + uploadResource(testResource); + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.ws.test.product", "DEVELOPERS", "5.0.0.0", null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + try { + resolver.resolve(name); + fail("The sample does not apply to this product so should not have resolved"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state what couldn't be resolved but it is: " + e.getMessage(), e.getMessage().contains("resource=" + name)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(name)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the second feature " + + e.getAllRequirementsNotFound(), e.getAllRequirementsNotFound().contains(appliesTo)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the applies to " + + e.getAllRequirementsResourcesNotFound(), appliesTo, missingRequirement.requirementName); + assertEquals("The exception should say which resources owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), testResource, missingRequirement.owningResource); + assertEquals("There should only be one product that couldn't be resolved", 1, e.getMissingProducts().size()); + assertTrue("The exception should list which products samples were found for: " + e.getMissingProducts(), + e.getMissingProducts().contains(new ProductRequirementInformation("6.0.0.0", "com.ibm.ws.test.product", null, null, Collections.singletonList("DEVELOPERS")))); + assertEquals("The exception should contain the right minimum product value", "6.0.0.0", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should have no max product version for an unbounded range", e.getMaximumVersionForMissingProduct("com.ibm.websphere.appserver", null, null)); + } + + } + + /** + * Tests the exception when a sample is missing a feature + * + * @throws RepositoryException + */ + @Test + public void testSampleMissingFeature() throws RepositoryException { + String name = "testSampleWithFeatureDependency"; + String featureSymbolicName = "com.ibm.ws.feature"; + SampleResourceImpl sampleResource = createSampleResource(name); + sampleResource.setRequireFeature(Collections.singleton(featureSymbolicName)); + uploadResource(sampleResource); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + try { + resolver.resolve(name); + fail("The sample is missing a dependency so should not resolve"); + } catch (RepositoryResolutionException e) { + assertTrue("The resolution message should state the top level feature that couldn't be resolved but it is: " + e.getMessage(), + e.getMessage().contains("resource=" + name)); + assertEquals("There should only be one top level resource that wasn't resolved", 1, e.getTopLevelFeaturesNotResolved().size()); + assertTrue("The correct top level feature should be listed", e.getTopLevelFeaturesNotResolved().contains(name)); + assertEquals("Only one feature should not be found", 1, e.getAllRequirementsNotFound().size()); + assertTrue("The exception should say which feature actually wasn't found", e.getAllRequirementsNotFound().contains(featureSymbolicName)); + assertEquals("Only one requirement should not be found", 1, e.getAllRequirementsResourcesNotFound().size()); + MissingRequirement missingRequirement = e.getAllRequirementsResourcesNotFound().iterator().next(); + assertEquals("The exception should say which requirement actually wasn't found and it should be the requirement on the product for the feature " + + e.getAllRequirementsResourcesNotFound(), featureSymbolicName, missingRequirement.requirementName); + assertEquals("The exception should say which resources owned the requirement that wasn't found " + + e.getAllRequirementsResourcesNotFound(), sampleResource, missingRequirement.owningResource); + assertTrue("The exception should not have any missing products listed", e.getMissingProducts().isEmpty()); + assertNull("The exception should not have a minimum product value", e.getMinimumVersionForMissingProduct(null, null, null)); + assertNull("The exception should not have a maximum product value", e.getMaximumVersionForMissingProduct(null, null, null)); + } + } + + /** + * Tests that circles in features are ok. Squares never are though. + * + * @throws RepositoryException + */ + @Test + public void testCircularRelationship() throws RepositoryException { + // Add two test resources to massive, we want to make sure they both are returned in the right order + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, Collections.singleton(secondSymbolicName), null); + EsaResourceImpl dependencyResource = createEsaResource(secondSymbolicName, null, "1.0.0.1", Collections.singleton(firstSymbolicName), null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + + // Order is weird here, the two resources are effectively symbiotic so could be installed in either order but we asked for the first one so expect that to be installed last + assertEquals("There should be two resolved resource", 2, resolvedResources.iterator().next().size()); + assertEquals("The dependency should be installed first", dependencyResource, resolvedResources.iterator().next().get(0)); + assertEquals("The resource being resolved should be installed second", firstResource, resolvedResources.iterator().next().get(1)); + } + + /** + * Tests that circles in features caused by an auto feature are ok. + * + * @throws RepositoryException + */ + @Test + public void testAutoFeatureCircularRelationship() throws RepositoryException { + // Add a test resource to massive + String symbolicName = "com.ibm.ws.test-1.0"; + String autoFeatureSymbolicName = "satisfied.auto.feature"; + EsaResourceImpl testResource = createEsaResource(symbolicName, null, null, Collections.singleton(autoFeatureSymbolicName), null); + + // Now add the soon-to-be-satisfied auto feature + EsaResourceImpl autoFeature = createEsaResource(autoFeatureSymbolicName, null, null, null, null, Collections.singleton(symbolicName), true, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(symbolicName); + assertEquals("There should only be two lists of resources one for the feature being installed and one for the auto feature, set is:" + resolvedResources, 2, + resolvedResources.size()); + boolean foundFeatureList = false; + boolean foundAutoList = false; + for (List resolvedList : resolvedResources) { + // As it's a circle you should have two lists with both in but in different order + assertEquals(2, resolvedList.size()); + if (resolvedList.get(0).equals(testResource) && resolvedList.get(1).equals(autoFeature)) { + foundFeatureList = true; + } else if (resolvedList.get(1).equals(testResource) && resolvedList.get(0).equals(autoFeature)) { + foundAutoList = true; + + } else { + fail("Unexpected list in the resolve resources: " + resolvedList); + } + } + assertTrue("Should have found feature", foundFeatureList); + assertTrue("Should have found auto", foundAutoList); + } + + /** + * Same as {@link #testChainedFeatureDependenciesWithMultipleRoutes()} but with a circle at the end. + */ + @Test + public void testChainedFeatureDependenciesWithMultipleRoutesWithCircle() throws RepositoryException, ResolutionException { + // Add four test resources in a chain to massive with the final resource having two routes to it + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + String fourthSymbolicName = "com.ibm.ws.test.third.dep-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(secondSymbolicName); + dependencies.add(thirdSymbolicName); + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, dependencies, null); + EsaResourceImpl firstDependency = createEsaResource(secondSymbolicName, null, null, Collections.singleton(fourthSymbolicName), null); + EsaResourceImpl secondDependency = createEsaResource(thirdSymbolicName, null, null, Collections.singleton(fourthSymbolicName), null); + EsaResourceImpl finalDependency = createEsaResource(fourthSymbolicName, null, null, Collections.singleton(firstSymbolicName), null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be four resolved resource", 4, resolvedResources.iterator().next().size()); + assertEquals("The final dependency in massive should be installed first", finalDependency, resolvedResources.iterator().next().get(0)); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(3)); + + // The order of the middle two doesn't matter as long as they are in the middle somewhere + assertTrue("The first dependency should be in the resolved list", resolvedResources.iterator().next().contains(firstDependency)); + assertTrue("The second dependency should be in the resolved list", resolvedResources.iterator().next().contains(secondDependency)); + } + + /** + * Test that if you have a resource with two dependencies, one of which causes a circle then it doesn't loop around the circle. + */ + @Test + public void testMultipleDependenciesWithOneCircle() throws RepositoryException, ResolutionException { + // Add four test resources in a chain to massive with the final resource having two routes to it + String firstSymbolicName = "com.ibm.ws.test-1.0"; + String secondSymbolicName = "com.ibm.ws.test.dep-1.0"; + String thirdSymbolicName = "com.ibm.ws.test.second.dep-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(secondSymbolicName); + dependencies.add(thirdSymbolicName); + EsaResourceImpl firstResource = createEsaResource(firstSymbolicName, null, null, dependencies, null); + EsaResourceImpl firstDependency = createEsaResource(secondSymbolicName, null, null, Collections.singleton(firstSymbolicName), null); + EsaResourceImpl secondDependency = createEsaResource(thirdSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(firstSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be four resolved resource", 3, resolvedResources.iterator().next().size()); + assertEquals("The resource being resolved should be installed last", firstResource, resolvedResources.iterator().next().get(2)); + + // The order of the middle two doesn't matter as long as they are in the middle somewhere + assertTrue("The first dependency should be in the resolved list", resolvedResources.iterator().next().contains(firstDependency)); + assertTrue("The second dependency should be in the resolved list", resolvedResources.iterator().next().contains(secondDependency)); + } + + /** + * Has a -> [b -> d -> f -> [a, g], c -> e -> f -> [a, g]]. b -> d -> e -> f -> [a, g]. + * + * Tests that we always put f's dependency on g at the start of the install list. + */ + @Test + public void testLongRoutesWithCircleAndTail() throws RepositoryException, ResolutionException { + // Add the test resources in a chain to massive with the f resource having two routes to it + String aSymbolicName = "com.ibm.ws.testA-1.0"; + String bSymbolicName = "com.ibm.ws.testB-1.0"; + String cSymbolicName = "com.ibm.ws.testC-1.0"; + String dSymbolicName = "com.ibm.ws.testD-1.0"; + String eSymbolicName = "com.ibm.ws.testE-1.0"; + String fSymbolicName = "com.ibm.ws.testF-1.0"; + String gSymbolicName = "com.ibm.ws.testG-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(bSymbolicName); + dependencies.add(cSymbolicName); + EsaResourceImpl aResource = createEsaResource(aSymbolicName, null, null, dependencies, null); + EsaResourceImpl bResource = createEsaResource(bSymbolicName, null, null, Collections.singleton(dSymbolicName), null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, null, null, Collections.singleton(eSymbolicName), null); + EsaResourceImpl dResource = createEsaResource(dSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + EsaResourceImpl eResource = createEsaResource(eSymbolicName, null, null, Collections.singleton(fSymbolicName), null); + Collection fDependencies = new HashSet(); + fDependencies.add(aSymbolicName); + fDependencies.add(gSymbolicName); + EsaResourceImpl fResource = createEsaResource(fSymbolicName, null, null, fDependencies, null); + EsaResourceImpl gResource = createEsaResource(gSymbolicName, null, null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(aSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be 7 resolved resources", 7, resolvedResources.iterator().next().size()); + List resourceList = resolvedResources.iterator().next(); + assertEquals("The tail dependency in massive should be installed first", gResource, resourceList.get(0)); + assertEquals("The resource being resolved should be installed last", fResource, resourceList.get(1)); + assertTrue("The resource in the chains should be there", resourceList.contains(bResource)); + assertTrue("The resource in the chains should be there", resourceList.contains(cResource)); + assertTrue("The resource in the chains should be there", resourceList.contains(dResource)); + assertTrue("The resource in the chains should be there", resourceList.contains(eResource)); + assertEquals("The resource being resolved should be installed last", aResource, resourceList.get(6)); + } + + /** + * Has a -> b -> c -> b + */ + @Test + public void testCircleNotToRoot() throws Exception { + // Setup resources + String aSymbolicName = "com.ibm.ws.testA-1.0"; + String bSymbolicName = "com.ibm.ws.testB-1.0"; + String cSymbolicName = "com.ibm.ws.testC-1.0"; + Collection dependencies = new HashSet(); + dependencies.add(bSymbolicName); + dependencies.add(cSymbolicName); + EsaResourceImpl aResource = createEsaResource(aSymbolicName, null, null, Collections.singleton(bSymbolicName), null); + EsaResourceImpl bResource = createEsaResource(bSymbolicName, null, null, Collections.singleton(cSymbolicName), null); + EsaResourceImpl cResource = createEsaResource(cSymbolicName, null, null, Collections.singleton(bSymbolicName), null); + + // Now see if we can resolve it! + RepositoryResolver resolver = new RepositoryResolver(Collections. emptySet(), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(aSymbolicName); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be 3 resolved resources", 3, resolvedResources.iterator().next().size()); + List resourceList = resolvedResources.iterator().next(); + assertEquals(cResource, resourceList.get(0)); + assertEquals(bResource, resourceList.get(1)); + assertEquals(aResource, resourceList.get(2)); + } + + /** + * Run a test to make sure that a sample with an applies to set is resolved correctly + * + * @param name The name of the sample + * @param appliesTo The applies to to put onto the sample + * @param productVersion The product version to be + * @throws RepositoryResourceException + * @throws RepositoryBackendException + * @throws IOException + * @throws ProductInfoParseException + * @throws RepositoryException + * @throws RepositoryResolutionException + */ + private void runAppliesToSampleTest(String name, String appliesTo, + String productVersion) throws RepositoryResourceException, RepositoryBackendException, IOException, ProductInfoParseException, RepositoryException, RepositoryResolutionException { + SampleResourceImpl testResource = createSampleResource(name); + testResource.setAppliesTo(appliesTo); + uploadResource(testResource); + + runTestAgainstProductDefinitionWithSingleResult(name, productVersion, testResource); + } + + /** + * Run a test against a product definition with the supplied version and expect a single result back. + * + * @param name The name to resolve + * @param productVersion The product version to use + * @param testResource The resource to expect + * @throws IOException + * @throws ProductInfoParseException + * @throws RepositoryException + * @throws RepositoryResolutionException + */ + private void runTestAgainstProductDefinitionWithSingleResult(String name, String productVersion, + RepositoryResourceImpl testResource) throws IOException, ProductInfoParseException, RepositoryException, RepositoryResolutionException { + ProductInfo productInfo = ResolverTestUtils.createProductInfo("com.ibm.ws.test.product", "DEVELOPERS", productVersion, null, null); + RepositoryResolver resolver = new RepositoryResolver(Collections. singleton(new ProductInfoProductDefinition(productInfo)), Collections. emptySet(), Collections. emptySet(), _loginInfoList); + Collection> resolvedResources = resolver.resolve(name); + assertEquals("There should only be a single list of resources", 1, resolvedResources.size()); + assertEquals("There should be one resolved resource", 1, resolvedResources.iterator().next().size()); + assertTrue("The resolved resource should be the one we supplied", resolvedResources.iterator().next().contains(testResource)); + } + + /** + * Create a {@link SampleResourceImpl} of type {@link ResourceType#PRODUCTSAMPLE} with the supplied short name + * + * @param shortName + * @return + * @throws RepositoryBackendException + * @throws RepositoryResourceException + */ + private SampleResourceImpl createAndUploadSampleResource(String shortName) throws RepositoryResourceException, RepositoryBackendException { + SampleResourceImpl testResource = createSampleResource(shortName); + uploadResource(testResource); + return testResource; + } + + /** + * @return + */ + private SampleResourceImpl createSampleResource(String shortName) { + SampleResourceImpl testResource = new SampleResourceImpl(getConnection()); + testResource.setType(ResourceType.PRODUCTSAMPLE); + testResource.setShortName(shortName); + testResource.setName(shortName + " Full Name"); + return testResource; + } + + /** + * Creates an {@link EsaResourceImpl} and uploads it to massive with just the core fields set. + * + * @param symbolicName The symbolic name of the resource + * @param shortName The short name of the resource + * @param version The version of the resource + * @return The resource + * @throws RepositoryResourceException + * @throws RepositoryBackendException + */ + private EsaResourceImpl createEsaResource(String symbolicName, String shortName, String version) throws RepositoryResourceException, RepositoryBackendException { + return createEsaResource(symbolicName, shortName, version, null, null); + } + + /** + * Creates an ESA resource with a set of required iFixes, only the symbolic name will be set from the core fields. + * + * @param symbolicName + * @param singleton + * @return + * @throws RepositoryResourceException + * @throws RepositoryBackendException + */ + private EsaResourceImpl createEsaResource(String symbolicName, Collection fixes) throws RepositoryResourceException, RepositoryBackendException { + return createEsaResource(symbolicName, null, null, null, null, null, false, fixes); + } + + /** + * Creates an {@link EsaResourceImpl} and uploads it to massive with all fields set but no fixes + * + * @param symbolicName The symbolic name of the resource + * @param shortName The short name of the resource + * @param version The version of the resource + * @param dependencySymoblicName The symbolic names of dependencies + * @param appliesTo The product this feature applies to + * @return The resource + * @throws RepositoryBackendException + */ + private EsaResourceImpl createEsaResource(String symbolicName, String shortName, String version, Collection dependencySymoblicNames, + String appliesTo) throws RepositoryResourceException, RepositoryBackendException { + return createEsaResource(symbolicName, shortName, version, dependencySymoblicNames, appliesTo, null, false, null); + } + + /** + * Creates an {@link EsaResourceImpl} and uploads it to massive with all fields set. + * + * @param symbolicName The symbolic name of the resource + * @param shortName The short name of the resource + * @param version The version of the resource + * @param appliesTo The product this feature applies to + * @param dependencySymoblicName The symbolic names of dependencies + * @param provisionSymbolicNames The symbolic name(s) of the capability required for this feature to be auto provision + * @param autoInstallable The autoInstallable value to use + * @param requiredFixes fixes required by this feature + * @return The resource + * @throws RepositoryBackendException + */ + private EsaResourceImpl createEsaResource(String symbolicName, String shortName, String version, Collection dependencySymoblicNames, String appliesTo, + Collection provisionSymbolicNames, boolean autoInstallable, + Collection requiredFixes) throws RepositoryResourceException, RepositoryBackendException { + EsaResourceImpl testResource = new EsaResourceImpl(getConnection()); + testResource.setProvideFeature(symbolicName); + testResource.setShortName(shortName); + testResource.setVersion(version); + testResource.setRequireFeature(dependencySymoblicNames); + testResource.setAppliesTo(appliesTo); + String name = "name"; + if (shortName != null) { + name = shortName; + } else if (symbolicName != null) { + name = symbolicName; + } + testResource.setName(name); + if (provisionSymbolicNames != null && !provisionSymbolicNames.isEmpty()) { + boolean first = true; + StringBuilder ibmProvisionCapability = new StringBuilder(); + for (String provisionSymbolicName : provisionSymbolicNames) { + if (!first) { + ibmProvisionCapability.append(","); + } + ibmProvisionCapability.append("osgi.identity; filter:=\"(&(type=osgi.subsystem.feature)(osgi.identity=" + provisionSymbolicName + "))\""); + first = false; + } + testResource.setProvisionCapability(ibmProvisionCapability.toString()); + } + testResource.setInstallPolicy(autoInstallable ? InstallPolicy.WHEN_SATISFIED : InstallPolicy.MANUAL); + if (requiredFixes != null) { + for (String fix : requiredFixes) { + testResource.addRequireFix(fix); + } + } + uploadResource(testResource); + return testResource; + } + + /** + * Creates and uploads a new IfixResource in Massive + * + * @param fixId + * @param appliesTo + * @param lastUpdateDate + * @return + * @throws RepositoryResourceException + * @throws RepositoryBackendException + */ + private IfixResourceImpl createIFixResource(String fixId, String appliesTo, Date lastUpdateDate) throws RepositoryResourceException, RepositoryBackendException { + IfixResourceImpl iFixResource = new IfixResourceImpl(getConnection()); + iFixResource.setProvideFix(Collections.singleton(fixId)); + iFixResource.setAppliesTo(appliesTo); + iFixResource.setDate(lastUpdateDate); + iFixResource.setName("ifix " + _count++); + iFixResource.setProviderName("IBM"); + uploadResource(iFixResource); + return iFixResource; + } + + private void uploadResource(RepositoryResourceImpl mr) + throws RepositoryResourceException, RepositoryBackendException { + mr.uploadToMassive(new BasicTestStrategy()); + } + + /** + * A really stupid strategy, that assumes all you want to do is add one asset + * to an empty repository, and not change it's state, or hide anything else + * or anything really. + */ + public static class BasicTestStrategy extends BaseStrategy { + @Override + public void uploadAsset(RepositoryResourceImpl resource, List matchingResources) throws RepositoryBackendException, RepositoryResourceException { + resource.addAsset(); + } + + } + +} diff --git a/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/ResolverTestUtils.java b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/ResolverTestUtils.java new file mode 100755 index 00000000000..03c7879086a --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/ResolverTestUtils.java @@ -0,0 +1,89 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.resolver; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Properties; + +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.osgi.framework.Version; + +import com.ibm.ws.kernel.feature.provisioning.ProvisioningFeatureDefinition; +import com.ibm.ws.kernel.productinfo.ProductInfo; +import com.ibm.ws.kernel.productinfo.ProductInfoParseException; + +/** + * Utilities for testing the Massive Resolver + */ +public class ResolverTestUtils { + + /** + * Mocks a {@link ProvisioningFeatureDefinition}. + * + * @param mockery + * @param provideFeature + * @param version + * @param shortName + * @return + */ + public static ProvisioningFeatureDefinition mockSimpleFeatureDefinition(Mockery mockery, final String provideFeature, final Version version, final String shortName) { + final ProvisioningFeatureDefinition featureDefinition = mockery.mock(ProvisioningFeatureDefinition.class, provideFeature); + mockery.checking(new Expectations() { + { + allowing(featureDefinition).getSymbolicName(); + will(returnValue(provideFeature)); + allowing(featureDefinition).getIbmShortName(); + will(returnValue(shortName)); + allowing(featureDefinition).getVersion(); + will(returnValue(version)); + allowing(featureDefinition).getHeader(with(any(String.class))); + } + }); + return featureDefinition; + } + + /** + * @param id required + * @param edition required + * @param version required + * @param license optional + * @param installType optional + * @return + * @throws IOException + * @throws ProductInfoParseException + */ + public static ProductInfo createProductInfo(String id, String edition, String version, String license, String installType) throws IOException, ProductInfoParseException { + Properties properties = new Properties(); + properties.put(ProductInfo.COM_IBM_WEBSPHERE_PRODUCTID_KEY, id); + + // Every product info needs a name but we don't use it so just set to ID + properties.put(ProductInfo.COM_IBM_WEBSPHERE_PRODUCTNAME_KEY, id); + properties.put(ProductInfo.COM_IBM_WEBSPHERE_PRODUCTVERSION_KEY, version); + properties.put(ProductInfo.COM_IBM_WEBSPHERE_PRODUCTEDITION_KEY, edition); + if (license != null) { + properties.put("com.ibm.websphere.productLicenseType", license); + } + if (installType != null) { + properties.put("com.ibm.websphere.productInstallType", installType); + } + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + properties.store(outputStream, null); + ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); + ProductInfo productInfo1 = ProductInfo.parseProductInfo(new InputStreamReader(inputStream), null); + return productInfo1; + } + +} diff --git a/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/internal/RepositoryResolveContextFatTest.java b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/internal/RepositoryResolveContextFatTest.java new file mode 100755 index 00000000000..83582b06831 --- /dev/null +++ b/dev/com.ibm.ws.repository.resolver_fat/fat/src/com/ibm/ws/repository/resolver/internal/RepositoryResolveContextFatTest.java @@ -0,0 +1,131 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2013 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.resolver.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assume.assumeTrue; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.osgi.resource.Capability; +import org.osgi.resource.Requirement; +import org.osgi.resource.Resource; + +import com.ibm.ws.repository.base.servers.DirectoryConnectionRule; +import com.ibm.ws.repository.base.servers.LarsConnectionRule; +import com.ibm.ws.repository.base.servers.MassiveConnectionRule; +import com.ibm.ws.repository.base.servers.RestRepositoryConnectionRule; +import com.ibm.ws.repository.common.enums.ResourceType; +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RepositoryConnectionList; +import com.ibm.ws.repository.exceptions.RepositoryBackendException; +import com.ibm.ws.repository.exceptions.RepositoryResourceException; +import com.ibm.ws.repository.resolver.FATSuite; +import com.ibm.ws.repository.resolver.RepositoryResolverTest; +import com.ibm.ws.repository.resolver.RepositoryResolverTest.BasicTestStrategy; +import com.ibm.ws.repository.resolver.internal.namespace.InstallableEntityIdentityConstants; +import com.ibm.ws.repository.resolver.internal.namespace.InstallableEntityIdentityConstants.NameAttributes; +import com.ibm.ws.repository.resolver.internal.resource.InstallableEntityRequirement; +import com.ibm.ws.repository.resources.internal.EsaResourceImpl; + +/** + * Tests for the {@link RepositoryResolveContext} class. + */ +public class RepositoryResolveContextFatTest { + + @Rule + public RestRepositoryConnectionRule connection; + + private RepositoryConnection getConnection() { + return connection.getConnection(); + } + + public static class RepositoryResolveContextFatTestMassive extends RepositoryResolveContextFatTest { + public RepositoryResolveContextFatTestMassive() { + connection = new MassiveConnectionRule(FATSuite.massiveResource); + } + } + + public static class RepositoryResolveContextFatTestLars extends RepositoryResolveContextFatTest { + public RepositoryResolveContextFatTestLars() { + if (FATSuite.larsResource != null) { + connection = new LarsConnectionRule(FATSuite.larsResource); + } + } + } + + public static class RepositoryResolveContextFatTestDirectory extends RepositoryResolveContextFatTest { + public RepositoryResolveContextFatTestDirectory() { + connection = new DirectoryConnectionRule(); + } + } + + /** + * Don't run tests if the connection is null. This will happen where + * (for example) it is a LARS connection running on a Java 6 VM. + */ + @Before + public void skipIfNullConnection() { + assumeTrue(connection != null); + } + + /** + * Tests that if no matching feature is found then it will be loaded from the repository + * + * @throws RepositoryBackendException + * @throws RepositoryResourceException + */ + @Test + public void testFeatureFromRepo() throws RepositoryResourceException, RepositoryBackendException { + Requirement requirement = new InstallableEntityRequirement("foo", InstallableEntityIdentityConstants.TYPE_FEATURE); + List empty = Collections.emptyList(); + EsaResourceImpl resourceToMatch = new EsaResourceImpl(getConnection()); + resourceToMatch.setProvideFeature("foo"); + resourceToMatch.uploadToMassive(new BasicTestStrategy()); + + List repoResources = new ArrayList(); + RepositoryResolveContext testObject = new RepositoryResolveContext(null, null, empty, empty, repoResources, new RepositoryConnectionList(getConnection())); + List foundCapabilities = testObject.findProviders(requirement); + assertEquals("There should be one match to the repo capability", 1, foundCapabilities.size()); + assertEquals("The repo resource should have been added to the list of repo resources", 1, repoResources.size()); + assertEquals("The match should be to the repo capability", repoResources.get(0).getCapabilities(null).get(0), foundCapabilities.get(0)); + } + + /** + * Tests that if no matching sample is found then it will be loaded from the repository + * + * @throws RepositoryBackendException + * @throws RepositoryResourceException + */ + @Test + public void testSampleFromRepo() throws RepositoryResourceException, RepositoryBackendException { + Requirement requirement = new InstallableEntityRequirement(NameAttributes.SHORT_NAME, "foo", null, InstallableEntityIdentityConstants.TYPE_SAMPLE); + List empty = Collections.emptyList(); + com.ibm.ws.repository.resources.internal.SampleResourceImpl resourceToMatch = new com.ibm.ws.repository.resources.internal.SampleResourceImpl(getConnection()); + resourceToMatch.setShortName("foo"); + resourceToMatch.setType(ResourceType.PRODUCTSAMPLE); + resourceToMatch.uploadToMassive(new RepositoryResolverTest.BasicTestStrategy()); + + List repoResources = new ArrayList(); + RepositoryResolveContext testObject = new RepositoryResolveContext(null, null, empty, empty, repoResources, new RepositoryConnectionList(getConnection())); + List foundCapabilities = testObject.findProviders(requirement); + assertEquals("There should be one match to the repo capability", 1, foundCapabilities.size()); + assertEquals("The repo resource should have been added to the list of repo resources", 1, repoResources.size()); + assertEquals("The match should be to the repo capability", repoResources.get(0).getCapabilities(null).get(0), foundCapabilities.get(0)); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/.classpath b/dev/com.ibm.ws.repository.test.utils/.classpath new file mode 100755 index 00000000000..2876090f903 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.test.utils/.classpath.gradle b/dev/com.ibm.ws.repository.test.utils/.classpath.gradle new file mode 100644 index 00000000000..2876090f903 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.test.utils/.gitignore b/dev/com.ibm.ws.repository.test.utils/.gitignore new file mode 100644 index 00000000000..98d5fd07357 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.gitignore @@ -0,0 +1,3 @@ +testLogin.properties +/dist +/testLogin_basicAuth.properties diff --git a/dev/com.ibm.ws.repository.test.utils/.project b/dev/com.ibm.ws.repository.test.utils/.project new file mode 100755 index 00000000000..cee40e1dafa --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.repository.test.utils + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..169aea7eabe --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Wed Aug 17 16:19:12 BST 2011 +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..95719ae3709 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=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_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +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_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not 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_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=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_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=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_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=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_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=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_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=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_and_in_type_parameter=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_assignment_operator=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_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=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.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=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_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=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_new_line_before_closing_brace_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_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=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_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=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_after_at_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=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_labeled_statement=do not 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_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.compact_else_if=true +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_while=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_for_increments=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_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert diff --git a/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..13e9e1f92c5 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,116 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.remove_trailing_whitespaces=true +cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.add_missing_nls_tags=false +org.eclipse.jdt.ui.staticondemandthreshold=99 +cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_blocks=false +sp_cleanup.make_private_fields_final=true +org.eclipse.jdt.ui.ignorelowercasenames=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.remove_private_constructors=true +sp_cleanup.never_use_parentheses_in_expressions=true +cleanup.remove_unnecessary_casts=true +sp_cleanup.organize_imports=true +sp_cleanup.never_use_blocks=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_fields=true +org.eclipse.jdt.ui.text.custom_code_templates= +cleanup.always_use_parentheses_in_expressions=false +cleanup.use_parentheses_in_expressions=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.always_use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.correct_indentation=true +cleanup.make_private_fields_final=false +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.correct_indentation=false +cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +org.eclipse.jdt.ui.ondemandthreshold=99 +sp_cleanup.sort_members_all=false +sp_cleanup.use_this_for_non_static_field_access=false +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +org.eclipse.jdt.ui.exception.name=e +sp_cleanup.format_source_code=true +org.eclipse.jdt.ui.javadoc=true +cleanup.format_source_code=false +cleanup.remove_unused_imports=true +cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_methods=true +cleanup.add_missing_annotations=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_private_methods=true +cleanup.always_use_this_for_non_static_method_access=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.sort_members=false +sp_cleanup.use_parentheses_in_expressions=false +cleanup.add_missing_override_annotations=true +org.eclipse.jdt.ui.gettersetter.use.is=false +cleanup.convert_to_enhanced_for_loop=false +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.overrideannotation=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.add_missing_annotations=true +cleanup.make_variable_declarations_final=false +cleanup.remove_unused_private_types=true +cleanup.use_blocks=true +cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.remove_unused_imports=true +cleanup.add_missing_deprecated_annotations=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.convert_to_enhanced_for_loop=false +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.sort_members=false +sp_cleanup.remove_unused_private_members=false +org.eclipse.jdt.ui.importorder=java;javax;org;com; +cleanup.remove_unused_private_members=false +sp_cleanup.format_source_code_changes_only=false +cleanup.never_use_blocks=false +cleanup.organize_imports=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_generated_serial_version_id=false +cleanup.make_parameters_final=true +org.eclipse.jdt.ui.keywordthis=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.always_use_blocks=true +cleanup.add_serial_version_id=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.always_use_blocks=true +cleanup.remove_unused_local_variables=false +cleanup.sort_members_all=false +sp_cleanup.remove_trailing_whitespaces=true +cleanup.format_source_code_changes_only=false +cleanup.add_generated_serial_version_id=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.remove_private_constructors=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_local_variable_final=false +cleanup.make_local_variable_final=false +sp_cleanup.add_serial_version_id=false +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.add_default_serial_version_id=false +cleanup.add_missing_methods=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.add_missing_methods=false diff --git a/dev/com.ibm.ws.repository.test.utils/IBMInternalRootCA.der b/dev/com.ibm.ws.repository.test.utils/IBMInternalRootCA.der new file mode 100755 index 00000000000..f89a8b2ccf6 Binary files /dev/null and b/dev/com.ibm.ws.repository.test.utils/IBMInternalRootCA.der differ diff --git a/dev/com.ibm.ws.repository.test.utils/bnd.bnd b/dev/com.ibm.ws.repository.test.utils/bnd.bnd new file mode 100644 index 00000000000..3d5aad1281a --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/bnd.bnd @@ -0,0 +1,13 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/mongo-client/mongo-java-driver-2.14.2.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.json4j;version=latest, \ + com.ibm.websphere.javaee.jsonp.1.0;version=latest, \ + com.ibm.ws.org.codehaus.jackson.1.6.2;version=latest, \ + com.ibm.ws.repository;version=latest diff --git a/dev/com.ibm.ws.repository.test.utils/bnd.bnd.gradle b/dev/com.ibm.ws.repository.test.utils/bnd.bnd.gradle new file mode 100644 index 00000000000..3d5aad1281a --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/bnd.bnd.gradle @@ -0,0 +1,13 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/mongo-client/mongo-java-driver-2.14.2.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.json4j;version=latest, \ + com.ibm.websphere.javaee.jsonp.1.0;version=latest, \ + com.ibm.ws.org.codehaus.jackson.1.6.2;version=latest, \ + com.ibm.ws.repository;version=latest diff --git a/dev/com.ibm.ws.repository.test.utils/build-noship.xml b/dev/com.ibm.ws.repository.test.utils/build-noship.xml new file mode 100755 index 00000000000..3aa19ba792c --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/build-noship.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.test.utils/build.gradle b/dev/com.ibm.ws.repository.test.utils/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.repository.test.utils/delivery.sets b/dev/com.ibm.ws.repository.test.utils/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.repository.test.utils/lib/larsServer.jar b/dev/com.ibm.ws.repository.test.utils/lib/larsServer.jar new file mode 100755 index 00000000000..1a7c265a996 Binary files /dev/null and b/dev/com.ibm.ws.repository.test.utils/lib/larsServer.jar differ diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/AssetByIdMatcher.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/AssetByIdMatcher.java new file mode 100755 index 00000000000..d5f95c36ebc --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/AssetByIdMatcher.java @@ -0,0 +1,58 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import org.hamcrest.Description; +import org.hamcrest.Factory; +import org.hamcrest.TypeSafeMatcher; + +import com.ibm.ws.repository.transport.model.Asset; + +/** + * Matches Assets against each other by comparing only the IDs. + *

+ * If you have added some assets and then retrieved them, you can check the list of retrieved assets is correct with + *

+ * assertThat(returnedAssets, containsInAnyOrder(byId(asset1), byId(asset2), ...))
+ * 
+ */ +public class AssetByIdMatcher extends TypeSafeMatcher { + + private final String expectedId; + + private AssetByIdMatcher(String expectedId) { + this.expectedId = expectedId; + } + + /** {@inheritDoc} */ + @Override + public void describeTo(Description description) { + description.appendText("asset id should be ").appendValue(expectedId); + } + + /** {@inheritDoc} */ + @Override + protected boolean matchesSafely(Asset asset) { + return asset.get_id().equals(expectedId); + } + + @Factory + public static AssetByIdMatcher hasId(String id) { + return new AssetByIdMatcher(id); + } + + @Factory + public static AssetByIdMatcher hasId(Asset asset) { + return new AssetByIdMatcher(asset.get_id()); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DeleteRepo.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DeleteRepo.java new file mode 100755 index 00000000000..9db6ef8e8ab --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DeleteRepo.java @@ -0,0 +1,184 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package com.ibm.ws.repository.base; + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.charset.Charset; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.codehaus.jackson.JsonGenerator.Feature; +import org.codehaus.jackson.JsonParseException; +import org.codehaus.jackson.map.JsonMappingException; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; +import org.codehaus.jackson.map.type.TypeFactory; +import org.codehaus.jackson.type.JavaType; + +import com.ibm.ws.repository.connections.RestRepositoryConnection; + +/** + * Deletes all the entries in a repo. This is a standalone util that does not + * rely on the MassiveClient so that it will work even if the repo being deleted + * has backwards breaking changes, sadly this leads to some code duplication but + * this is a necessary evil to be able to delete "broken" repos. + */ +public class DeleteRepo { + + private static final String URL_BASE = "https://5.153.49.84/ma/v1"; + private static final String SOFTLAYER_USER_ID = "liberty"; + private static final String SOFTLAYER_USER_PASSWORD = "W3bSp#3reD!"; + private static final String USER_ID = "svt2@ibm.com"; + private static final String PASSWORD = "g0pher##"; + private static final String API_KEY = "18965347087"; + private final static ObjectMapper MAPPER = new ObjectMapper(); + static { + // Setup the mapper config, have one mapper for all + // Printing to sysout at the mo so don't want to close it + MAPPER.configure(Feature.AUTO_CLOSE_TARGET, false); + + // Use the date format dictated by Massive + MAPPER.getSerializationConfig().setSerializationInclusion( + Inclusion.NON_NULL); + SimpleDateFormat df = new SimpleDateFormat( + "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); + MAPPER.getDeserializationConfig().setDateFormat(df); + MAPPER.getSerializationConfig().setDateFormat(df); + + // Ignore unknown attributes, we just care about IDs + MAPPER.getDeserializationConfig() + .disable( + org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); + } + + public static void main(String[] args) throws JsonParseException, + JsonMappingException, IOException { + RestRepositoryConnection loginInfo = new RestRepositoryConnection(USER_ID, PASSWORD, API_KEY, + URL_BASE, SOFTLAYER_USER_ID, SOFTLAYER_USER_PASSWORD); + deleteRepo(loginInfo); + } + + public static void deleteRepo(RestRepositoryConnection loginInfoResource) throws IOException { + // Get all + HttpURLConnection getAllConnection = createHttpURLConnection(loginInfoResource.getRepositoryUrl() + "/assets", loginInfoResource); + getAllConnection.setRequestMethod("GET"); + List assets = readValues(getAllConnection.getInputStream(), IdHolder.class); + + // Get all doesn't return attachments so call get attachments on each to + // get them as there isn't a delete asset and attachment method on + // massive so need to delete attachments first + for (IdHolder asset : assets) { + HttpURLConnection getAttachmentsConnection = createHttpURLConnection(loginInfoResource.getRepositoryUrl() + + "/assets/" + asset.get_id() + + "/attachments", loginInfoResource); + getAttachmentsConnection.setRequestMethod("GET"); + List attachments = readValues(getAttachmentsConnection.getInputStream(), IdHolder.class); + Logger logger = Logger.getLogger(DeleteRepo.class.getName()); + for (IdHolder attachment : attachments) { + logger.log(Level.INFO, "Deleting attachment " + attachment.get_id()); + HttpURLConnection deleteAttachmentConnection = createHttpURLConnection(loginInfoResource.getRepositoryUrl() + "/assets/" + + asset.get_id() + "/attachments/" + + attachment.get_id(), loginInfoResource); + deleteAttachmentConnection.setRequestMethod("DELETE"); + if (HttpURLConnection.HTTP_OK != deleteAttachmentConnection.getResponseCode()) { + throw new RuntimeException("Unable to delete " + + attachment.get_id() + " from " + asset.get_id() + + ", got return code: " + + deleteAttachmentConnection.getResponseCode()); + } + } + + // Now delete asset + logger.log(Level.INFO, "Deleting " + asset.get_id()); + HttpURLConnection deleteAssetConnection = createHttpURLConnection(loginInfoResource.getRepositoryUrl() + "/assets/" + asset.get_id(), + loginInfoResource); + deleteAssetConnection.setRequestMethod("DELETE"); + int responseCode = deleteAssetConnection.getResponseCode(); + if (responseCode != HttpURLConnection.HTTP_OK && responseCode != HttpURLConnection.HTTP_NO_CONTENT) { + throw new RuntimeException("Unable to delete " + asset.get_id() + + ", got return code: " + + deleteAssetConnection.getResponseCode()); + } + } + } + + public static List readValues(InputStream inputStream, Class type) + throws JsonParseException, JsonMappingException, IOException { + JavaType jacksonType = TypeFactory.collectionType(List.class, type); + return MAPPER.readValue(inputStream, jacksonType); + } + + private static class IdHolder { + private String _id; + + public String get_id() { + return _id; + } + + public void set_id(String _id) { + this._id = _id; + } + + } + + private static HttpURLConnection createHttpURLConnection( + final String urlString, final RestRepositoryConnection loginInfoResource) throws IOException { + // Add the api key, might already have query parameters so check + final String connectingString = urlString.contains("?") ? "&" : "?"; + URL url; + try { + url = AccessController.doPrivileged(new PrivilegedExceptionAction() { + + @Override + public URL run() throws MalformedURLException { + return new URL(urlString + connectingString + "apiKey=" + loginInfoResource.getApiKey()); + } + }); + } catch (PrivilegedActionException e) { + throw (MalformedURLException) e.getCause(); + } + + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + String basicAuthUserPass = null; + + if (loginInfoResource.getSoftlayerUserId() != null) { + basicAuthUserPass = loginInfoResource.getSoftlayerUserId() + ":" + loginInfoResource.getSoftlayerPassword(); + } else if (loginInfoResource.getUserId() != null && loginInfoResource.getPassword() != null) { + basicAuthUserPass = loginInfoResource.getUserId() + ":" + loginInfoResource.getPassword(); + } + + if (basicAuthUserPass != null) { + String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(basicAuthUserPass.getBytes(Charset.forName("UTF-8"))); + connection.setRequestProperty("Authorization", basicAuth); + } + + if (loginInfoResource.getUserId() != null) { + connection.addRequestProperty("userId", loginInfoResource.getUserId()); + } + if (loginInfoResource.getPassword() != null) { + connection.addRequestProperty("password", loginInfoResource.getPassword()); + } + return connection; + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DirectoryRepositoryTestUtils.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DirectoryRepositoryTestUtils.java new file mode 100755 index 00000000000..cff05a2a124 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/DirectoryRepositoryTestUtils.java @@ -0,0 +1,104 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.Collection; + +import com.ibm.ws.repository.connections.DirectoryRepositoryConnection; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; + +/** + * + */ +public class DirectoryRepositoryTestUtils implements RepositoryTestUtils { + + private File _root; + + /** {@inheritDoc} */ + @Override + public void setUpClass() {} + + /** {@inheritDoc} */ + @Override + public void tearDownClass() {} + + private void deleteDir(File f) { + if (f.exists()) { + if (f.isDirectory()) { + for (File child : f.listFiles()) { + deleteDir(child); + } + if (!f.delete()) { + System.out.println("*** FAILED TO DELETE " + f.getAbsolutePath()); + } + } else { + if (!f.delete()) { + System.out.println("*** FAILED TO DELETE " + f.getAbsolutePath()); + } + } + } + System.out.println("Deleting " + f.getAbsolutePath()); + } + + /** + * {@inheritDoc} + * + * @return + */ + @Override + public DirectoryRepositoryConnection setUpTest(boolean wipeBeforeEachTest) throws Exception { + // A new sub directory is created for each test at the moment, so tests don't reuse the same directory + _root = File.createTempFile("repoTest", "test"); + _root.delete(); + _root.mkdir(); + System.out.println("testing using " + _root.getAbsolutePath()); + File testSubDir = new File(_root, "" + Math.random()); + testSubDir.mkdirs(); + return new DirectoryRepositoryConnection(testSubDir); + } + + /** {@inheritDoc} */ + @Override + public void tearDownTest(boolean wipeBeforeEachTest) throws Exception { + deleteDir(_root); + } + + /** {@inheritDoc} */ + @Override + public DirectoryRepositoryConnection createNewRepo() throws NoRepoAvailableException { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public Collection getAllResourcesWithDupes() throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, InstantiationException, IllegalArgumentException, InvocationTargetException { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public DirectoryRepositoryConnection getRepositoryConnection() { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public void refreshTextIndex(String lastAssetId) throws Exception { + // Do nothing, there's no text index to refresh for directory repo + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManager.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManager.java new file mode 100755 index 00000000000..a77b911ce5d --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManager.java @@ -0,0 +1,140 @@ +package com.ibm.ws.repository.base; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.security.InvalidAlgorithmParameterException; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertPath; +import java.security.cert.CertPathValidator; +import java.security.cert.CertPathValidatorException; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.PKIXParameters; +import java.security.cert.TrustAnchor; +import java.security.cert.X509Certificate; +import java.util.Arrays; +import java.util.Collections; +import java.util.Set; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509TrustManager; + +/** + * An X509 trust manager which trusts the IBM Internal Root CA certificate. + *

+ * This class wraps another X509TrustManager which it delegates everything to, + * except that it additionally returns the IBM certificate from {@link #getAcceptedIssuers()}. + */ +public class IBMInternalTrustManager implements X509TrustManager { + + private final X509TrustManager realX509TM; + private X509Certificate ibmInternalRootCA = null; + private CertificateFactory certificateFactory; + private CertPathValidator validator; + + /** + * @param realX509TM the trust manager to delegate to + * @throws IBMInternalTrustManagerException if a problem occurs while creating the trust manager + */ + public IBMInternalTrustManager(X509TrustManager realX509TM) throws IBMInternalTrustManagerException { + this.realX509TM = realX509TM; + try { + certificateFactory = CertificateFactory.getInstance("X.509"); + FileInputStream stream = new FileInputStream(new File("lib/LibertyFATTestFiles/IBMInternalRootCA.der")); + ibmInternalRootCA = (X509Certificate) certificateFactory.generateCertificate(stream); + validator = CertPathValidator.getInstance("PKIX"); + } catch (CertificateException e) { + throw new IBMInternalTrustManagerException("Failed to create internal trust manager", e); + } catch (FileNotFoundException e) { + throw new IBMInternalTrustManagerException("Failed to load IBM Internal Root CA cert", e); + } catch (NoSuchAlgorithmException e) { + throw new IBMInternalTrustManagerException("Failed to create internal trust manager", e); + } + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + // Make a copy of the array of certificates and add the + // IBM Internal CA Cert to the end + X509Certificate[] certs = realX509TM.getAcceptedIssuers(); + X509Certificate[] newCerts = Arrays.copyOf(certs, certs.length + 1); + newCerts[newCerts.length - 1] = ibmInternalRootCA; + return newCerts; + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + // Set up a CertPath for validation with the IBM internal certificate as the only trust anchor + Set anchors = Collections.singleton(new TrustAnchor(ibmInternalRootCA, null)); + CertPath path = certificateFactory.generateCertPath(Arrays.asList(chain)); + try { + PKIXParameters params = new PKIXParameters(anchors); + params.setRevocationEnabled(false); + + validator.validate(path, params); + } catch (CertPathValidatorException e) { + // We couldn't validate the chain, let our parent have a go + // This is expected for any chains which don't end with the IBM internal root CA + realX509TM.checkServerTrusted(chain, authType); + } catch (InvalidAlgorithmParameterException e) { + throw new CertificateException(e); + } + + } + + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + realX509TM.checkClientTrusted(chain, authType); + } + + /** + * Create an SSLSocketFactory which uses an IBMInternalTrustManager. + * + * @return an SSLSocketFactory + * @throws IBMInternalTrustManagerException if the operation fails + */ + public static SSLSocketFactory getSSLSocketFactry() throws IBMInternalTrustManagerException { + + try { + // Initialize the trust manager factory + TrustManagerFactory tmFactory = TrustManagerFactory.getInstance("PKIX"); + tmFactory.init((KeyStore) null); + + // Find a real X509TrustManager that we can extend + TrustManager[] realTMs = tmFactory.getTrustManagers(); + X509TrustManager x509TM = null; + for (TrustManager tm : realTMs) { + if (tm instanceof X509TrustManager) { + x509TM = (X509TrustManager) tm; + break; + } + } + + // Create our new trust manager which trusts the IBM Root CA Cert + if (x509TM == null) { + throw new IBMInternalTrustManagerException("Couldn't find an existing Trust Manager to extend"); + } + + TrustManager internalTM = new IBMInternalTrustManager(x509TM); + + SSLContext sc = SSLContext.getInstance("TLS"); + sc.init(null, new TrustManager[] { internalTM }, null); + return sc.getSocketFactory(); + } catch (NoSuchAlgorithmException e) { + throw new IBMInternalTrustManagerException("Failed to create internal SSLSocketFactory", e); + } catch (KeyManagementException e) { + throw new IBMInternalTrustManagerException("Failed to create internal SSLSocketFactory", e); + } catch (KeyStoreException e) { + throw new IBMInternalTrustManagerException("Failed to create internal SSLSocketFactory", e); + } + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManagerException.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManagerException.java new file mode 100755 index 00000000000..cc9af599f15 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/IBMInternalTrustManagerException.java @@ -0,0 +1,12 @@ +package com.ibm.ws.repository.base; + +public class IBMInternalTrustManagerException extends Exception { + + public IBMInternalTrustManagerException(String message) { + super(message); + } + + public IBMInternalTrustManagerException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/JsonAnyOrderMatcher.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/JsonAnyOrderMatcher.java new file mode 100644 index 00000000000..e8335ada2f3 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/JsonAnyOrderMatcher.java @@ -0,0 +1,87 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* Copyright IBM Corp. 2017 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.repository.base; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import javax.json.JsonArray; +import javax.json.JsonObject; +import javax.json.JsonValue; + +import org.hamcrest.Description; +import org.hamcrest.Factory; +import org.hamcrest.TypeSafeMatcher; + +/** + * Matches JsonValues, ignoring any ordering of items in arrays or fields in objects. + */ +public class JsonAnyOrderMatcher extends TypeSafeMatcher { + + private final Object matchingObject; + + public JsonAnyOrderMatcher(JsonValue value) { + matchingObject = makeOrderInsensitive(value); + } + + /** {@inheritDoc} */ + @Override + public void describeTo(Description description) { + description.appendText("Json equivelent (ignoring order of array elements and fields) to ").appendValue(matchingObject); + + } + + /** {@inheritDoc} */ + @Override + protected boolean matchesSafely(JsonValue value) { + return matchingObject.equals(makeOrderInsensitive(value)); + } + + private static Object makeOrderInsensitive(JsonValue value) { + switch (value.getValueType()) { + case ARRAY: + return makeArrayOrderInsensitive((JsonArray) value); + case OBJECT: + return makeObjectOrderInsensitive((JsonObject) value); + default: + return value; + } + } + + private static Set makeArrayOrderInsensitive(JsonArray jsonArray) { + Set result = new HashSet(); + for (JsonValue value : jsonArray) { + result.add(makeOrderInsensitive(value)); + } + return result; + } + + private static Map makeObjectOrderInsensitive(JsonObject jsonObject) { + Map result = new HashMap(); + for (Entry entry : jsonObject.entrySet()) { + result.put(entry.getKey(), makeOrderInsensitive(entry.getValue())); + } + return result; + } + + /** + * Creates a matcher for JsonValues that matches if the examined JsonValue is equal to the specified JsonValue, ignoring the order of fields and array elements. + */ + @Factory + public static JsonAnyOrderMatcher matchesJsonInAnyOrder(JsonValue value) { + return new JsonAnyOrderMatcher(value); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/LoginInfoProvider.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/LoginInfoProvider.java new file mode 100755 index 00000000000..2656ccf9df7 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/LoginInfoProvider.java @@ -0,0 +1,478 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package com.ibm.ws.repository.base; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.nio.charset.Charset; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Properties; +import java.util.Random; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.net.ssl.HttpsURLConnection; + +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.transport.client.DataModelSerializer; +import com.ibm.ws.repository.transport.client.JSONAssetConverter; +import com.ibm.ws.repository.transport.client.RestClient; +import com.ibm.ws.repository.transport.exceptions.BadVersionException; + +/** + * Creates a loginInfo object for the credentials listed in /com.ibm.ws.repository.test.utils/src/testLogin.properties. + *

+ * If testLogin.properties contains more than one set of server details, this class will try each of them in a random order until it finds one that is contactable. + */ +public class LoginInfoProvider { + + private String userId = null; + private String password = null; + private String softlayerUserId = null; + private String softlayerPassword = null; + + private List servers = null; + + private static final Logger logger = Logger.getLogger(LoginInfoProvider.class.getName()); + + private static class ServerInfo { + String url; + String apiKey; + } + + private RestRepositoryConnection cachedLoginInfo; + + private static final String TESTRUN_USER_ID = "repoBuilds@ibm.com"; + private static final String TESTRUN_PASSWORD = "T35tiN6!"; + + private static final String MARKETPLACE_PREFIX = "RepoTest_"; + + /** + * Match property keys which hold server urls and capture the name in group 1. + *

+ * E.g. "foo.url" matches and captures "foo" + */ + private static final Pattern URL_PROPERTY_KEY = Pattern.compile("(\\w+)\\.url"); + + /** + * Create a new LoginInfoProvider, loading the repository details and credentials from the given property file. + * + * @param propertiesFile the file containing the repository details + * @throws FileNotFoundException if the file does not exist + * @throws IOException if a problem is encountered reading the properties file + */ + public LoginInfoProvider(File propertiesFile) throws FileNotFoundException, IOException { + Properties props = new Properties(); + props.load(new FileInputStream(propertiesFile)); + loadProperties(props); + } + + public LoginInfoProvider(Properties props) { + loadProperties(props); + } + + /** + * Get a LoginInfo object for a valid server. This is only suitable for tests using a + * single LoginInfoResource in the LoginInfo (which covers all of the tests which + * are not multi repository specific) + *

+ * This method will take the following steps to find a valid server: + *

    + *
  • If a LoginInfo object has previously been created, it will check if it is still valid and, if so, return it.
  • + *
  • If not, it will attempt to contact each server in turn
  • + *
  • If apiKeys were provided in the properties file, it will attempt to access the marketplace associated with the apiKey
  • + *
  • If apiKeys were not provided in the properties file, it will attempt to create a test marketplace and apiKey and use that
  • + *
+ * + * @return a valid LoginInfo object + * @throws NoRepoAvailableException if no repository can be reached and so a valid LoginInfo object cannot be created + */ + public RestRepositoryConnection getLoginInfo() throws NoRepoAvailableException { + + if (cachedLoginInfo != null) { + try { + assertLoginInfoValid(cachedLoginInfo); + logger.log(Level.INFO, "Reusing cached loginInfo - " + cachedLoginInfo.getRepositoryUrl() + " - " + cachedLoginInfo.getApiKey()); + return cachedLoginInfo; + } catch (IOException e) { + // The cached login info is not valid. + // In this case continue on to create a new login info + } + } + + cachedLoginInfo = createLoginInfoResource(); + logger.log(Level.INFO, "Created new loginInfo - " + cachedLoginInfo.getRepositoryUrl() + " - " + cachedLoginInfo.getApiKey()); + return cachedLoginInfo; + } + + /** + * Used only by multi repository tests + * + * @return + * @throws NoRepoAvailableException + */ + public RestRepositoryConnection createNewRepoFromProperties() throws NoRepoAvailableException { + return createLoginInfoResource(); + } + + /** + * Load server details from the given properties object and clear the cached loginInfo. + *

+ * This method is only meant for testing. + * + * @param props the properties object + */ + private void loadProperties(Properties props) { + logger.log(Level.INFO, "loadProperties entry"); + // Load basic properties, set to null if blank + userId = normalizeProperty(props.getProperty("userId")); + password = normalizeProperty(props.getProperty("password")); + softlayerUserId = normalizeProperty(props.getProperty("softlayerUserId")); + softlayerPassword = normalizeProperty(props.getProperty("softlayerPassword")); + + servers = new ArrayList(); + boolean apiKeysPresent = false; + // Pull out pairs of properties which identify a repository (URL/apiKey pair) + // foo.url = "http://example.com" + // foo.apiKey = "123456" + for (String key : props.stringPropertyNames()) { + Matcher m = URL_PROPERTY_KEY.matcher(key); + if (m.matches()) { + String name = m.group(1); + ServerInfo server = new ServerInfo(); + server.url = props.getProperty(name + ".url"); + server.apiKey = props.getProperty(name + ".apiKey"); + if (server.apiKey != null) { + apiKeysPresent = true; + } + servers.add(server); + } + } + + if (servers.isEmpty()) { + logger.log(Level.INFO, "loadProperties exit"); + throw new IllegalArgumentException("No server details were provided"); + } + + // Check that if any apiKeys are provided, then all apiKeys have been provided + if (apiKeysPresent) { + for (ServerInfo server : servers) { + if (server.apiKey == null) { + logger.log(Level.INFO, "loadProperties exit"); + throw new IllegalArgumentException("LoginInfo contains apiKeys for some servers, but not for " + server.url); + } + } + } + + // Check whether we're using a user-defined API key or generating API keys + if (apiKeysPresent) { + if (userId == null || password == null) { + logger.log(Level.INFO, "loadProperties exit"); + throw new IllegalArgumentException("LoginInfo userId and password must be provided if a fixed apiKey is used"); + } + } else { + if (userId != null || password != null) { + logger.log(Level.INFO, "loadProperties exit"); + throw new IllegalArgumentException("LoginInfo userId, password and apiKey must all be empty to create a testrun apiKey"); + } + // Set the userId and password to the test credentials + userId = TESTRUN_USER_ID; + password = TESTRUN_PASSWORD; + } + + // Randomly choose the order we will contact servers + Collections.shuffle(servers); + logger.log(Level.INFO, "loadProperties exit"); + } + + /** + * Normalises property values by converting blank or whitespace values to null + * + * @param value the value to normalise + * @return null if value is blank or only contains whitespace, otherwise value + */ + private String normalizeProperty(String value) { + if (value != null) { + value = value.trim(); + if (value.isEmpty()) { + value = null; + } + } + return value; + } + + /** + * Checks that the repository referred to by loginInfo is valid and reachable. + *

+ * This method will throw an IOException containing the problem details if the server is not reachable. + * + * @param loginInfo the repository details and credentials + * @throws IOException if the repository cannot be contacted. + */ + private void assertLoginInfoValid(RestRepositoryConnection loginInfoResource) throws IOException { + logger.log(Level.INFO, "assertLoginInfoValid entry"); + HttpURLConnection connection = createConnectionFromLoginInfo("/assets", loginInfoResource); + connection.setRequestMethod("HEAD"); + connection.connect(); + if (connection.getResponseCode() != HttpURLConnection.HTTP_OK + && connection.getResponseCode() != HttpURLConnection.HTTP_NO_CONTENT) { + throw new IOException("Bad response code: " + connection.getResponseCode()); + } + logger.log(Level.INFO, "assertLoginInfoValid exit"); + } + + /** + * Find a working server and create a new LoginInfo object for it. + * + * @return a LoginInfo object for a working server + * @throws NoRepoAvailableException if we could not reach any server + */ + private RestRepositoryConnection createLoginInfoResource() throws NoRepoAvailableException { + logger.log(Level.INFO, "createLoginInfoResource entry"); + NoRepoAvailableException noRepoException = new NoRepoAvailableException(); + + // Failover between servers + for (ServerInfo server : servers) { + try { + // If the user has provided an API key, use it with the given server + if (server.apiKey != null) { + RestRepositoryConnection loginInfoResource = new RestRepositoryConnection(userId, password, server.apiKey, server.url, softlayerUserId, softlayerPassword); + assertLoginInfoValid(loginInfoResource); // Exception thrown if server is down + logger.log(Level.INFO, "createLoginInfoResource exit"); + return loginInfoResource; + } + // Otherwise, we need to try to create an API key + else { + String testApiKey = createApiKey(server.url); + RestRepositoryConnection loginInfoResource = new RestRepositoryConnection(userId, password, testApiKey, server.url, softlayerUserId, softlayerPassword); + logger.log(Level.INFO, "createLoginInfoResource exit"); + return loginInfoResource; + } + } catch (Exception ex) { + // Problem accessing server, collect the error to report if all servers fail + noRepoException.add(server.url, server.apiKey, ex); + // continue round the loop and try the next server + } + } + + // We've hit a problem contacting every server + // Throw the exception holding the problem details for each server + logger.log(Level.INFO, "createLoginInfoResource exit"); + throw noRepoException; + } + + /** + * Create a new marketplace and return the apiKey + * + * @param repositoryUrl the repository base API key + * @return the new apiKey + * @throws IOException if there is a problem communicating with the sever + * @throws BadVersionException + */ + private String createApiKey(String repositoryUrl) throws IOException, BadVersionException { + logger.log(Level.INFO, "createApiKey entry"); + String marketplaceID = createMarketplace(repositoryUrl); + + HttpURLConnection connection = createConnectionFromUrl(repositoryUrl, "/marketplaces/" + marketplaceID + "/apiKeys"); + connection.setRequestMethod("GET"); + connection.setDoOutput(false); + + List mak = DataModelSerializer.deserializeList(connection.getInputStream(), MarketplaceApiKey.class); + + String apiKey = mak.get(0).getKey(); + + logger.log(Level.INFO, "createApiKey exit"); + return apiKey; + } + + /** + * Create a marketplace on the server at the given URL. + * + * @param repositoryUrl the base URL of the server + * @return the id of the new marketplace + * @throws IOException if there's a problem contacting the server + * @throws BadVersionException + */ + private String createMarketplace(String repositoryUrl) throws IOException, BadVersionException { + + HttpURLConnection connection = createConnectionFromUrl(repositoryUrl, "/marketplaces"); + connection.setRequestMethod("POST"); + connection.setDoOutput(true); + + Marketplace marketplace = new Marketplace(); + marketplace.setName(createMarketPlaceName()); + marketplace.setDescription("Reposistory Testsuite test marketplace"); + + JSONAssetConverter.writeValue(connection.getOutputStream(), marketplace); + + Marketplace newMarketplace = DataModelSerializer.deserializeObject(connection.getInputStream(), Marketplace.class); + + return newMarketplace.get_id(); + } + + /** + * Create a (hopefully) unique name for the marketplace with a known prefix + * suffixed with the date and time down to current millisecond plus a random number + *

+ * Eg: RepoTest_YYDDD.hhmmssmmmrand + */ + private String createMarketPlaceName() { + DateFormat dateFormat = new SimpleDateFormat("yyyyDDD.HHmmssSSS"); + return MARKETPLACE_PREFIX + dateFormat.format(new Date()) + new Random().nextInt(1000); + } + + /** + * Create a HttpURLConnection using the credentials, repository and apiKey provided in the loginInfo object. + * + * @param urlString the path to request within the repository + * @param loginInfo the LoginInfo object holding the credentials + * @return the connection object + * @throws IOException if we are unable to open the connection + */ + private HttpURLConnection createConnectionFromLoginInfo(String path, RestRepositoryConnection loginInfoResource) throws IOException { + String connectingString = path.contains("?") ? "&" : "?"; + final String urlString = loginInfoResource.getRepositoryUrl() + path + connectingString + "apiKey=" + loginInfoResource.getApiKey(); + + URL url; + try { + url = AccessController.doPrivileged(new PrivilegedExceptionAction() { + + @Override + public URL run() throws MalformedURLException { + return new URL(urlString); + } + }); + } catch (PrivilegedActionException e) { + throw (MalformedURLException) e.getCause(); + } + + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + if (loginInfoResource.getSoftlayerUserId() != null) { + String userpass = loginInfoResource.getSoftlayerUserId() + ":" + loginInfoResource.getSoftlayerPassword(); + String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes(Charset.forName("UTF-8"))); + connection.setRequestProperty("Authorization", basicAuth); + } + + if (loginInfoResource.getUserId() != null) { + connection.addRequestProperty("userId", loginInfoResource.getUserId()); + } + if (loginInfoResource.getPassword() != null) { + connection.addRequestProperty("password", loginInfoResource.getPassword()); + } + return connection; + } + + /** + * Create a HttpURLConnection to the repository given by the repositoryUrl, using the authentication credentials provided in the properties file, or the test credentials if + * none were provided. + *

+ * This method will not add the apiKey to the urlString. + * + * @param repositoryUrl the base repository URL for the repository to connect to + * @param urlString path to request within the repository + * @return the connection object + * @throws IOException if we are unable to open the connection + */ + private HttpURLConnection createConnectionFromUrl(final String repositoryUrl, final String urlString) throws IOException { + URL url; + try { + url = AccessController.doPrivileged(new PrivilegedExceptionAction() { + + @Override + public URL run() throws MalformedURLException { + return new URL(repositoryUrl + urlString); + } + }); + } catch (PrivilegedActionException e) { + throw (MalformedURLException) e.getCause(); + } + + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + if (softlayerUserId != null) { + String userpass = softlayerUserId + ":" + softlayerPassword; + String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes(Charset.forName("UTF-8"))); + connection.setRequestProperty("Authorization", basicAuth); + } + + connection.addRequestProperty("userId", userId); + connection.addRequestProperty("password", password); + + return connection; + } + + /** + * This method returns the url for a file that is being hosted on one of the test servers. + * If SSLSocketFactory is required this should be set up before calling this method. + * + * @param file - file on test server which a url is required for + * @return The url for the file + * @throws Exception + */ + public static String getTestServerFileUrl(String file) throws Exception { + String fileUrl = null; + // Find an available test server hosting the test file + for (String hostname : LoginInfoProvider.getTestServerHostnames()) { + try { + String testFileUrl = "https://" + hostname + "/" + file; + HttpsURLConnection conn = (HttpsURLConnection) new URL(testFileUrl).openConnection(); + conn.setConnectTimeout(10000); + if (conn.getResponseCode() == 200) { + fileUrl = testFileUrl; + break; + } + } catch (IOException e) { + // IO exception trying to contact this test server, try the next one + } + } + + if (fileUrl == null) { + throw new FileNotFoundException("Could not find an available test server serving the test file"); + } + return fileUrl; + } + + public static List getTestServerHostnames() throws Exception { + List hostnames = new ArrayList(); + + Properties props = new Properties(); + props.load(RestClient.class.getResourceAsStream("/testLogin.properties")); + + for (String key : props.stringPropertyNames()) { + if (key.endsWith(".url")) { + URI uri = URI.create(props.getProperty(key)); + hostnames.add(uri.getHost()); + } + } + + return hostnames; + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/Marketplace.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/Marketplace.java new file mode 100755 index 00000000000..699c2f69c64 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/Marketplace.java @@ -0,0 +1,43 @@ +package com.ibm.ws.repository.base; + +import com.ibm.ws.repository.transport.model.AbstractJSON; + +public class Marketplace extends AbstractJSON { + + private String name; + private String description; + private String client_id; + private String _id; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getClient_id() { + return client_id; + } + + public void setClient_id(String client_id) { + this.client_id = client_id; + } + + public String get_id() { + return _id; + } + + public void set_id(String id) { + this._id = id; + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/MarketplaceApiKey.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/MarketplaceApiKey.java new file mode 100755 index 00000000000..02e3ddb5849 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/MarketplaceApiKey.java @@ -0,0 +1,25 @@ +package com.ibm.ws.repository.base; + +import com.ibm.ws.repository.transport.model.AbstractJSON; + +public class MarketplaceApiKey extends AbstractJSON { + + private String marketplaceId; + private String key; + + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/NoRepoAvailableException.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/NoRepoAvailableException.java new file mode 100755 index 00000000000..384c3f1aa4d --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/NoRepoAvailableException.java @@ -0,0 +1,93 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import java.util.ArrayList; +import java.util.List; + +/** + * Used to indicate that we could not contact any servers. + */ +@SuppressWarnings("serial") +public class NoRepoAvailableException extends Exception { + + private class ServerProblem { + private String url; + private String apiKey; + private Exception exception; + } + + private List problems; + + public void add(String url, String apiKey, Exception cause) { + ServerProblem p = new ServerProblem(); + p.url = url; + p.apiKey = apiKey; + p.exception = cause; + + if (problems == null) { + problems = new ArrayList(); + } + problems.add(p); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Throwable#getCause() + */ + @Override + public Throwable getCause() { + if (problems != null) { + for (ServerProblem problem : problems) { + if (problem.exception != null) { + return problem.exception; + } + } + } + + return super.getCause(); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Throwable#getMessage() + */ + @Override + public String getMessage() { + StringBuilder b = new StringBuilder(); + b.append("Could not find an available server:\n"); + + if (problems == null) { + // No problems were added -> no servers were tried + b.append("There were no servers given to try\n"); + } else { + // Add the list of failed servers to the message + for (ServerProblem problem : problems) { + b.append(problem.url); + // Add the apiKey if one was provided + if (problem.apiKey != null) { + b.append(" - "); + b.append(problem.apiKey); + } + + if (problem.exception != null) { + b.append(": "); + b.append(problem.exception.toString()); + } + b.append("\n"); + } + } + return b.toString(); + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestBase.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestBase.java new file mode 100755 index 00000000000..1b70b9b65b0 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestBase.java @@ -0,0 +1,299 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ + +package com.ibm.ws.repository.base; + +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.junit.Before; + +import com.ibm.ws.repository.common.enums.ResourceType; +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.exceptions.RepositoryBackendException; +import com.ibm.ws.repository.exceptions.RepositoryException; +import com.ibm.ws.repository.exceptions.RepositoryResourceDeletionException; +import com.ibm.ws.repository.exceptions.RepositoryResourceException; +import com.ibm.ws.repository.resources.RepositoryResource; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; +import com.ibm.ws.repository.resources.internal.SampleResourceImpl; +import com.ibm.ws.repository.resources.writeable.RepositoryResourceWritable; +import com.ibm.ws.repository.strategies.writeable.UpdateInPlaceStrategy; +import com.ibm.ws.repository.transport.model.Asset; + +public abstract class RepositoryTestBase extends TestBaseClass { + + protected final static File _jarDir = new File("lib/LibertyFATTestFiles/JARs"); + protected final static File _licenseDir = new File("lib/LibertyFATTestFiles/licenses"); + protected final static File _archiveDir = new File("lib/LibertyFATTestFiles/archives"); + protected final static File _readmeDir = new File("lib/LibertyFATTestFiles/Readmes"); + + protected static final String PROVIDER_NAME = "Test Provider"; + + protected RestRepositoryConnection _restConnection; + + private static final Logger logger = Logger.getLogger(RepositoryTestBase.class.getName()); + + // Have to have this since base class throws exception + public RepositoryTestBase() { + super(); + } + + protected Collection _newTestAssetIds = new HashSet(); + + protected T _testObject; + + /** + * Create the object we are going to test, this object being one of the + * utility classes that extend AbstractResource + * + * @param userId + * Massive userid + * @param password + * Massive password + * @param apiKey + * Massive apikey + * @return + * @throws IOException + */ + protected abstract T createTestObject(RestRepositoryConnection loginInfo) throws IOException; + + /** + * Looks for features with symbolic names starting with com.ibm.ws.test and + * stores them in {@link #existingTestAssetIds}. It also creates the test + * object + * + * @throws IOException + */ + @Before + public void setup() throws IOException { + // TestCertTrust.trustAll(); + // TestCertTrust.disableSNIExtension(); + + _newTestAssetIds = new HashSet(); + _restConnection = (RestRepositoryConnection) _repoConnection; + _testObject = createTestObject(_restConnection); + } + + public void recordResource(RepositoryResourceWritable res) { + logger.log(Level.INFO, "Test resource added:"); + logger.log(Level.INFO, res.toString()); + if (!_newTestAssetIds.contains(res.getId())) { + _newTestAssetIds.add(res.getId()); + } + } + + public void removeResource(RepositoryResourceWritable res) { + _newTestAssetIds.remove(res.getId()); + } + + /** + * Delete all assets created with the tests provider name. We do a quickn blat before each test, do we need this anymore? + * + * @throws IOException + * @throws RepositoryResourceDeletionException + */ + public void deleteCreatedFeatures() + throws RepositoryResourceDeletionException, RepositoryException { + for (String id : _newTestAssetIds) { + RepositoryResourceImpl res = (RepositoryResourceImpl) _restConnection.getResource(id); + logger.log(Level.INFO, "Test cleanup deleting resource: " + + res.getId()); + res.delete(); + } + } + + public void uploadResource(RepositoryResourceImpl mr) + throws RepositoryResourceException, RepositoryBackendException { + mr.uploadToMassive(new UpdateInPlaceStrategy()); + recordResource(mr); + } + + public void updateResource(RepositoryResourceImpl mr) + throws RepositoryResourceException, RepositoryBackendException { + mr.uploadToMassive(new UpdateInPlaceStrategy()); + } + + public static void checkCopyFields(RepositoryResourceImpl left, RepositoryResourceImpl right) + throws IllegalArgumentException, IllegalAccessException, + InstantiationException, IOException, NoSuchMethodException, + SecurityException, InvocationTargetException { + + ArrayList methodsToIgnore = new ArrayList(); + methodsToIgnore.add("setState"); + methodsToIgnore.add("setType"); + methodsToIgnore.add("setLoginInfoEntry"); + for (Method m : left.getClass().getMethods()) { + if (m.getName().startsWith("set")) { + Class[] parameterss = m.getParameterTypes(); + + // Not a normal setter, ignore it + if (parameterss.length != 1) { + continue; + } + + if (methodsToIgnore.contains(m.getName())) { + continue; + } + + Class param = parameterss[0]; + + Object p = null; + if (param.isEnum()) { + p = param.getEnumConstants()[0]; + } else if (param.equals(Collection.class)) { + logger.log(Level.INFO, "got a collection"); + p = new ArrayList(); + } else if (param.isInterface()) { + continue; + } else if (param.isPrimitive()) { + p = new Integer(4); + } else if (param.equals(String.class)) { + p = new String("test string"); + } else if (param.equals(RepositoryConnection.class)) { + p = new RestRepositoryConnection("a", "b", "c", "d"); + } else { + p = param.newInstance(); + } + + m.invoke(left, p); + } + } + + Method m = null; + + try { + m = left.getClass().getDeclaredMethod("copyFieldsFrom", + RepositoryResourceImpl.class, boolean.class); + } catch (Exception e) { + m = left.getClass().getSuperclass().getDeclaredMethod("copyFieldsFrom", + RepositoryResourceImpl.class, boolean.class); + } + m.setAccessible(true); + m.invoke(right, left, true); + if (!left.equivalentWithoutAttachments(right)) { + logger.log(Level.INFO, "EQUIV FAILED: Left"); + left.dump(System.out); + logger.log(Level.INFO, "EQUIV FAILED: Right"); + right.dump(System.out); + fail("Check fields failed: the resources are not equivalent"); + } + + if (!right.equivalentWithoutAttachments(left)) { + logger.log(Level.INFO, "EQUIV FAILED: Left"); + left.dump(System.out); + logger.log(Level.INFO, "EQUIV FAILED: Right"); + right.dump(System.out); + fail("Check fields failed: the resources are not equivalent"); + } + } + + /** + * If we need to use the Type enum's createResource method then we can't use a TestResource object (as + * the enum doesn't know about them), so use a sample resource instead + * + * @throws URISyntaxException + */ + protected SampleResourceImpl createSampleResource() throws URISyntaxException { + SampleResourceImpl sampleRes = new SampleResourceImpl(_restConnection); + populateResource(sampleRes); + sampleRes.setType(ResourceType.PRODUCTSAMPLE); + return sampleRes; + } + + protected void populateResource(RepositoryResourceImpl res) throws URISyntaxException { + res.setName(name.getMethodName()); + + res.setProviderName(PROVIDER_NAME); + res.setProviderUrl("http://testhost/testfile"); + + res.setVersion("version 1"); + res.setDescription("This is a test resource"); + } + + /** + * Get Asset from MassiveResource reflectively as there is no external API for this + * + * @param mr + * @return an asset or an exception + * @throws ClassNotFoundException + * @throws SecurityException + * @throws NoSuchMethodException + * @throws InvocationTargetException + * @throws IllegalArgumentException + * @throws IllegalAccessException + */ + public static Asset getAssetReflective(RepositoryResource mr) throws ClassNotFoundException, NoSuchMethodException, + SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + + // Get MassiveResource + Class c = RepositoryResourceImpl.class; + + // Get MassiveResource.getAsset() + Method method = c.getDeclaredMethod("getAsset"); + + // Invoke MassiveResource.getAsset() + method.setAccessible(true); + Asset asset = (Asset) method.invoke(mr); + + return asset; + } + + /** + * Invoke a method reflectively that does not use primitive arguments + * + * @param targetObject + * @param methodName + * @param varargs + * @return + * @throws ClassNotFoundException + * @throws NoSuchMethodException + * @throws SecurityException + * @throws IllegalAccessException + * @throws InstantiationException + * @throws IllegalArgumentException + * @throws InvocationTargetException + */ + public static Object reflectiveCallNoPrimitives(Object targetObject, String methodName, Object... varargs) + throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, InstantiationException, + IllegalArgumentException, InvocationTargetException { + + // Usage example of this method + // int i = (Integer)reflectiveCallAnyTypes(targetObject,"methodName",1) + + // create a class array from the vararg object array + @SuppressWarnings("rawtypes") + Class[] classes; + if (varargs != null) { + classes = new Class[varargs.length]; + for (int i = 0; i < varargs.length; i++) { + classes[i] = varargs[i].getClass(); + } + } else { + classes = new Class[0]; + } + + return reflectiveCallAnyTypes(targetObject, methodName, classes, varargs); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtils.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtils.java new file mode 100755 index 00000000000..882fd76ab99 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtils.java @@ -0,0 +1,43 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import java.lang.reflect.InvocationTargetException; +import java.util.Collection; + +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; + +/** + * + */ +public interface RepositoryTestUtils { + public enum TestType { + MASSIVE_REPO, DIRECTORY_REPO, ZIP_REPO + }; + + public void setUpClass() throws Exception; + + public void tearDownClass() throws Exception; + + public T setUpTest(boolean wipeBeforeEachTest) throws Exception; + + public void tearDownTest(boolean wipeBeforeEachTest) throws Exception; + + public T createNewRepo() throws NoRepoAvailableException; + + public Collection getAllResourcesWithDupes() throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, InstantiationException, IllegalArgumentException, InvocationTargetException; + + public T getRepositoryConnection(); + + public void refreshTextIndex(String lastAssetId) throws Exception; +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtilsFactory.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtilsFactory.java new file mode 100755 index 00000000000..574a8a1f632 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RepositoryTestUtilsFactory.java @@ -0,0 +1,66 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import com.ibm.ws.repository.base.RepositoryTestUtils.TestType; +import com.ibm.ws.repository.connections.RepositoryConnection; + +/** + * + */ +public class RepositoryTestUtilsFactory { + + private static Object lock = new Object(); + private static RepositoryTestUtilsFactory instance; + + /** + * Get the singleton instance of the factory + * + * @return + */ + public static RepositoryTestUtilsFactory getInstance() { + synchronized (lock) { + if (null == instance) { + instance = new RepositoryTestUtilsFactory(); + } + } + return instance; + } + + /** + * Private constructor, obtain an instance by the static {@link RepositoryClientFactory#getInstance} method + */ + private RepositoryTestUtilsFactory() {} + + /** + * @param login + * @return + */ + @SuppressWarnings("unchecked") + public > T createTestUtils(TestType type) { + T utils = null; + switch (type) { + case MASSIVE_REPO: + utils = (T) new RestRepositoryTestUtils(); + break; + case DIRECTORY_REPO: + utils = (T) new DirectoryRepositoryTestUtils(); + break; + case ZIP_REPO: + utils = (T) new ZipRepositoryTestUtils(); + break; + default: + throw new UnsupportedOperationException("A repository connection of " + type + " is not currently supported"); + } + return utils; + } +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestRepositoryTestUtils.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestRepositoryTestUtils.java new file mode 100755 index 00000000000..ff0a4ee1668 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestRepositoryTestUtils.java @@ -0,0 +1,372 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import java.io.ByteArrayOutputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ibm.json.java.JSONArray; +import com.ibm.json.java.JSONObject; +import com.ibm.ws.repository.connections.RepositoryConnectionList; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.resources.RepositoryResource; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; +import com.ibm.ws.repository.transport.client.RestClient; + +/** + * + */ +public class RestRepositoryTestUtils implements RepositoryTestUtils { + + protected static LoginInfoProvider _loginInfoProvider; + + protected final static String LIVE_KEY = "75621234192"; + + protected RestRepositoryConnection _loginInfoEntry; + + private static final Logger logger = Logger.getLogger(RestRepositoryTestUtils.class.getName()); + + protected RestRepositoryConnection getLoginInfoEntry() throws IOException, NoRepoAvailableException { + if (_loginInfoProvider == null) { + // Set up LoginInfoProvider only once to reuse the test repo wherever possible + Properties props = new Properties(); + props.load(this.getClass().getResourceAsStream("/testLogin.properties")); + _loginInfoProvider = new LoginInfoProvider(props); + } + return _loginInfoProvider.getLoginInfo(); + } + + /** + * {@inheritDoc} + * + * @throws IOException + * @throws FileNotFoundException + * @throws NoRepoAvailableException + */ + @Override + public void setUpClass() throws FileNotFoundException, IOException, NoRepoAvailableException { + logger.log(Level.INFO, "MassiveRepositoryTestUtils.setUpClass entry"); + _loginInfoEntry = getLoginInfoEntry(); + blowUpIfUsingLiveSystem(_loginInfoEntry); + logger.log(Level.INFO, "MassiveRepositoryTestUtils.setUpClass exit"); + } + + /** {@inheritDoc} */ + @Override + public void tearDownClass() {} + + /** {@inheritDoc} */ + @Override + public RestRepositoryConnection setUpTest(boolean wipeBeforeEachTest) throws Exception { + logger.log(Level.INFO, "setUpTest entry"); + // Must refresh loginInfoEntry before every test in case we need to failover to another test server + _loginInfoEntry = getLoginInfoEntry(); + if (wipeBeforeEachTest) { + logger.log(Level.INFO, "Deleting before test"); + DeleteRepo.deleteRepo(_loginInfoEntry); + } + logger.log(Level.INFO, "setUpTest exit"); + return _loginInfoEntry; + } + + /** {@inheritDoc} */ + @Override + public void tearDownTest(boolean wipeBeforeEachTest) throws Exception { + if (wipeBeforeEachTest) { + logger.log(Level.INFO, "Deleting after test"); + DeleteRepo.deleteRepo(_loginInfoEntry); + } + } + + /** + * {@inheritDoc} + * + * @throws NoRepoAvailableException + */ + @Override + public RestRepositoryConnection createNewRepo() throws NoRepoAvailableException { + return _loginInfoProvider.createNewRepoFromProperties(); + } + + @Override + @SuppressWarnings("unchecked") + public Collection getAllResourcesWithDupes() throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, InstantiationException, IllegalArgumentException, InvocationTargetException { + return (Collection) TestBaseClass.reflectiveCallAnyTypes(_loginInfoEntry, "getAllResourcesWithDupes", + null, null); + } + + @Override + public RestRepositoryConnection getRepositoryConnection() { + return _loginInfoEntry; + } + + /** {@inheritDoc} */ + @Override + public void refreshTextIndex(String lastAssetId) throws Exception { + refreshElasticSearchIndex(_loginInfoEntry, lastAssetId); + } + + /** + *

Refreshes the elastic search index by calling POST on:

+ * http://{host}:9200/assets/_refresh + *

Where {host} is the host of the _loginInfoEntry being used. See the elasticsearch doc here for why this works:

+ *

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current + * /indices-refresh.html

+ * + * @param loginInfoEntry The repo to refresh + * @param assetId The last asset added, refresh will repeat until this asset appears + * + * @throws MalformedURLException + * @throws IOException + * @throws ProtocolException + * @throws InterruptedException + */ + public static void refreshElasticSearchIndex(RestRepositoryConnection loginInfoEntry, String assetId) throws MalformedURLException, IOException, ProtocolException { + + boolean refreshed = false; + int retryCount = 0; + while (!refreshed && retryCount < 5) { + try { + retryCount++; + // Trigger indexing on elastic search... + URL urlToRepo = new URL(loginInfoEntry.getRepositoryUrl()); + URL refreshUrl = new URL("http", urlToRepo.getHost(), 9200, "/assets/_refresh"); + HttpURLConnection urlCon = (HttpURLConnection) refreshUrl.openConnection(); + urlCon.setRequestMethod("POST"); + urlCon.getResponseCode(); + + URL checkIfRefreshed = new URL("http", urlToRepo.getHost(), 9200, "/assets/asset/" + assetId); + logger.log(Level.INFO, "Checking refresh on " + checkIfRefreshed); + HttpURLConnection checkUrlCon = (HttpURLConnection) checkIfRefreshed.openConnection(); + checkUrlCon.setDoInput(true); + checkUrlCon.setRequestMethod("GET"); + int respCode = checkUrlCon.getResponseCode(); + + if (respCode == 200) { + InputStream inputStream = checkUrlCon.getInputStream(); + String inputStreamString = null; + if (inputStream != null) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + int read = -1; + while ((read = inputStream.read()) != -1) { + outputStream.write(read); + } + inputStreamString = outputStream.toString(RestClient.getCharset(checkUrlCon.getContentType())); + + if (inputStreamString.contains("\"found\":true")) { + refreshed = true; + logger.log(Level.INFO, "Requested item found in index"); + } else { + logger.log(Level.INFO, "Got " + inputStreamString); + // Give up after 5 fails + if (retryCount >= 5) { + logger.log(Level.INFO, "Giving up waiting for indexing to complete."); + refreshed = true; + } else { + logger.log(Level.INFO, "Requested item NOT found in index - retrying index refresh."); + } + try { + // TODO this should be enough ... if it DOES happen again we might add an inner loop + // to retry the checkIfRefreshed URL + Thread.sleep(1000); + } catch (InterruptedException ie) { + // Just swallow this + } + } + } + } else { + logger.log(Level.INFO, "Response code was not 200, it was " + respCode); + } + + // Now validate that the index that elastic search has created is usable by Massive + if (refreshed) { + refreshed = verifyElasticSearchIndexThroughMassive(loginInfoEntry, assetId); + } + + } catch (IOException ex) { + // I think an exception can be thrown if the refresh hasn't finished, wait 1 second and retry. Give up after 5 times + // Give up after 5 fails and let exception propogate up + if (retryCount >= 5) { + throw ex; + } + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + // Just swallow this + } + + } finally { + if (retryCount >= 5 && !refreshed) { + throw new IOException("Failed to refresh elastic "); + } + } + + } + } + + /** + * This is called once elastic search has recreated an index to confirm that the a provided asset can be found + * through a massive find. + * + * @param loginInfoEntry + * @param assetId + * @return true if the specified asset can be read through Massive + */ + public static boolean verifyElasticSearchIndexThroughMassive(RestRepositoryConnection connection, String assetId) { + boolean refreshed = true; + try { + // check that we can get the target asset through a massive find + RepositoryResource mr = connection.getResource(assetId); + String name = mr.getName(); + Collection results = new RepositoryConnectionList(stripLoginAuthentication(connection)).findResources(name, null, null, null); + + boolean found = false; + // Loop through the results from the find to ensure the asset we are keying on is in the returned list + for (RepositoryResource result : results) { + if (result.getId().equals(assetId)) { + found = true; + break; + } + } + if (found) { + logger.log(Level.INFO, "Massive find found the key asset after elastic search refreshed...continuing"); + } else { + logger.log(Level.INFO, "Massive find could not find the key asset that elastic search said was indexed ... forcing an elastic search re-index"); + refreshed = false; // invalidate the index + } + } catch (Exception e) { + logger.log(Level.INFO, "Exception thrown retrieving a resource through massive find: " + e); + refreshed = false; + e.printStackTrace(); + } + + return refreshed; + } + + /** + * Run a query to get the weighting of search results back from elastic search based on a pre-prepared query + * + * @throws IOException + */ + public static void queryElasticSearchWeighting(String encodedSearchString, RestRepositoryConnection loginInfoEntry, String marketplaceId) throws IOException { + + // make the following rest call + // http://:9200/assets/_search?q=+description:(keyword1 keyword3) +marketplaceId:(); + URL urlToRepo = new URL(loginInfoEntry.getRepositoryUrl()); + URL queryUrl = new URL("http", urlToRepo.getHost(), 9200, "/assets/_search?q=%28" + encodedSearchString + "%29%20+marketplaceId:%28" + marketplaceId + "%29"); + logger.log(Level.INFO, "about to poke: " + queryUrl.toString()); + + HttpURLConnection urlCon = (HttpURLConnection) queryUrl.openConnection(); + urlCon.setRequestMethod("GET"); + int respCode = urlCon.getResponseCode(); + logger.log(Level.INFO, "RC=" + respCode); + + String inputStreamString = null; + if (respCode == 200) { + logger.log(Level.INFO, String.format("%nFormatted asset weighting from elastic search")); + InputStream inputStream = urlCon.getInputStream(); + if (inputStream != null) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + int read = -1; + while ((read = inputStream.read()) != -1) { + outputStream.write(read); + } + inputStreamString = outputStream.toString(RestClient.getCharset(urlCon.getContentType())); + logger.log(Level.INFO, "queryElasticSearchWeighting returned: " + inputStreamString); + } + + summarizeElasticSearchWeighting(inputStreamString); + logger.log(Level.INFO, ""); + } else { + logger.log(Level.INFO, "queryElasticSearchWeighting returned: rc" + respCode); + } + } + + /** + * Parse the JSON doc produced by the query and summarise the results to the log and to a List that is returned. + * + * @param jsonString + * @return a list of the results produced + * @throws IOException + */ + private static List summarizeElasticSearchWeighting(String jsonString) throws IOException { + /* + * This parses the output from a JSON query. The structure of that doc is + * { + * ..hits: { < JSONObject + * ....hits: [ < JSONArray + * ......{ JSONObject #1 }, < JSONObject + * ......{ JSONObject #2 } < JSONObject + * ....] + * ..} + * } + */ + List output = new ArrayList(); + + JSONObject doc = JSONObject.parse(jsonString); + JSONObject hits = (JSONObject) doc.get("hits"); + JSONArray hitsArray = (JSONArray) hits.get("hits"); + @SuppressWarnings("unchecked") + Iterator it = hitsArray.iterator(); + while (it.hasNext()) { + JSONObject jObject = it.next(); + Double score = (Double) jObject.get("_score"); + + JSONObject jSource = (JSONObject) jObject.get("_source"); + String description = (String) jSource.get("description"); + String name = (String) jSource.get("name"); + + String line = "score=" + score + ",name=" + name + ", description=" + description; + logger.log(Level.INFO, line); + output.add(line); + } + + // output list not used at the time of writing but it is there if needed. + return output; + } + + /** + * The find tests have to run with authentication stripped off due to a bug in massive. + * This is a convenience method to remove the username/password for the LoginInfoEntry + */ + public static RestRepositoryConnection stripLoginAuthentication(RestRepositoryConnection authenticated) { + + RestRepositoryConnection unauthenticatedLogin = new RestRepositoryConnection(null, null, authenticated.getApiKey(), authenticated.getRepositoryUrl(), + authenticated.getSoftlayerUserId(), authenticated.getSoftlayerPassword(), + authenticated.getAttachmentBasicAuthUserId(), authenticated.getAttachmentBasicAuthPassword()); + + return unauthenticatedLogin; + } + + public static void blowUpIfUsingLiveSystem(RestRepositoryConnection loginInfoEntry) { + if (loginInfoEntry.getApiKey().equals(LIVE_KEY)) { + throw new RuntimeException( + "YOU ARE RUNNING AGAINGST THE LIVE SYSTEM, ABORTING. If you want to run againgst the live system please override TestBaseClass.blowUpIfUsingLiveSystem in your test"); + } + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestoreTrustStoreRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestoreTrustStoreRule.java new file mode 100644 index 00000000000..c217b7021cb --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/RestoreTrustStoreRule.java @@ -0,0 +1,48 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* Copyright IBM Corp. 2017 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.repository.base; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; + +import org.junit.rules.ExternalResource; + +/** + * Rule to restore the original SSLContext and the HttpsURLConnection defaultSSLSocketFactory and defaultHostnameVerifier at the end of the test. + *

+ * This allows any tests to change these values without interfering with other tests. + */ +public class RestoreTrustStoreRule extends ExternalResource { + + private SSLContext originalSslContext = null; + private SSLSocketFactory originalSocketFactory = null; + private HostnameVerifier originalHostnameVerifier = null; + + /** {@inheritDoc} */ + @Override + protected void before() throws Throwable { + originalSslContext = SSLContext.getDefault(); + originalSocketFactory = HttpsURLConnection.getDefaultSSLSocketFactory(); + originalHostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier(); + } + + /** {@inheritDoc} */ + @Override + protected void after() { + SSLContext.setDefault(originalSslContext); + HttpsURLConnection.setDefaultSSLSocketFactory(originalSocketFactory); + HttpsURLConnection.setDefaultHostnameVerifier(originalHostnameVerifier); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TempFileRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TempFileRule.java new file mode 100644 index 00000000000..07d45aa8f6c --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TempFileRule.java @@ -0,0 +1,53 @@ +/* +* IBM Confidential +* +* OCO Source Materials +* +* Copyright IBM Corp. 2017 +* +* The source code for this program is not published or otherwise divested +* of its trade secrets, irrespective of what has been deposited with the +* U.S. Copyright Office. +*/ +package com.ibm.ws.repository.base; + +import java.io.File; + +import org.junit.rules.ExternalResource; + +/** + * Rule to allocate a temporary file and delete it at the end of the test + */ +public class TempFileRule extends ExternalResource { + + private final String prefix; + private final String suffix; + private File file; + + public TempFileRule(String prefix, String suffix) { + this.prefix = prefix; + this.suffix = suffix; + } + + /** + * @return the file + */ + public File getFile() { + return file; + } + + /** {@inheritDoc} */ + @Override + protected void before() throws Throwable { + file = File.createTempFile(prefix, suffix); + } + + /** {@inheritDoc} */ + @Override + protected void after() { + if (file.exists()) { + file.delete(); + } + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TestBaseClass.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TestBaseClass.java new file mode 100755 index 00000000000..1112bc93522 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/TestBaseClass.java @@ -0,0 +1,213 @@ +package com.ibm.ws.repository.base; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.rules.TestName; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.repository.base.RepositoryTestUtils.TestType; +import com.ibm.ws.repository.connections.RepositoryConnection; + +public abstract class TestBaseClass { + + protected static RepositoryTestUtils _utils; + protected RepositoryConnection _repoConnection; + + private static TestType testType; + + private static boolean wipeBeforeEachTest; + + private static final Logger logger = Logger.getLogger(TestBaseClass.class.getName()); + + @Rule + public TestName name = new TestName(); + + /** + * The test type for this test class. Subclasses can override this by defining a public static method with the same signature. + *

+ * The method named "getTestType" on the actual test class will be called reflectively to determine the test type. + */ + public static TestType getTestType() { + return TestType.MASSIVE_REPO; + } + + /** + * Whether the repository should be cleared before each test. Subclasses can override this by defining a public static method with the same signature. + *

+ * The method named "getWipeBeforeEachTest" on the actual test class will be called reflectively to determine whether to wipe the repository between tests. + */ + public static boolean getWipeBeforeEachTest() { + return true; + } + + @ClassRule + public static TestRule readSubclassParameters = new TestRule() { + + @Override + public Statement apply(Statement statement, Description description) { + try { + // Get the test class + Class testClass = description.getTestClass(); + + // Reflectively call the getTestType and getWipeBeforeEachTest methods on the actual test class + testType = (TestType) testClass.getMethod("getTestType").invoke(null); + wipeBeforeEachTest = (Boolean) testClass.getMethod("getWipeBeforeEachTest").invoke(null); + + } catch (Exception e) { + throw new RuntimeException(e); + } + return statement; + } + }; + + @BeforeClass + public static void setupUtils() throws Exception { + logger.log(Level.INFO, "Setup Utils"); + _utils = RepositoryTestUtilsFactory.getInstance().createTestUtils(testType); + _utils.setUpClass(); + } + + /** + * Some repository tests can have intermittent failures. + * This rule will retry any failing tests twice. + * + * @throws Exception + */ + + @Rule + public TestRule retry = new RetryRule(2); + + @Before + public void doSetup() throws Exception { + logger.log(Level.INFO, "TestBaseClass.Base setup"); + printTestStart(); + _repoConnection = _utils.setUpTest(wipeBeforeEachTest); + } + + public void printTestStart() { + logger.log(Level.INFO, "---"); + logger.log(Level.INFO, "--- Start of " + name.getMethodName()); + } + + @After + public void printTestEnd() throws Exception { + _utils.tearDownTest(wipeBeforeEachTest); + logger.log(Level.INFO, "--- End of " + name.getMethodName()); + } + + class RetryRule implements TestRule { + + private final int retryLimit; + + /** + * @param retryLimit the number of times to retry the test if it fails + */ + private RetryRule(int retryLimit) { + this.retryLimit = retryLimit; + } + + @Override + public Statement apply(Statement base, Description desc) { + final Statement baseStatement = base; + + return new Statement() { + @Override + public void evaluate() throws Throwable { + + int runTimes = 0; + while (true) { + runTimes++; + try { + baseStatement.evaluate(); + break; // Break out of retry loop when we succeed + } catch (Throwable t) { + + // If we've reached the retry limit, give up and rethrow the exception + if (runTimes > retryLimit) { + logger.log(Level.INFO, "Too many failures, giving up"); + throw t; + } else { + logger.log(Level.INFO, "Logged failure, retrying: " + t.getMessage()); + } + } + } + } + + }; + } + + } + + /** + * Invoke a method reflectively if that does not use primitive arguments + * + * @param targetObject + * @param methodName + * @param classes + * @param values + * @return + * @throws NoSuchMethodException + * @throws SecurityException + * @throws IllegalAccessException + * @throws IllegalArgumentException + * @throws InvocationTargetException + */ + public static Object reflectiveCallAnyTypes(Object targetObject, String methodName, @SuppressWarnings("rawtypes") Class[] classes, Object[] values) + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + + // Usage example of this method + // int i = (Integer)reflectiveCallAnyTypes(targetObject,"methodName", + // new Class[] {int.class}, + // new Object[] {9}); + + // Get the class of the targetObject + Class c = null; + if (targetObject instanceof Class) { + c = (Class) targetObject; + } else { + c = targetObject.getClass(); + } + + Method method = null; + boolean finished = false; + while (!finished) { + + try { + // get method + method = c.getDeclaredMethod(methodName, classes); + finished = true; + method.setAccessible(true); + } catch (NoSuchMethodException nsme) { + if (c.getName().equals("java.lang.Object")) { + throw nsme; + } else { + c = c.getSuperclass(); + } + } + } + + // Invoke MassiveResource.getAsset() + return method.invoke(targetObject, values); + } + + public static File getFile(String antBuildLocation, String junitLocation) { + File isRunningLocally = new File("../localoverride"); + if (isRunningLocally.exists()) { + return new File(antBuildLocation); + } else { + return new File(junitLocation); + } + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/ZipRepositoryTestUtils.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/ZipRepositoryTestUtils.java new file mode 100755 index 00000000000..74abfd74f01 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/ZipRepositoryTestUtils.java @@ -0,0 +1,91 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.Collection; + +import com.ibm.ws.repository.connections.ZipRepositoryConnection; +import com.ibm.ws.repository.resources.internal.RepositoryResourceImpl; + +/** + * + */ +public class ZipRepositoryTestUtils implements RepositoryTestUtils { + + private File _zip; + + /** {@inheritDoc} */ + @Override + public void setUpClass() {} + + /** {@inheritDoc} */ + @Override + public void tearDownClass() {} + + private void delete(File f) { + if (f.exists()) { + if (!f.delete()) { + System.out.println("*** FAILED TO DELETE " + f.getAbsolutePath()); + } + } + System.out.println("Deleting " + f.getAbsolutePath()); + } + + /** + * {@inheritDoc} + * + * @return + */ + @Override + public ZipRepositoryConnection setUpTest(boolean wipeBeforeEachTest) throws Exception { + // A new sub directory is created for each test at the moment, so tests don't reuse the same directory + _zip = File.createTempFile("repoTest", ".zip"); + System.out.println("testing using " + _zip.getAbsolutePath()); + return new ZipRepositoryConnection(_zip); + } + + /** {@inheritDoc} */ + @Override + public void tearDownTest(boolean wipeBeforeEachTest) throws Exception { + delete(_zip); + } + + /** {@inheritDoc} */ + @Override + public ZipRepositoryConnection createNewRepo() throws NoRepoAvailableException { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public Collection getAllResourcesWithDupes() throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, InstantiationException, IllegalArgumentException, InvocationTargetException { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public ZipRepositoryConnection getRepositoryConnection() { + // Not used by the client tests + return null; + } + + /** {@inheritDoc} */ + @Override + public void refreshTextIndex(String lastAssetId) throws Exception { + // Nothing to do for zip repos + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/DirectoryConnectionRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/DirectoryConnectionRule.java new file mode 100755 index 00000000000..cbae1121dfc --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/DirectoryConnectionRule.java @@ -0,0 +1,108 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base.servers; + +import java.io.File; +import java.io.IOException; + +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.repository.connections.DirectoryRepositoryConnection; +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.test.utils.clients.DirectoryWriteableClient; +import com.ibm.ws.repository.transport.client.RepositoryReadableClient; + +public class DirectoryConnectionRule implements RestRepositoryConnectionRule { + + DirectoryWriteableConnection connection; + + public DirectoryConnectionRule() {} + + @Override + public RestRepositoryConnection getRestConnection() { + return null; + } + + @Override + public RepositoryConnection getConnection() { + return connection; + } + + /** + * Empties the repository before and after the test. + */ + @Override + public Statement apply(final Statement statement, Description arg1) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + File tmpRepoRoot = File.createTempFile("tempRepoDir", null); + tmpRepoRoot.delete(); + File tmpRepoDir = new File(tmpRepoRoot.getPath()); + if (!tmpRepoDir.mkdir()) { + throw new IOException("Couldn't create directory for temp repo directory: " + tmpRepoDir); + } + tmpRepoDir.deleteOnExit(); + connection = new DirectoryWriteableConnection(tmpRepoDir); + try { + statement.evaluate(); + } finally { + recursiveDelete(tmpRepoDir); + } + } + }; + } + + /** + * Directory repos don't support updating of assets + */ + @Override + public boolean updatesAreSupported() { + return false; + } + + /** + * No-op for directory, the search index doesn't need updating. + */ + @Override + public void refreshSearchIndex(String assetId) {} + + private void recursiveDelete(File file) { + if (!file.exists()) { + return; + } + + if (file.isDirectory()) { + for (File child : file.listFiles()) { + recursiveDelete(child); + } + } + + file.delete(); + } + + private static class DirectoryWriteableConnection extends DirectoryRepositoryConnection { + + public DirectoryWriteableConnection(File root) { + super(root); + } + + @Override + public RepositoryReadableClient createClient() { + return new DirectoryWriteableClient(getRoot()); + } + + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsConnectionRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsConnectionRule.java new file mode 100755 index 00000000000..5dcf8eb0bee --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsConnectionRule.java @@ -0,0 +1,91 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base.servers; + +import java.util.Collection; + +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.exceptions.RepositoryBackendException; +import com.ibm.ws.repository.exceptions.RepositoryResourceDeletionException; +import com.ibm.ws.repository.resources.RepositoryResource; +import com.ibm.ws.repository.resources.writeable.RepositoryResourceWritable; + +public class LarsConnectionRule implements RestRepositoryConnectionRule { + + private final RestRepositoryConnection repo; + + public LarsConnectionRule(LarsServerRule larsFixture) { + this.repo = larsFixture.getRestConnection(); + } + + @Override + public RestRepositoryConnection getRestConnection() { + return repo; + } + + @Override + public RepositoryConnection getConnection() { + return repo; + } + + /** + * Empties the repository before and after the test. + */ + @Override + public Statement apply(final Statement statement, Description arg1) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + deleteAllAssets(); + try { + statement.evaluate(); + } finally { + deleteAllAssets(); + } + } + }; + } + + /** + * If the repo can't be cleaned up, fail the test, as following tests + * will fail if there are extra assets there. + * + * @throws RepositoryBackendException + * @throws RepositoryResourceDeletionException + */ + private void deleteAllAssets() throws RepositoryBackendException, RepositoryResourceDeletionException { + Collection resources = repo.getAllResourcesWithDupes(); + for (RepositoryResource res : resources) { + RepositoryResourceWritable writable = (RepositoryResourceWritable) res; + writable.delete(); + } + } + + /** + * Lars doesn't support updating of assets + */ + @Override + public boolean updatesAreSupported() { + return false; + } + + /** + * No-op for lars, the search index doesn't need updating. + */ + @Override + public void refreshSearchIndex(String assetId) {} + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsServerRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsServerRule.java new file mode 100755 index 00000000000..02e789b0657 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/LarsServerRule.java @@ -0,0 +1,261 @@ +package com.ibm.ws.repository.base.servers; + +import java.net.InetAddress; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Properties; +import java.util.TimeZone; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.config.ApplicationBnd; +import com.ibm.websphere.simplicity.config.BasicRegistry; +import com.ibm.websphere.simplicity.config.BasicRegistry.Group; +import com.ibm.websphere.simplicity.config.BasicRegistry.Group.Member; +import com.ibm.websphere.simplicity.config.BasicRegistry.User; +import com.ibm.websphere.simplicity.config.MongoDBElement; +import com.ibm.websphere.simplicity.config.MongoElement; +import com.ibm.websphere.simplicity.config.SecurityRole; +import com.ibm.websphere.simplicity.config.ServerConfiguration; +import com.ibm.websphere.simplicity.config.SpecialSubject; +import com.ibm.websphere.simplicity.config.SpecialSubject.Type; +import com.ibm.websphere.simplicity.config.WebApplication; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.mongodb.BasicDBList; +import com.mongodb.BasicDBObject; +import com.mongodb.DB; +import com.mongodb.MongoClient; +import com.mongodb.ServerAddress; +import componenttest.topology.impl.LibertyFileManager; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Starts and stops a LARS server around a test. + *

+ * Handles installing the server, updating the configuration for the test environment, + * creating a new database for the test and dropping the database once the test is completed. + *

+ * Generally, this should be used as a ClassRule on the FATSuite class to ensure that the + * LARS server set up once, runs for the whole FAT bucket and is only cleaned up at the end. + *

+ * LARS requires a mongo database. The mongo database details must be provided in + * mongodb.properties + * + */ +public class LarsServerRule implements TestRule { + + private static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd-HHmmss"); + static { + DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC")); + } + + private LibertyServer larsServer; + + private MongoClient mongoClient; + private String dbName; + + private final List serverAddresses = new ArrayList(); + private String username; + private String password; + + private RestRepositoryConnection connection; + + @Override + public Statement apply(final Statement statement, Description description) { + return new Statement() { + + @Override + public void evaluate() throws Throwable { + // dbname must be less than 64chars and contains no '.' (from the mongodb spec) + String hostname = InetAddress.getLocalHost().getHostName(); + int dotIndex = hostname.indexOf('.'); + if (dotIndex > 0) { + hostname = hostname.substring(0, dotIndex); + } + dbName = "lars-" + DATE_FORMAT.format(new Date()) + "-" + hostname; + readProperties(); + + try { + // Set up LARS server + setUpDatabase(); + startLarsServer(); + // Run the tests + statement.evaluate(); + } finally { + // Do cleanup + if (larsServer != null) { + larsServer.stopServer(); + } + dropDatabase(); + } + } + }; + } + + private void readProperties() throws Exception { + + Properties mongoProperties = new Properties(); + + mongoProperties.load(this.getClass().getResourceAsStream("/mongodb.properties")); + + String hostsString = mongoProperties.getProperty("hosts"); + String portsString = mongoProperties.getProperty("ports"); + + if (hostsString != null && portsString != null) { + String[] hostStrings = hostsString.split(","); + String[] portStrings = portsString.split(","); + + if (hostStrings.length != portStrings.length) { + throw new Exception("Supplied hosts and ports for mongodb are different lengths"); + } + + for (int i = 0; i < hostStrings.length; i++) { + Integer port = new Integer(portStrings[i]); + serverAddresses.add(new ServerAddress(hostStrings[i], port)); + } + } + + String username = mongoProperties.getProperty("username"); + if (username != null && !username.isEmpty()) { + this.username = username; + } + + String password = mongoProperties.getProperty("password"); + if (password != null && !password.isEmpty()) { + this.password = password; + } + + } + + private void startLarsServer() throws Exception { + + larsServer = LibertyServerFactory.getLibertyServer("larsServer"); + + // Move the test server xml into sample.xml + RemoteFile sampleServerFile = LibertyFileManager.createRemoteFile(larsServer.getMachine(), larsServer.getServerRoot() + "/sample.xml"); + LibertyFileManager.moveLibertyFile(larsServer.getServerConfigurationFile(), sampleServerFile); + + // And upload the FAT server XML that will include sample.xml + LibertyFileManager.copyFileIntoLiberty(larsServer.getMachine(), larsServer.getServerRoot(), "server.xml", "productSampleServer.xml"); + + // Upload the FAT bootstrap.properties + LibertyFileManager.copyFileIntoLiberty(larsServer.getMachine(), larsServer.getServerRoot(), "bootstrap.properties", "productSample_noBootstrap.properties"); + + ServerConfiguration config = larsServer.getServerConfiguration(sampleServerFile); + + // Override the database configuration + MongoElement mongo = config.getMongos().get(0); + + List hostNames = mongo.getHostNamesElements(); + List ports = mongo.getPortsElements(); + + hostNames.clear(); + ports.clear(); + for (ServerAddress server : serverAddresses) { + hostNames.add(server.getHost()); + ports.add(server.getPort()); + } + + mongo.setUser(username); + mongo.setPassword(password); + + MongoDBElement mongodb = config.getMongoDBs().get(0); + mongodb.setDatabaseName(dbName); + + // Set up the user registry with admin user and group + config.getBasicRegistries().clear(); + BasicRegistry reg = new BasicRegistry(); + reg.setId("defaultRegistry"); + reg.setRealm("default"); + config.getBasicRegistries().add(reg); + + User adminUser = new User(); + adminUser.setName("admin"); + adminUser.setPassword("testPassword"); + reg.getUsers().add(adminUser); + + Group adminGroup = new Group(); + adminGroup.setName("Administrators"); + reg.getGroups().add(adminGroup); + + Member adminMember = new Member(); + adminMember.setName("admin"); + adminGroup.getMembers().add(adminMember); + + // Configure the application with the admin and user security roles + WebApplication app = config.getWebApplications().getById("com.ibm.ws.lars.rest"); + ApplicationBnd appBnd = app.getApplicationBnd(); + appBnd.getSecurityRoles().clear(); + + SecurityRole userRole = new SecurityRole(); + userRole.setName("User"); + appBnd.getSecurityRoles().add(userRole); + + SpecialSubject everyone = new SpecialSubject(); + everyone.set(Type.EVERYONE); + userRole.getSpecialSubjects().add(everyone); + + SecurityRole adminRole = new SecurityRole(); + adminRole.setName("Administrator"); + appBnd.getSecurityRoles().add(adminRole); + + SecurityRole.Group adminRoleGroup = new SecurityRole.Group(); + adminRoleGroup.setName("Administrators"); + adminRole.getGroups().add(adminRoleGroup); + + // remove the httpendpoint stanza, it's provided in fatTestPorts.xml + config.getHttpEndpoints().clear(); + + // Enable some logging + config.getLogging().setTraceSpecification("com.ibm.ws.lars.*=all"); + + larsServer.updateServerConfiguration(config, sampleServerFile); + + larsServer.startServer(); + } + + private void setUpDatabase() { + mongoClient = new MongoClient(serverAddresses); + + DB adminDb = mongoClient.getDB("admin"); + adminDb.authenticateCommand(username, password.toCharArray()).throwOnError(); + + DB db = mongoClient.getDB(dbName); + + // Create a user with the same username and password on the new database + // Needed because Liberty always authenticates against the DB it uses + BasicDBList roles = new BasicDBList(); + roles.add("readWrite"); + BasicDBObject createUser = new BasicDBObject("createUser", username) + .append("pwd", password) + .append("roles", roles); + db.command(createUser).throwOnError(); + } + + private void dropDatabase() { + if (mongoClient != null) { + if (mongoClient.getDatabaseNames().contains(dbName)) { + mongoClient.dropDatabase(dbName); + } + } + } + + public RestRepositoryConnection getRestConnection() { + if (connection == null) { + StringBuilder sb = new StringBuilder(); + sb.append("http://"); + sb.append(larsServer.getHostname()); + sb.append(":").append(larsServer.getHttpDefaultPort()); + sb.append("/ma/v1"); + connection = new RestRepositoryConnection("admin", "testPassword", "1", sb.toString()); + } + return connection; + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveConnectionRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveConnectionRule.java new file mode 100755 index 00000000000..75b5aa3ba93 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveConnectionRule.java @@ -0,0 +1,70 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base.servers; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.ProtocolException; + +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.repository.base.DeleteRepo; +import com.ibm.ws.repository.base.RestRepositoryTestUtils; +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RestRepositoryConnection; + +public class MassiveConnectionRule implements RestRepositoryConnectionRule { + + private final MassiveServerRule massiveFixture; + + public MassiveConnectionRule(MassiveServerRule massiveFixture) { + this.massiveFixture = massiveFixture; + } + + @Override + public RestRepositoryConnection getRestConnection() { + return massiveFixture.getRepositoryConnection(); + } + + @Override + public RepositoryConnection getConnection() { + return massiveFixture.getRepositoryConnection(); + } + + @Override + public Statement apply(final Statement statement, Description arg1) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + DeleteRepo.deleteRepo(massiveFixture.getRepositoryConnection()); + try { + statement.evaluate(); + } finally { + DeleteRepo.deleteRepo(massiveFixture.getRepositoryConnection()); + } + } + }; + } + + @Override + public boolean updatesAreSupported() { + return true; + } + + @Override + public void refreshSearchIndex(String assetId) throws MalformedURLException, ProtocolException, IOException { + RestRepositoryTestUtils.refreshElasticSearchIndex(massiveFixture.getRepositoryConnection(), assetId); + + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveServerRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveServerRule.java new file mode 100755 index 00000000000..ac2259d8ea7 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/MassiveServerRule.java @@ -0,0 +1,57 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base.servers; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.ibm.ws.repository.base.DeleteRepo; +import com.ibm.ws.repository.base.RepositoryTestUtils; +import com.ibm.ws.repository.base.RepositoryTestUtils.TestType; +import com.ibm.ws.repository.base.RepositoryTestUtilsFactory; +import com.ibm.ws.repository.connections.RestRepositoryConnection; + +/** + * A rule to setup and tear down a massive repository for use in the tests + * use as a class rule + */ +public class MassiveServerRule implements TestRule { + + private RepositoryTestUtils testUtils; + + @Override + public Statement apply(final Statement statement, Description description) { + return new Statement() { + + @Override + public void evaluate() throws Throwable { + + testUtils = RepositoryTestUtilsFactory.getInstance().createTestUtils(TestType.MASSIVE_REPO); + // This isn't great, it is working around the old structure where + // the tests all extended the TestBaseClass + testUtils.setUpClass(); + try { + statement.evaluate(); + } finally { + DeleteRepo.deleteRepo(testUtils.getRepositoryConnection()); + } + + } + }; + } + + public RestRepositoryConnection getRepositoryConnection() { + return testUtils.getRepositoryConnection(); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/RestRepositoryConnectionRule.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/RestRepositoryConnectionRule.java new file mode 100755 index 00000000000..22ccb3e2c75 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/base/servers/RestRepositoryConnectionRule.java @@ -0,0 +1,37 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base.servers; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.ProtocolException; + +import org.junit.rules.TestRule; + +import com.ibm.ws.repository.connections.RepositoryConnection; +import com.ibm.ws.repository.connections.RestRepositoryConnection; + +/** + * A test rule representing a connection to a repository. The repository will + * be emptied at the beginning and the end of the test. + */ +public interface RestRepositoryConnectionRule extends TestRule { + + RestRepositoryConnection getRestConnection(); + + RepositoryConnection getConnection(); + + boolean updatesAreSupported(); + + void refreshSearchIndex(String assetId) throws MalformedURLException, ProtocolException, IOException; + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/AbstractFileWriteableClient.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/AbstractFileWriteableClient.java new file mode 100755 index 00000000000..44797421305 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/AbstractFileWriteableClient.java @@ -0,0 +1,186 @@ +package com.ibm.ws.repository.test.utils.clients; +/******************************************************************************* + * Copyright (c) 2015 IBM Corp. + * + * 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. + *******************************************************************************/ + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import com.ibm.ws.repository.common.enums.AttachmentType; +import com.ibm.ws.repository.common.enums.FilterableAttribute; +import com.ibm.ws.repository.common.enums.ResourceType; +import com.ibm.ws.repository.common.enums.StateAction; +import com.ibm.ws.repository.common.enums.Visibility; +import com.ibm.ws.repository.transport.client.RepositoryReadableClient; +import com.ibm.ws.repository.transport.client.RepositoryWriteableClient; +import com.ibm.ws.repository.transport.exceptions.BadVersionException; +import com.ibm.ws.repository.transport.exceptions.ClientFailureException; +import com.ibm.ws.repository.transport.exceptions.RequestFailureException; +import com.ibm.ws.repository.transport.model.AppliesToFilterInfo; +import com.ibm.ws.repository.transport.model.Asset; +import com.ibm.ws.repository.transport.model.Attachment; +import com.ibm.ws.repository.transport.model.AttachmentSummary; +import com.ibm.ws.repository.transport.model.FilterVersion; + +/** + * + */ +public abstract class AbstractFileWriteableClient implements RepositoryWriteableClient, RepositoryReadableClient { + + protected RepositoryReadableClient _readClient; + + /** + * {@inheritDoc} + * + * @throws IllegalAccessException + * @throws IllegalArgumentException + */ + @Override + public Asset addAsset(Asset asset) throws IOException, BadVersionException, RequestFailureException, SecurityException, ClientFailureException { + + StringBuffer relative = new StringBuffer(); + if (asset.getType() != null) { + relative.append(asset.getType().getURLForType()); + relative.append(File.separator); + } + FilterVersion minVer = null; + if (asset.getWlpInformation() != null) { + Collection appliesTo = asset.getWlpInformation().getAppliesToFilterInfo(); + if (appliesTo != null && !appliesTo.isEmpty()) { + minVer = appliesTo.iterator().next().getMinVersion(); + } + if (minVer != null) { + relative.append(minVer.getValue()); + relative.append(File.separator); + } + } + + Collection attachs = asset.getAttachments(); + String mainAttachmentName = null; + if (attachs != null) { + for (Attachment at : attachs) { + if (at.getType() == AttachmentType.CONTENT) { + mainAttachmentName = at.getName(); + break; + } + } + } + + if (mainAttachmentName != null) { + relative.append(mainAttachmentName); + } else if (asset.getName() != null) { + String assetName = asset.getName().replace("/", ""); + assetName = assetName.replace(":", ""); + relative.append(assetName); + } else { + // No where to get the name from so create a random one + relative.append("unnamed" + Math.random()); + } + asset.set_id(relative.toString()); + + try { + writeJson(asset, relative.toString()); + } catch (IllegalArgumentException e) { + throw new ClientFailureException("Failed to write the asset to disk", asset.get_id(), e); + } catch (IllegalAccessException e) { + throw new ClientFailureException("Failed to write the asset to disk", asset.get_id(), e); + } + + // For some reason the file.io operations aren't always finished....why dont they block? + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignore it + } + return _readClient.getAsset(asset.get_id()); + } + + /** + * {@inheritDoc} + * + * @throws ClientFailureException + */ + @Override + public Asset updateAsset(final Asset asset) throws IOException, BadVersionException, RequestFailureException, SecurityException, ClientFailureException { + deleteAssetAndAttachments(asset.get_id()); + return addAsset(asset); + } + + /** {@inheritDoc} */ + @Override + public Attachment updateAttachment(String assetId, AttachmentSummary summary) throws IOException, BadVersionException, RequestFailureException, SecurityException { + deleteAttachment(assetId, summary.getAttachment().get_id()); + return addAttachment(assetId, summary); + } + + /** {@inheritDoc} */ + @Override + public void updateState(String assetId, StateAction action) throws IOException, RequestFailureException { + // null op for file based repos + } + + public abstract void writeJson(Asset asset, String path) throws IOException, IllegalArgumentException, IllegalAccessException; + + @Override + public Asset getAsset(String assetId) throws IOException, BadVersionException, RequestFailureException { + return _readClient.getAsset(assetId); + } + + @Override + public Collection getAllAssets() throws IOException, RequestFailureException { + return _readClient.getAllAssets(); + } + + @Override + public Collection getAssets(ResourceType type) throws IOException, RequestFailureException { + return _readClient.getAssets(type); + } + + @Override + public Collection getAssets(Collection types, Collection productIds, Visibility visibility, Collection productVersions) throws IOException, RequestFailureException { + return _readClient.getAssets(types, productIds, visibility, productVersions); + } + + @Override + public Collection getAssetsWithUnboundedMaxVersion(Collection types, Collection rightProductIds, Visibility visibility) throws IOException, RequestFailureException { + return _readClient.getAssetsWithUnboundedMaxVersion(types, rightProductIds, visibility); + } + + @Override + public InputStream getAttachment(Asset asset, Attachment attachment) throws IOException, BadVersionException, RequestFailureException { + return _readClient.getAttachment(asset, attachment); + } + + @Override + public List findAssets(String searchString, Collection types) throws IOException, RequestFailureException { + return _readClient.findAssets(searchString, types); + } + + @Override + public Collection getFilteredAssets(Map> filters) throws IOException, RequestFailureException { + return _readClient.getFilteredAssets(filters); + } + + @Override + public void checkRepositoryStatus() throws IOException, RequestFailureException { + _readClient.checkRepositoryStatus(); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/DirectoryWriteableClient.java b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/DirectoryWriteableClient.java new file mode 100755 index 00000000000..6930bf2d09a --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/com/ibm/ws/repository/test/utils/clients/DirectoryWriteableClient.java @@ -0,0 +1,192 @@ +package com.ibm.ws.repository.test.utils.clients; + +/******************************************************************************* + * Copyright (c) 2015 IBM Corp. + * + * 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. + *******************************************************************************/ + +import java.io.File; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.util.Calendar; + +import com.ibm.ws.repository.transport.client.DirectoryClient; +import com.ibm.ws.repository.transport.client.DirectoryUtils; +import com.ibm.ws.repository.transport.exceptions.BadVersionException; +import com.ibm.ws.repository.transport.exceptions.RequestFailureException; +import com.ibm.ws.repository.transport.model.Asset; +import com.ibm.ws.repository.transport.model.Attachment; +import com.ibm.ws.repository.transport.model.AttachmentSummary; + +/** + * + */ +public class DirectoryWriteableClient extends AbstractFileWriteableClient { + + private final File _root; + + public DirectoryWriteableClient(File root) { + _root = root; + _readClient = new DirectoryClient(_root); + } + + public static void writeDiskRepoJSONToFile(Asset asset, final File writeJsonTo) throws IllegalArgumentException, IllegalAccessException, IOException { + FileOutputStream fos = null; + DirectoryUtils.mkDirs(writeJsonTo.getParentFile()); + try { + fos = DirectoryUtils.createFileOutputStream(writeJsonTo); + asset.dumpMinimalAsset(fos); + } finally { + if (fos != null) { + fos.close(); + } + } + + } + + @Override + public void writeJson(Asset asset, String path) throws IllegalArgumentException, IllegalAccessException, IOException { + File targetFile = new File(_root, path.toString() + ".json"); + writeDiskRepoJSONToFile(asset, targetFile); + } + + public void downloadToFile(InputStream is, final File fileToWriteTo) throws IOException { + FileOutputStream fos = null; + try { + fos = DirectoryUtils.createFileOutputStream(fileToWriteTo); + + byte[] buffer = new byte[1024]; + int read = 0; + while ((read = is.read(buffer)) != -1) { + fos.write(buffer, 0, read); + } + } finally { + if (null != fos) { + fos.close(); + } + if (null != is) { + is.close(); + } + } + } + + /** {@inheritDoc} */ + @Override + public Attachment addAttachment(String assetId, AttachmentSummary attSummary) throws IOException, BadVersionException, RequestFailureException, SecurityException { + File source = attSummary.getFile(); + Attachment att = attSummary.getAttachment(); + StringBuffer targetPath = new StringBuffer(assetId); + switch (attSummary.getAttachment().getType()) { + case CONTENT: + // target path is right for the main attachment + break; + case DOCUMENTATION: + case ILLUSTRATION: + case THUMBNAIL: + targetPath.append("."); + targetPath.append(attSummary.getAttachment().getType().toString()); + + // Create directory at this point + new File(_root, targetPath.toString()).mkdir(); + + targetPath.append(File.separator); + targetPath.append(attSummary.getName()); + break; + case LICENSE: + case LICENSE_AGREEMENT: + case LICENSE_INFORMATION: + targetPath.append(".licenses"); + targetPath.append(File.separator); + targetPath.append(attSummary.getName()); + + // Create directory at this point + new File(_root, targetPath.toString()).mkdir(); + + break; + } + + att.setAssetId(assetId); + att.set_id(targetPath.toString()); + // We don't really use the URL but to be consistent with massive we can set it to the supplied value or create one if not specified + att.setUrl(attSummary.getURL() == null ? targetPath.toString() : attSummary.getURL()); + att.setUploadOn(Calendar.getInstance()); + + // This is done to give a random value to the attachment, it is only used as a way of ensuring that each time this method is called + // there is some unique value stored in the attachment. + att.setGridFSId("" + Math.random()); + InputStream is = DirectoryUtils.createFileInputStream(source); + downloadToFile(is, new File(_root, targetPath.toString())); + + return att; + } + + /** {@inheritDoc} */ + @Override + public void deleteAttachment(String assetId, String attachmentId) throws IOException, RequestFailureException { + DirectoryUtils.delete(createFromRelative(attachmentId)); + } + + /** {@inheritDoc} */ + @Override + public void deleteAssetAndAttachments(String assetId) throws IOException, RequestFailureException { + final File main = new File(_root, assetId); + final String mainName = main.getName(); + File parent = main.getParentFile(); + File[] toDelete = DirectoryUtils.listFiles(parent, new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + if (mainName.equals(name)) { + return true; + } + if ((mainName + ".json").equals(name)) { + return true; + } + if ((mainName + ".license").equals(name)) { + return true; + } + if (name.contains(mainName + ".") && DirectoryUtils.isDirectory(dir)) + { + // TODO: Is this one we should delete? Another attachment type? + } + return false; + } + }); + + if (toDelete != null) { + for (File f : toDelete) { + if (DirectoryUtils.isDirectory(f)) { + recursivelyDelete(f); + } + DirectoryUtils.delete(f); + } + } + } + + private void recursivelyDelete(File f) { + if (DirectoryUtils.isDirectory(f)) { + File[] children = DirectoryUtils.listFiles(f); + for (File child : children) { + recursivelyDelete(child); + } + } + DirectoryUtils.delete(f); + } + + private File createFromRelative(final String relative) { + return new File(_root, relative); + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils/src/mongodb.properties b/dev/com.ibm.ws.repository.test.utils/src/mongodb.properties new file mode 100755 index 00000000000..654f9e9011f --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils/src/mongodb.properties @@ -0,0 +1,4 @@ +hosts=ltestl91.hursley.ibm.com,ltestl94.hursley.ibm.com,ltestl62.hursley.ibm.com +ports=28017,28017,28017 +username=repoBuilds +password=T35tiN6!Lars \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.test.utils_test/.classpath b/dev/com.ibm.ws.repository.test.utils_test/.classpath new file mode 100755 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.test.utils_test/.classpath.gradle b/dev/com.ibm.ws.repository.test.utils_test/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.repository.test.utils_test/.gitignore b/dev/com.ibm.ws.repository.test.utils_test/.gitignore new file mode 100644 index 00000000000..27e131e35a6 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.repository.test.utils_test/.project b/dev/com.ibm.ws.repository.test.utils_test/.project new file mode 100755 index 00000000000..352138bc168 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.repository.test.utils_test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..f48ecd6cc60 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c92277a371a --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd b/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd new file mode 100644 index 00000000000..5f1bb46e550 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd @@ -0,0 +1,12 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.test.utils;version=latest diff --git a/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd.gradle b/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd.gradle new file mode 100644 index 00000000000..5f1bb46e550 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/bnd.bnd.gradle @@ -0,0 +1,12 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + fattest.simplicity;version=latest, \ + com.ibm.ws.repository;version=latest, \ + com.ibm.ws.repository.test.utils;version=latest diff --git a/dev/com.ibm.ws.repository.test.utils_test/build-test.xml b/dev/com.ibm.ws.repository.test.utils_test/build-test.xml new file mode 100755 index 00000000000..df2a6311de9 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/build-test.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.test.utils_test/build.gradle b/dev/com.ibm.ws.repository.test.utils_test/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.repository.test.utils_test/fat/src/com/ibm/ws/repository/base/FATTest.java b/dev/com.ibm.ws.repository.test.utils_test/fat/src/com/ibm/ws/repository/base/FATTest.java new file mode 100755 index 00000000000..b7b40cb2a7d --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/fat/src/com/ibm/ws/repository/base/FATTest.java @@ -0,0 +1,174 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.repository.base; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Collection; +import java.util.Properties; + +import org.junit.Assert; +import org.junit.Test; + +import com.ibm.ws.repository.connections.RepositoryConnectionList; +import com.ibm.ws.repository.connections.RestRepositoryConnection; +import com.ibm.ws.repository.exceptions.RepositoryBackendException; +import com.ibm.ws.repository.resources.RepositoryResource; + +public class FATTest { + + Properties dynamicApiKeyProps; + Properties staticApiKeyProps; + Properties staticApiKeyPropsInvalidRespositories; + private final static File resourcesDir = new File("lib/LibertyFATTestFiles"); + + public FATTest() throws FileNotFoundException, IOException { + dynamicApiKeyProps = new Properties(); + dynamicApiKeyProps.load(this.getClass().getResourceAsStream("/testLogin.properties")); + staticApiKeyProps = new Properties(); + staticApiKeyProps.load(new FileInputStream(new File(resourcesDir, "staticApiKeys.props"))); + staticApiKeyPropsInvalidRespositories = new Properties(); + staticApiKeyPropsInvalidRespositories.load(new FileInputStream(new File(resourcesDir, "staticApiKeysInvalidRepositories.props"))); + } + + @Test + public void testDynamicApiKey() throws NoRepoAvailableException { + LoginInfoProvider provider = new LoginInfoProvider(dynamicApiKeyProps); + RestRepositoryConnection info = provider.getLoginInfo(); + + assertNotNull(info.getApiKey()); + assertNotNull(info.getRepositoryUrl()); + assertNotNull(info.getUserId()); + assertNotNull(info.getPassword()); + + assertNotNull(info.getClientLoginInfo().getApiKey()); + assertNotNull(info.getClientLoginInfo().getRepositoryUrl()); + assertNotNull(info.getClientLoginInfo().getUserId()); + assertNotNull(info.getClientLoginInfo().getPassword()); + + // Check that we're caching the loginInfo + RestRepositoryConnection info2 = provider.getLoginInfo(); + assertSame("Login info should be cached", info, info2); + } + + /** + * Test that we are returned a working server which is one of the two in the + * properties file and that the fields in the LoginInfo are set as expected. + * + * @throws NoRepoAvailableException + */ + @Test + public void testStaticApiKey() throws NoRepoAvailableException { + LoginInfoProvider provider = new LoginInfoProvider(staticApiKeyProps); + RestRepositoryConnection info = provider.getLoginInfo(); + + if (staticApiKeyProps.get("test1.url").equals(info.getRepositoryUrl())) { + Assert.assertEquals(staticApiKeyProps.get("test1.apiKey"), info.getApiKey()); + } else { + Assert.assertEquals(staticApiKeyProps.get("test2.apiKey"), info.getApiKey()); + } + + assertNotNull(info.getApiKey()); + assertNotNull(info.getRepositoryUrl()); + assertNotNull(info.getUserId()); + assertNotNull(info.getPassword()); + + assertNotNull(info.getClientLoginInfo().getApiKey()); + assertNotNull(info.getClientLoginInfo().getRepositoryUrl()); + assertNotNull(info.getClientLoginInfo().getUserId()); + assertNotNull(info.getClientLoginInfo().getPassword()); + } + + /** + * Given a list of massive servers, that contains both of the valid ones (for failover) and a number + * of invalid ones, that the only servers returned to us are the genuine ones (ie one that we can + * talk to that give valid results). + * + * @throws NoRepoAvailableException + * @throws RepositoryBackendException + */ + @Test + public void testStaticApiKeyInvalidRespositories() throws NoRepoAvailableException, RepositoryBackendException { + + for (int i = 0; i < 10; i++) { + LoginInfoProvider provider = new LoginInfoProvider(staticApiKeyPropsInvalidRespositories); + RestRepositoryConnection info = provider.getLoginInfo(); + + Collection resources = new RepositoryConnectionList(info).getAllResources(); + assertEquals("We were able to read from massive but did not get the expected result", 0, resources.size()); + } + } + + @Test + public void testInvalidServer() { + Properties invalid = new Properties(); + invalid.setProperty("bad.url", "hxxp://www.example.com"); + + LoginInfoProvider provider = new LoginInfoProvider(invalid); + try { + provider.getLoginInfo(); + fail(); + } catch (NoRepoAvailableException ex) { + // Expected exception + } + } + + @Test + public void testUserNoApiKey() { + Properties invalid = new Properties(dynamicApiKeyProps); + invalid.setProperty("userId", "testUser"); + + try { + new LoginInfoProvider(invalid); + fail(); + } catch (IllegalArgumentException ex) { + // Expected exception + } + } + + @Test + public void testNoUserApiKey() { + Properties invalid = new Properties(); + invalid.setProperty("server.url", "baz"); + invalid.setProperty("server.apiKey", "123456789"); + + try { + new LoginInfoProvider(invalid); + fail(); + } catch (IllegalArgumentException ex) { + // Expected exception + } + } + + @Test + public void testSomeMissingApiKey() { + // Copy static apiKey settings + Properties invalid = new Properties(staticApiKeyProps); + // Add a new server, but no apiKey + invalid.setProperty("missingapi.url", "http://www.example.com"); + + try { + new LoginInfoProvider(invalid); + fail(); + } catch (IllegalArgumentException ex) { + // Expected exception + } + } + +} diff --git a/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeys.props b/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeys.props new file mode 100755 index 00000000000..253e27a27d1 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeys.props @@ -0,0 +1,17 @@ +# This file points to some repositories using fixed apiKeys. +# It is used to test the LoginInfoProvider +# There should be two servers configured named "test1" and "test2" and both should exist. + +# Leave these blank to use the test repo credentials and create test repositories +# If userId and password are blank then an apiKey must not be supplied +userId=massiveClientTest@ibm.com +password=cT3st9 + +test1.url=http://ltestl94.hursley.ibm.com:9002/ma/v1 +test1.apiKey=68059479864 +test2.url=http://ltestl91.hursley.ibm.com:9002/ma/v1 +test2.apiKey=96999462158 + +# Basic auth credentials needed to access an authenticated server on softlayer +# softlayerUserId= +# softlayerPassword= \ No newline at end of file diff --git a/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeysInvalidRepositories.props b/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeysInvalidRepositories.props new file mode 100755 index 00000000000..abad9532cc7 --- /dev/null +++ b/dev/com.ibm.ws.repository.test.utils_test/publish/files/staticApiKeysInvalidRepositories.props @@ -0,0 +1,34 @@ +# This file points to some repositories using fixed apiKeys. +# It is used to test the LoginInfoProvider +# There should a number of servers configured including BOTH the real servers and a number of +# invalid ones. + +# Leave these blank to use the test repo credentials and create test repositories +# If userId and password are blank then an apiKey must not be supplied +userId=massiveClientTest@ibm.com +password=cT3st9 + +test1.url=http://ltestl94.hursley.ibm.com:9002/ma/v1 +test1.apiKey=68059479864 +test2.url=http://ltestl91.hursley.ibm.com:9002/ma/v1 +test2.apiKey=96999462158 +test3.url=hxxp://invalid.server1.com +test3.apiKey=1 +test4.url=hxxp://invalid.server2.com +test4.apiKey=2 +test5.url=hxxp://invalid.server3.com +test5.apiKey=3 +test6.url=hxxp://invalid.server4.com +test6.apiKey=4 +test7.url=hxxp://invalid.server5.com +test7.apiKey=5 +test8.url=hxxp://invalid.server6.com +test8.apiKey=6 +test9.url=hxxp://invalid.server7.com +test9.apiKey=7 +test10.url=hxxp://invalid.server8.com +test10.apiKey=8 + +# Basic auth credentials needed to access an authenticated server on softlayer +# softlayerUserId= +# softlayerPassword= \ No newline at end of file diff --git a/dev/com.ibm.ws.runtime.update_fat/.classpath b/dev/com.ibm.ws.runtime.update_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/.classpath.gradle b/dev/com.ibm.ws.runtime.update_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/.gitignore b/dev/com.ibm.ws.runtime.update_fat/.gitignore new file mode 100644 index 00000000000..76077afaec2 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.gitignore @@ -0,0 +1,3 @@ +dropins +bundles +/bootstrapping.properties diff --git a/dev/com.ibm.ws.runtime.update_fat/.project b/dev/com.ibm.ws.runtime.update_fat/.project new file mode 100755 index 00000000000..84bf672dd2f --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.runtime.update_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..845c3083c7d --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +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.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c874b581698 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=true +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=false +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.runtime.update_fat/bnd.bnd b/dev/com.ibm.ws.runtime.update_fat/bnd.bnd new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.runtime.update_fat/bnd.bnd.gradle b/dev/com.ibm.ws.runtime.update_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.runtime.update_fat/build-test.xml b/dev/com.ibm.ws.runtime.update_fat/build-test.xml new file mode 100755 index 00000000000..b09f9391954 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/build-test.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.runtime.update_fat/build.gradle b/dev/com.ibm.ws.runtime.update_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/ConfigUpdateDeliveryTest.java b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/ConfigUpdateDeliveryTest.java new file mode 100755 index 00000000000..997bc25af5a --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/ConfigUpdateDeliveryTest.java @@ -0,0 +1,168 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.runtime.update.fat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.ProtocolException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Tests that applications on the Liberty profile can access the RuntimeUpdateNotificationMBean, register + * a NotificationListener and receive notifications for updates to the server.xml configuration. + */ +public class ConfigUpdateDeliveryTest { + + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.runtime.update.fat"); + private static final String urlPrefix = "http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/mbean"; + private final Class c = ConfigUpdateDeliveryTest.class; + + @Rule + public final TestName method = new TestName(); + + @Test + public void configUpdatesDelivered() throws Exception { + Log.info(c, method.getMethodName(), "Entering test: " + method.getMethodName()); + + // Add a notification listener to the MBeanServer. + URL url = new URL(urlPrefix + "?setupNotificationListener"); + Log.info(c, "testConfigUpdatesDelivered", "Calling JMX Servlet with URL=" + url.toString()); + testServlet(url); + + // Replace the server.xml configuration file to trigger a notification for the delivery of config updates. + Log.info(c, method.getMethodName(), "Replacing: " + server.getServerName() + + " server.xml to trigger a runtime update notification."); + server.setServerConfigurationFile("local-connector-server.xml"); + // Wait for the configuration update to take effect + assertNotNull("FAIL: " + server.getServerName() + " did not complete the server configuration update", + server.waitForStringInLog("CWWKG0017I:.*")); + + // Wait for the notification to be received for the configuration update. + url = new URL(urlPrefix + "?checkForNotifications"); + Log.info(c, "testConfigUpdatesDelivered", "Calling JMX Servlet with URL=" + url.toString()); + testServlet(url); + + Log.info(c, method.getMethodName(), "Exiting test: " + method.getMethodName()); + } + + @BeforeClass + public static void setUp() throws Exception { + server.startServer(); + } + + @AfterClass + public static void tearDown() throws Exception { + if (server != null && server.isStarted()) { + server.stopServer(); + } + } + + private void testServlet(URL url) throws IOException { + HttpURLConnection con = getHttpConnection(url); + BufferedReader br = getConnectionStream(con); + + try { + // read the page contents + String line = br.readLine(); + List lines = new ArrayList(); + while (line != null) { + lines.add(line); + line = br.readLine(); + } + con.disconnect(); + + // log the output lines so we can debug + System.out.println("Output: "); + for (String msg : lines) { + System.out.println(msg); + } + + // check the first line to be sure we at least got to the servlet + assertEquals("This is a servlet for the RuntimeUpdateNotificationMBean.", lines.get(0)); + + boolean foundPass = false; + + // Pass criteria: + // - No FAIL: lines + // - at least one PASS line + + for (String msg : lines) { + if (msg.startsWith("FAIL: ")) { + // When there is a fail log the whole output + StringBuilder builder = new StringBuilder(); + for (String lineForMessage : lines) { + builder.append(lineForMessage); + builder.append("\n"); + } + fail(builder.toString()); + } + if (msg.startsWith("PASS")) { + foundPass = true; + } + } + if (!foundPass) { + fail("Did not see PASS from servlet invocation at " + url); + } + + } finally { + br.close(); + } + } + + /** + * This method is used to get a connection stream from an HTTP connection. It + * gives the output from the webpage that it gets from the connection + * + * @param con The connection to the HTTP address + * @return The Output from the webpage + */ + private BufferedReader getConnectionStream(HttpURLConnection con) throws IOException { + InputStream is = con.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + return br; + } + + /** + * This method creates a connection to a webpage and then reutrns the connection + * + * @param url The Http Address to connect to + * @return The connection to the http address + */ + private HttpURLConnection getHttpConnection(URL url) throws IOException, ProtocolException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + return con; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/FATSuite.java b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/FATSuite.java new file mode 100755 index 00000000000..ecffa18771e --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/FATSuite.java @@ -0,0 +1,25 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.runtime.update.fat; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ + ConfigUpdateDeliveryTest.class, + RuntimeQuiesceTest.class +}) +public class FATSuite { + +} diff --git a/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/RuntimeQuiesceTest.java b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/RuntimeQuiesceTest.java new file mode 100755 index 00000000000..88abc830fe4 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/fat/src/com/ibm/ws/runtime/update/fat/RuntimeQuiesceTest.java @@ -0,0 +1,246 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.runtime.update.fat; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.annotation.ExpectedFFDC; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * This class is a little odd: + * We're testing the behavior of server stop. One server will be used for all test methods. + * The server will be started and stopped within each test method, BUT.. + * when the server is stopped within the tests, the logs will not be collected. + * + * The server logs will be collected at the end, in the tearDown. + */ +public class RuntimeQuiesceTest { + private static final Class c = RuntimeQuiesceTest.class; + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.runtime.quiesce.fat"); + + @Rule + public final TestName method = new TestName(); + + @AfterClass + public static void tearDownClass() throws Exception { + try { + // make sure server is torn down -- don't collect archive + if (server != null && server.isStarted()) { + server.stopServer(false); + } + } finally { + // ONE archive for the whole run (multiple starts/stops of the server) + server.postStopServerArchive(); + } + } + + boolean throwException = false; + boolean takeForever = false; + + @Before + public void setup() { + Log.info(c, method.getMethodName(), "**** ENTER: " + method.getMethodName()); + } + + @After + public void tearDown() throws Exception { + try { + // make sure server is torn down -- don't collect archive + if (server.isStarted()) { + server.stopServer(false); + } + + server.renameLibertyServerRootFile("logs/trace.log", "logs/" + method.getMethodName() + ".trace.log"); + server.renameLibertyServerRootFile("logs/messages.log", "logs/" + method.getMethodName() + ".messages.log"); + server.resetLogOffsets(); + + // Always ensure that the installed resources are cleaned up between runs.. + server.uninstallSystemBundle("test.server.quiesce_1.0.0"); + server.uninstallSystemFeature("quiescelistener-1.0"); + server.uninstallUserBundle("test.server.quiesce_1.0.0"); + server.uninstallUserFeature("quiescelistener-1.0"); + } finally { + Log.info(c, method.getMethodName(), "**** EXIT: " + method.getMethodName()); + } + } + + // Note: methods can execute in any order. We do (sadly) have to clean start the server + // because the same feature and bundle are moved between the system (wlp/lib) and + // the user extension (usr/extension/lib). + + /** + * If there are no quiesce listeners registered (and no pending notifications), we shouldn't + * see any messages about quiesce processing.. + * + * @throws Exception + */ + @Test + public void testNoQuiesceListeners() throws Exception { + + server.setServerConfigurationFile("no-quiesce-listener.server.xml"); + // start the server, do not clean-start, and do not pre-clean the logs dir + server.startServer(method.getMethodName() + ".console.log", true, false); + + // stop the server, do not clean up the archive + server.stopServer(false); + + // These messages flat out shouldn't be in there! + Assert.assertNull("FAIL: for " + method.getMethodName() + ", " + server.getServerName() + " should not contain information about server quiesce", + server.waitForStringInLog("CWWKE1100I", 1)); + } + + /** + * If there are no quiesce listeners registered (and no pending notifications), we shouldn't + * see any messages about quiesce processing.. + * + * @throws Exception + */ + @Test + public void testForceStop() throws Exception { + // Add a single quiesce listener as a runtime feature/bundle (internal) + server.setServerConfigurationFile("quiesce-listener.server.xml"); + server.installSystemBundle("test.server.quiesce_1.0.0"); + server.installSystemFeature("quiescelistener-1.0"); + + // start the server, do not clean-start, and do not pre-clean the logs dir + server.startServer(method.getMethodName() + ".console.log", true, false); + + // stop the server, do not clean up the archive, and FORCE STOP (no queisce) + server.stopServer(false, true); + + // These messages flat out shouldn't be in there! + Assert.assertNull("FAIL: for " + method.getMethodName() + ", " + server.getServerName() + " should not contain information about server quiesce", + server.waitForStringInLog("CWWKE1100I", 1)); + } + + /** + * Define/invoke a runtime-level quiesce listener + * + * @throws Exception + */ + @Test + public void testSingleRuntimeQuiesceListener() throws Exception { + // Add a single quiesce listener as a runtime feature/bundle (internal) + server.setServerConfigurationFile("quiesce-listener.server.xml"); + server.installSystemBundle("test.server.quiesce_1.0.0"); + server.installSystemFeature("quiescelistener-1.0"); + + startStopServer(); + } + + /** + * Make sure a user feature/product extension can provide a quiesce listener + * (SPI is defined properly). + * + * @throws Exception + */ + @Test + public void testSingleUserQuiesceListener() throws Exception { + // Add a single quiesce listener as a usr feature/bundle (SPI) + server.setServerConfigurationFile("user-quiesce-listener.server.xml"); + server.installUserBundle("test.server.quiesce_1.0.0"); + server.installUserFeature("quiescelistener-1.0"); + + startStopServer(); + } + + /** + * Try a quiesce service that throws an exception, and make sure that doesn't + * prevent the quiesce activity from completing. + * + * @throws Exception + */ + @Test + @ExpectedFFDC("java.lang.RuntimeException") + public void testQuiesceListenerException() throws Exception { + // Add a single quiesce listener as a usr feature/bundle (SPI) + server.setServerConfigurationFile("bad-quiesce-listener.server.xml"); + server.installSystemBundle("test.server.quiesce_1.0.0"); + server.installSystemFeature("quiescelistener-1.0"); + + throwException = true; + startStopServer(); + } + + /** + * Long running test (at least 30s), push this into the full bucket. + * This triggers a quiesce listener that takes longer than 30s to complete. + * Make sure we get a warning that not all quiesce activity completed (and that + * we don't see the message indicating that it did). + * + * @throws Exception + */ + @Test + @Mode(TestMode.FULL) + public void testLongRunningQuiesceListener() throws Exception { + // Add a single quiesce listener as a usr feature/bundle (SPI) + server.setServerConfigurationFile("longrunning-quiesce-listener.server.xml"); + server.installSystemBundle("test.server.quiesce_1.0.0"); + server.installSystemFeature("quiescelistener-1.0"); + + takeForever = true; + startStopServer(); + } + + private void startStopServer() throws Exception { + // start the server, do a clean start, and do not pre-clean the logs dir + server.startServer(method.getMethodName() + ".console.log", true, false); + + // wait for port to start + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain info msg about open port", + server.waitForStringInLog("CWWKO0219I", 0)); + + // stop the server, do not clean up the archive + server.setMarkToEndOfLog(server.getDefaultLogFile()); + server.stopServer(false); + + // Make sure stop has completed + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain warning msg about the failure to complete server quiesce", + server.waitForStringInLog("CWWKE0036I")); + + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain info msg about the start of server quiesce", + server.waitForStringInLog("CWWKE1100I", 0)); + + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain WHEE! because the test quiesce listener was called", + server.waitForStringInLog("WHEE!", 0)); + + if (throwException) { + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + + " should contain WOOPS! because the test quiesce listener threw an exception", + server.waitForStringInLog("WOOPS!", 0)); + } + + if (takeForever) { + Assert.assertNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should NOT contain info msg about the completion of server quiesce", + server.waitForStringInLog("CWWKE1101I", 0)); + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain warning msg about the failure to complete server quiesce", + server.waitForStringInLog("CWWKE1102W", 0)); + } else { + Assert.assertNotNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should contain information about the completion of server quiesce", + server.waitForStringInLog("CWWKE1101I", 0)); + Assert.assertNull("FAIL for " + method.getMethodName() + ": " + server.getServerName() + " should NOT contain information about the failure to complete server quiesce", + server.waitForStringInLog("CWWKE1102W", 0)); + } + } + +} diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/features/quiescelistener-1.0.mf b/dev/com.ibm.ws.runtime.update_fat/publish/features/quiescelistener-1.0.mf new file mode 100755 index 00000000000..a880ebb2378 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/features/quiescelistener-1.0.mf @@ -0,0 +1,6 @@ +Subsystem-ManifestVersion: 1 +Subsystem-SymbolicName: quiescelistener-1.0;visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.server.quiesce; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/bad-quiesce-listener.server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/bad-quiesce-listener.server.xml new file mode 100755 index 00000000000..43519eb45bb --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/bad-quiesce-listener.server.xml @@ -0,0 +1,12 @@ + + + + servlet-3.0 + quiescelistener-1.0 + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/local-connector-server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/local-connector-server.xml new file mode 100755 index 00000000000..3d6794d516e --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/local-connector-server.xml @@ -0,0 +1,10 @@ + + + + servlet-3.0 + localConnector-1.0 + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/longrunning-quiesce-listener.server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/longrunning-quiesce-listener.server.xml new file mode 100755 index 00000000000..e46b28115eb --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/longrunning-quiesce-listener.server.xml @@ -0,0 +1,12 @@ + + + + servlet-3.0 + quiescelistener-1.0 + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/no-quiesce-listener.server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/no-quiesce-listener.server.xml new file mode 100755 index 00000000000..b500ad4a504 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/no-quiesce-listener.server.xml @@ -0,0 +1,8 @@ + + + + timedexit-1.0 + quiescelistener-1.0 + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/quiesce-listener.server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/quiesce-listener.server.xml new file mode 100755 index 00000000000..7d33a124f99 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/quiesce-listener.server.xml @@ -0,0 +1,10 @@ + + + + servlet-3.0 + quiescelistener-1.0 + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/files/user-quiesce-listener.server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/files/user-quiesce-listener.server.xml new file mode 100755 index 00000000000..50996b8a622 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/files/user-quiesce-listener.server.xml @@ -0,0 +1,10 @@ + + + + servlet-3.0 + usr:quiescelistener-1.0 + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/bootstrap.properties b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/bootstrap.properties new file mode 100755 index 00000000000..4f1ae5a2e10 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/server.xml new file mode 100755 index 00000000000..009285e6bd0 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.quiesce.fat/server.xml @@ -0,0 +1,9 @@ + + + + servlet-3.0 + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/bootstrap.properties b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/bootstrap.properties new file mode 100755 index 00000000000..4f1ae5a2e10 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties diff --git a/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/server.xml b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/server.xml new file mode 100755 index 00000000000..009285e6bd0 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/publish/servers/com.ibm.ws.runtime.update.fat/server.xml @@ -0,0 +1,9 @@ + + + + servlet-3.0 + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/META-INF/permissions.xml b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/META-INF/permissions.xml new file mode 100755 index 00000000000..a5ca0dc2ed0 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/META-INF/permissions.xml @@ -0,0 +1,19 @@ + + + + + javax.management.MBeanServerPermission + createMBeanServer + + + + javax.management.MBeanPermission + * + removeNotificationListener + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/WEB-INF/web.xml b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..b3ddded7f60 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/resources/WEB-INF/web.xml @@ -0,0 +1,21 @@ + + + + + MBean + This is a servlet designed to test the command line tools mbean. + + + + MBean Servlet + MBean Servlet + web.MBeanServlet + + + + + + MBean Servlet + /* + + diff --git a/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/src/web/MBeanServlet.java b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/src/web/MBeanServlet.java new file mode 100755 index 00000000000..f00b10734b1 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-applications/mbean/src/web/MBeanServlet.java @@ -0,0 +1,254 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package web; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.management.ManagementFactory; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; + +import javax.management.InstanceNotFoundException; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanServer; +import javax.management.MBeanServerConnection; +import javax.management.MBeanServerDelegate; +import javax.management.MBeanServerNotification; +import javax.management.Notification; +import javax.management.NotificationListener; +import javax.management.ObjectName; +import javax.management.relation.MBeanServerNotificationFilter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.ibm.websphere.runtime.update.RuntimeUpdateNotificationMBean; + +@SuppressWarnings("serial") +public class MBeanServlet extends HttpServlet { + + private static ObjectName MBEAN_NAME; + static { + try { + MBEAN_NAME = new ObjectName(RuntimeUpdateNotificationMBean.OBJECT_NAME); + } catch (Exception e) { + System.out.println("exception while making object name: " + e); + } + } + + public static final String MBeanMessage = "This is a servlet for the RuntimeUpdateNotificationMBean."; + private static final AtomicReference notificationListener = new AtomicReference(); + private static final String PASS = "PASS"; + private static final String FAIL = "FAIL: "; + + /** + * A simple servlet that when it received a request it simply outputs the message + * as defined by the static field. + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + PrintWriter writer = response.getWriter(); + response.setStatus(HttpServletResponse.SC_OK); + response.setContentType("text/plain"); + writer.println(MBeanMessage); + + String test = request.getQueryString(); + + try { + + if (test.equals("setupNotificationListener")) { + setupNotificationListener(writer); + } + else if (test.equals("checkForNotifications")) { + checkForNotifications(writer); + } + else { + writer.println(FAIL + "Unrecognized test name"); + } + + } catch (Exception e) { + writer.println(FAIL + e.getMessage()); + e.printStackTrace(writer); + } + + writer.flush(); + writer.close(); + } + + private void setupNotificationListener(PrintWriter writer) throws Exception { + MBeanServer mbs = getMBS(); + MBeanRegistrationCheckAndWait.waitForRegistrationForMBean(mbs, MBEAN_NAME); + RuntimeUpdateNotificationListener listener = new RuntimeUpdateNotificationListener(); + notificationListener.set(listener); + mbs.addNotificationListener(MBEAN_NAME, listener, null, null); + writer.println(PASS); + } + + private void checkForNotifications(PrintWriter writer) throws Exception { + final RuntimeUpdateNotificationListener listener = notificationListener.get(); + if (listener == null) { + writer.println(FAIL + "The notification listener stored in the servlet is null."); + return; + } + notificationListener.set(null); + try { + final boolean latchReleased = waitOnLatchRelease(listener); + if (!latchReleased) { + writer.println(FAIL + "ConfigUpdatesDelivered notification was not received."); + return; + } + if (!listener.configUpdatesDelivered()) { + writer.println(FAIL + "ConfigUpdatesDelivered notification was received but the server.xml updates did not complete successfully."); + return; + } + } + finally { + MBeanServer mbs = getMBS(); + try { + mbs.removeNotificationListener(MBEAN_NAME, listener); + } + // No listener was registered. Ignore it. + catch (ListenerNotFoundException e) {} + } + writer.println(PASS); + } + + private boolean waitOnLatchRelease(RuntimeUpdateNotificationListener listener) { + boolean done = false; + boolean countDownLatchReachZero = false; + do { + try { + countDownLatchReachZero = listener.latchForListener.await(120, TimeUnit.SECONDS); + done = true; + } catch (InterruptedException e) { + } + } while (!done); + return countDownLatchReachZero; + } + + private MBeanServer getMBS() { + return ManagementFactory.getPlatformMBeanServer(); + } + + public static class RuntimeUpdateNotificationListener implements NotificationListener { + + private boolean configUpdatesDelivered = false; + public final CountDownLatch latchForListener = new CountDownLatch(1); + + @Override + public synchronized void handleNotification(Notification notification, Object handback) { + if (RuntimeUpdateNotificationMBean.RUNTIME_UPDATE_NOTIFICATION_TYPE.equals(notification.getType()) && latchForListener.getCount() > 0) { + // UserData for "com.ibm.websphere.runtime.update.notification" type will always be a Map + @SuppressWarnings("unchecked") + Map userData = (Map)notification.getUserData(); + // Filter on runtime update notifications with the "ConfigUpdatesDelivered" name. + if (userData != null && + "ConfigUpdatesDelivered".equals(userData.get(RuntimeUpdateNotificationMBean.RUNTIME_UPDATE_NOTIFICATION_KEY_NAME))) { + configUpdatesDelivered = Boolean.TRUE.equals(userData.get(RuntimeUpdateNotificationMBean.RUNTIME_UPDATE_NOTIFICATION_KEY_STATUS)); + configUpdatesDelivered = configUpdatesDelivered && + userData.get(RuntimeUpdateNotificationMBean.RUNTIME_UPDATE_NOTIFICATION_KEY_MESSAGE) == null; + latchForListener.countDown(); + } + } + } + public boolean configUpdatesDelivered() { + return configUpdatesDelivered; + } + } + + public static class MBeanServerNotificationListener implements NotificationListener { + + private boolean registered = false; + public final CountDownLatch latchForListener = new CountDownLatch(1); + + @Override + public void handleNotification(Notification notification, Object handback) { + if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notification.getType())) { + registered = true; + latchForListener.countDown(); + } + } + public boolean isRegistered() { + return registered; + } + } + + public static class MBeanRegistrationCheckAndWait { + + public static void waitForRegistrationForMBean(MBeanServerConnection mbsc, ObjectName objName) throws InstanceNotFoundException, IOException { + (new MBeanRegistrationCheckAndWait()).waitOnMBeanRegistration(mbsc, objName); + } + + private MBeanServerNotificationListener listener; + + private MBeanRegistrationCheckAndWait() {} + + private boolean waitOnLatchRelease(MBeanServerNotificationListener listener) { + boolean done = false; + boolean countDownLatchReachZero = false; + do { + try { + countDownLatchReachZero = listener.latchForListener.await(120, TimeUnit.SECONDS); + done = true; + } catch (InterruptedException e) { + } + } while (!done); + return countDownLatchReachZero; + } + + private synchronized boolean needToWaitForListener(MBeanServerConnection mbsc, ObjectName objName) throws IOException, InstanceNotFoundException { + + listener = new MBeanServerNotificationListener(); + // MBeanServerDelegate.DELEGATE_NAME; + MBeanServerNotificationFilter registerFilter = new MBeanServerNotificationFilter(); + registerFilter.enableObjectName(objName); + registerFilter.disableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION); + + mbsc.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener, registerFilter, null); + // check again right after the listener is added + if (mbsc.isRegistered(objName)) { + return false; + } + return true; + } + + private void waitOnMBeanRegistration(MBeanServerConnection mbsc, ObjectName objName) throws InstanceNotFoundException, IOException { + if (mbsc.isRegistered(objName)) { + return; + } + try { + boolean waitForListener = needToWaitForListener(mbsc, objName); + if (!waitForListener) { + return; + } + if (!waitOnLatchRelease(listener)) { + String exMessage = "The MBean with object name" + objName + ", cannot be registered."; + throw new IOException(exMessage); + } + } + finally { + if (listener != null) { + try { + mbsc.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener); + listener = null; + } + // No listener was registered. Ignore it. + catch (ListenerNotFoundException e) {} + } + } + } + } +} diff --git a/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/bnd.bnd b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/bnd.bnd new file mode 100755 index 00000000000..88799b4d7be --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/bnd.bnd @@ -0,0 +1,19 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: Test bundle providing a quiesce listener +Bundle-SymbolicName: test.server.quiesce +Bundle-Description: Test bundle providing a server quiesce listener; version=${bVersion} + +# hide the implementation packages +Private-Package: \ + test.server.quiesce + +-dsannotations: \ + test.server.quiesce.TestQuiesceListener + +# test bundle build scripts copy things in the resources directory to the classpath.. +Include-Resource: \ + OSGI-INF=resources/OSGI-INF diff --git a/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/resources/OSGI-INF/metatype/metatype.xml b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/resources/OSGI-INF/metatype/metatype.xml new file mode 100755 index 00000000000..351c5b9fa20 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/resources/OSGI-INF/metatype/metatype.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/src/test/server/quiesce/TestQuiesceListener.java b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/src/test/server/quiesce/TestQuiesceListener.java new file mode 100755 index 00000000000..5907c766952 --- /dev/null +++ b/dev/com.ibm.ws.runtime.update_fat/test-bundles/test.server.quiesce/src/test/server/quiesce/TestQuiesceListener.java @@ -0,0 +1,57 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2014 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.server.quiesce; + +import java.util.Map; + +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; + +import com.ibm.wsspi.kernel.service.utils.ServerQuiesceListener; + +/** + * + */ +@Component(immediate = true, configurationPid = "test.server.quiesce") +public class TestQuiesceListener implements ServerQuiesceListener { + + boolean throwException = false; + boolean takeForever = false; + + @Activate + protected void activate(Map newConfig) { + System.out.println("TEST CONFIGURATION: " + newConfig); + + throwException = (Boolean) newConfig.get("throwException"); + takeForever = (Boolean) newConfig.get("takeForever"); + } + + @Override + public void serverStopping() { + + System.out.println("WHEE! THE SERVER IS STOPPING AND I GOT TOLD!"); + + if (throwException) { + throw new RuntimeException("WOOPS! I was told to do this, honest."); + } + + if (takeForever) { + System.out.println("MUAHAHA.. I will now take forever to quiesce (literally)!"); + + //Rather than deal with slow hardware or possible timing windows, just wait forever + //The server will still stop. But this gives it ample time to get to the timeout + //without having to worry about failures that aren't really failures + //This now relies on the quiesce thread pool to hit the timeout and shutdown + while (true) {} + } + } +} diff --git a/dev/com.ibm.ws.security.utility_fat/.classpath b/dev/com.ibm.ws.security.utility_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.security.utility_fat/.classpath.gradle b/dev/com.ibm.ws.security.utility_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.security.utility_fat/.gitignore b/dev/com.ibm.ws.security.utility_fat/.gitignore new file mode 100644 index 00000000000..3c46c3e084e --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.gitignore @@ -0,0 +1,2 @@ +/bootstrapping.properties +/publish diff --git a/dev/com.ibm.ws.security.utility_fat/.project b/dev/com.ibm.ws.security.utility_fat/.project new file mode 100755 index 00000000000..0f96aa7f641 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.security.utility_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..f48ecd6cc60 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c92277a371a --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.security.utility_fat/bnd.bnd b/dev/com.ibm.ws.security.utility_fat/bnd.bnd new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.security.utility_fat/bnd.bnd.gradle b/dev/com.ibm.ws.security.utility_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.security.utility_fat/build-test.xml b/dev/com.ibm.ws.security.utility_fat/build-test.xml new file mode 100755 index 00000000000..759686ab2f8 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/build-test.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.security.utility_fat/build.gradle b/dev/com.ibm.ws.security.utility_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/FATSuite.java b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/FATSuite.java new file mode 100755 index 00000000000..f111fd394c7 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/FATSuite.java @@ -0,0 +1,25 @@ +package com.ibm.ws.security.utility.test; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ SecurityUtilityEncodeTest.class }) +/** + * Purpose: This suite collects and runs all known good test suites. + */ +public class FATSuite { + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityEncodeTest.java b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityEncodeTest.java new file mode 100755 index 00000000000..44cc52e2c12 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityEncodeTest.java @@ -0,0 +1,122 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.security.utility.test; + +import java.util.Arrays; +import java.util.List; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class SecurityUtilityEncodeTest { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("PasswordUtilityEncodeTest"); + private final static String CUSTOM_PASSWORD_ENCRYPTION_BUNDLE_NAME = "com.ibm.websphere.crypto.sample.customencryption_1.0"; + private final static String CUSTOM_PASSWORD_ENCRYPTION_FEATURE_NAME = "customEncryption-1.0"; + private final static String CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_ROOT = "bin/tools/extensions"; + private final static String CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_PATH = CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_ROOT + "/ws-customPasswordEncryption"; + private final static String CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_NAME = "customEncryption.jar"; + private final static String PROPERTY_KEY_INSTALL_DIR = "install.dir"; + private static String installDir = null; + + /** + * Updates the sample, which is expected to be at the hard-coded path. + * If this test is failing, check this path is correct. + */ + @BeforeClass + public static void setUp() throws Exception { + server.installUserBundle(CUSTOM_PASSWORD_ENCRYPTION_BUNDLE_NAME); + server.installUserFeature(CUSTOM_PASSWORD_ENCRYPTION_FEATURE_NAME); + server.installUserFeatureL10N(CUSTOM_PASSWORD_ENCRYPTION_FEATURE_NAME); + server.copyFileToLibertyInstallRoot(CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_PATH, CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_NAME); + installDir = System.setProperty(PROPERTY_KEY_INSTALL_DIR, server.getInstallRoot()); + } + + @AfterClass + public static void tearDown() throws Exception { + server.uninstallUserBundle(CUSTOM_PASSWORD_ENCRYPTION_BUNDLE_NAME); + server.uninstallUserFeature(CUSTOM_PASSWORD_ENCRYPTION_FEATURE_NAME); + server.uninstallUserFeatureL10N(CUSTOM_PASSWORD_ENCRYPTION_FEATURE_NAME); + server.deleteDirectoryFromLibertyInstallRoot(CUSTOM_PASSWORD_ENCRYPTION_EXTENSION_ROOT); + if (installDir == null) { + System.clearProperty(PROPERTY_KEY_INSTALL_DIR); + } else { + System.setProperty(PROPERTY_KEY_INSTALL_DIR, installDir); + } + } + + /** + * Tests that the help text contains the custom encryption feature name + * if the custom password encryption is installed. + */ + @Test + public void testCustomHelp() throws Exception { + // load custom.. + List output = SecurityUtilityScriptUtils.execute(null, Arrays.asList("help", "encode")); + Assert.assertTrue("Help for encode should contain custom encoding feature name.", + SecurityUtilityScriptUtils.findMatchingLine(output, "\\s*usr:customEncryption-1.0*")); + } + + /** + * Tests that the listCustom option + */ + @Test + public void testListCustom() throws Exception { + String expected = "\\[\\{\"name\"\\:\"custom\"\\,\"featurename\"\\:\"usr\\:customEncryption-1\\.0\"\\,\"description\"\\:\"this sample custom encryption code uses AES encryption with the predefined key\\.\"\\}\\]"; + + List output = SecurityUtilityScriptUtils.execute(null, Arrays.asList("encode", "--listCustom")); + Assert.assertTrue("The output contains the contents of listCustom", SecurityUtilityScriptUtils.findMatchingLine(output, expected)); + } + + /** + * Tests that the password is being encrypted by using the custom encryption. + */ + @Test + public void testCustomEncode() throws Exception { + final String textToEncode = "textToEncode"; + final String encodedText = "\\{xor\\}KzonKwswGjE8MDs6"; + final String customEncodedText = "\\{custom\\}NkshbYjxhL2z1Yc5dv\\+wDg\\=\\="; + + // make sure that the default is still xor. + List output = SecurityUtilityScriptUtils.execute(null, Arrays.asList("encode", textToEncode)); + Assert.assertTrue("encode arg result", SecurityUtilityScriptUtils.findMatchingLine(output, encodedText)); + + // Now try custom. + output = SecurityUtilityScriptUtils.execute(null, Arrays.asList("encode", "--encoding=custom", textToEncode)); + Assert.assertTrue("encode arg result", SecurityUtilityScriptUtils.findMatchingLine(output, customEncodedText)); + } + + /** + * Tests that the appropriate error is reported when the code detects the error condition. + * Some negative tests have done by the bvt, so in here run some additional test to broaden the coverage. + * The English locale is used for this test since the error messages might be translated. + */ + @Test + public void testEncodeError() throws Exception { + final String invalidArgument = "Error: Invalid argument --unknown."; + final String invalidAlgorithm = "com.ibm.websphere.crypto.UnsupportedCryptoAlgorithmException"; + + // check invalid argument error. + List output = SecurityUtilityScriptUtils.execute(Arrays.asList(new SecurityUtilityScriptUtils.EnvVar("JVM_ARGS", "-Duser.language=en")), + Arrays.asList("encode", "--unknown=invalid", "aaa"), true); + Assert.assertTrue("The invalid argument message should be reported.", SecurityUtilityScriptUtils.findMatchingLine(output, invalidArgument)); + + // check invalid encoding error. + output = SecurityUtilityScriptUtils.execute(Arrays.asList(new SecurityUtilityScriptUtils.EnvVar("JVM_ARGS", "-Duser.language=en")), + Arrays.asList("encode", "--encoding=invalid", "aaa"), true); + Assert.assertTrue("The UnsupportedCryptoAlgorithmException should be reported.", SecurityUtilityScriptUtils.findMatchingLine(output, invalidAlgorithm)); + } +} diff --git a/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityScriptUtils.java b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityScriptUtils.java new file mode 100755 index 00000000000..9c03e24fbd1 --- /dev/null +++ b/dev/com.ibm.ws.security.utility_fat/fat/src/com/ibm/ws/security/utility/test/SecurityUtilityScriptUtils.java @@ -0,0 +1,166 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.security.utility.test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.regex.Pattern; + +public class SecurityUtilityScriptUtils { + /** + * Install directory property set by bvt.xml. + */ + private static final String WLP_INSTALL_DIR = System.getProperty("install.dir"); + + /** + * True if running on Windows and the .bat file should be used. + */ + private static final boolean isWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win"); + + /** + * Environment variable that can be set to test the UNIX script on Windows. + */ + private static final String WLP_CYGWIN_HOME = System.getenv("WLP_CYGWIN_HOME"); + + protected static class EnvVar { + String name; + final String value; + + EnvVar(String name, String value) { + this.name = name; + this.value = value; + } + } + + protected static List execute(List envVars, List args) throws IOException, InterruptedException { + return execute(envVars, args, false); + } + + protected static List execute(List envVars, List args, boolean ignoreError) throws IOException, InterruptedException { + if (envVars == null) { + envVars = Collections.emptyList(); + } + + List command = new ArrayList(); + if (isWindows && WLP_CYGWIN_HOME == null) { + command.add(WLP_INSTALL_DIR + "/bin/securityUtility.bat"); + } else { + if (WLP_CYGWIN_HOME == null) { + command.add("/bin/sh"); + } else { + command.add(WLP_CYGWIN_HOME + "/bin/sh"); + } + command.add("-x"); + command.add(WLP_INSTALL_DIR + "/bin/securityUtility"); + } + command.addAll(args); + + System.out.println("Executing " + command); + for (EnvVar envVar : envVars) { + System.out.println(" " + envVar.name + '=' + envVar.value); + } + + ProcessBuilder builder = new ProcessBuilder(); + builder.command(command); + for (EnvVar envVar : envVars) { + builder.environment().put(envVar.name, envVar.value); + } + + final Process p = builder.start(); + List output = new ArrayList(); + + Thread stderrCopier = new Thread(new OutputStreamCopier(p.getErrorStream(), output)); + stderrCopier.start(); + new OutputStreamCopier(p.getInputStream(), output).run(); + + stderrCopier.join(); + p.waitFor(); + + if (!ignoreError) { + int exitValue = p.exitValue(); + if (exitValue != 0) { + throw new IOException(command.get(0) + " failed (" + exitValue + "): " + output); + } + } + + return output; + } + + private static class OutputStreamCopier implements Runnable { + private final InputStream in; + private final List output; + + OutputStreamCopier(InputStream in, List lines) { + this.in = in; + this.output = lines; + } + + @Override + public void run() { + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + boolean inEval = false; + int carryover = 0; + + for (String line; (line = reader.readLine()) != null;) { + // Filter empty lines and sh -x trace output. + if (inEval) { + System.out.println("(trace eval) " + line); + if (line.trim().equals("'")) { + inEval = false; + } + } else if (line.equals("+ eval '")) { + inEval = true; + System.out.println("(trace eval) " + line); + } else if (carryover > 0) { + carryover--; + System.out.println("(trace) " + line); + } else if (line.startsWith("+") || line.equals("'")) { + int index = 0; + index = line.indexOf("+", index + 1); + while (index != -1) { + index = line.indexOf("+", index + 1); + carryover++; + } + System.out.println("(trace) " + line); + } else if (!line.isEmpty()) { + synchronized (output) { + output.add(line); + } + System.out.println(line); + } + } + } catch (IOException ex) { + throw new Error(ex); + } + } + } + + protected static boolean findMatchingLine(List lines, String regex) { + Pattern pattern = Pattern.compile(regex); + for (String line : lines) { + if (pattern.matcher(line).matches()) { + System.out.println("Found line matching regex " + regex + ": " + line); + return true; + } + } + + System.out.println("Did not find line matching " + regex); + return false; + } +} diff --git a/dev/com.ibm.ws.threading_fat/.classpath b/dev/com.ibm.ws.threading_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.threading_fat/.classpath.gradle b/dev/com.ibm.ws.threading_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.threading_fat/.gitignore b/dev/com.ibm.ws.threading_fat/.gitignore new file mode 100644 index 00000000000..27e131e35a6 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.threading_fat/.project b/dev/com.ibm.ws.threading_fat/.project new file mode 100755 index 00000000000..6a2c872c2af --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.threading_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..f48ecd6cc60 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,280 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +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_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..c92277a371a --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/com.ibm.ws.threading_fat/bnd.bnd b/dev/com.ibm.ws.threading_fat/bnd.bnd new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.threading_fat/bnd.bnd.gradle b/dev/com.ibm.ws.threading_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.threading_fat/build-test.xml b/dev/com.ibm.ws.threading_fat/build-test.xml new file mode 100755 index 00000000000..fca9f1ee710 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/build-test.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/build.gradle b/dev/com.ibm.ws.threading_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.threading_fat/delivery.sets b/dev/com.ibm.ws.threading_fat/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/FATSuite.java b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/FATSuite.java new file mode 100755 index 00000000000..1330a7c7d0a --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/FATSuite.java @@ -0,0 +1,75 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.threading.fat; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Collection of all example tests + */ +@RunWith(Suite.class) +/* + * The classes specified in the @SuiteClasses annotation + * below should represent all of the test cases for this FAT. + */ +@SuiteClasses({ ThreadingExtensionFAT.class, MemLeakTest.class }) +public class FATSuite { + static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.threading_fat_server"); + + /** + * Installs any custom features necessary for this test. + * + * @throws Exception + */ + @BeforeClass + public static void installTestFeatures() throws Exception { + server.copyFileToLibertyInstallRoot("lib/features/", "features/threadingTestFeature-1.0.mf"); + assertTrue("threadingTestFeature-1.0.mf should have been copied to lib/features", + server.fileExistsInLibertyInstallRoot("lib/features/threadingTestFeature-1.0.mf")); + server.copyFileToLibertyInstallRoot("lib/", "bundles/test.bundle.threading_1.0.0.jar"); + assertTrue("test.bundle.threading_1.0.0.jar should have been copied to lib", + server.fileExistsInLibertyInstallRoot("lib/test.bundle.threading_1.0.0.jar")); + + server.copyFileToLibertyInstallRoot("lib/features/", "features/threadingMemLeakTestFeature-1.0.mf"); + assertTrue("threadingMemLeakTestFeature-1.0.mf should have been copied to lib/features", + server.fileExistsInLibertyInstallRoot("lib/features/threadingMemLeakTestFeature-1.0.mf")); + server.copyFileToLibertyInstallRoot("lib/", "bundles/test.bundle.threading.memleak_1.0.0.jar"); + assertTrue("test.bundle.threading.memleak_1.0.0.jar should have been copied to lib", + server.fileExistsInLibertyInstallRoot("lib/test.bundle.threading.memleak_1.0.0.jar")); + } + + @AfterClass + public static void removeTestFeatures() throws Exception { + server.deleteFileFromLibertyInstallRoot("lib/features/threadingTestFeature-1.0.mf"); + assertFalse("Failed to clean up installed file: lib/features/threadingTestFeature-1.0.mf", + server.fileExistsInLibertyInstallRoot("lib/features/threadingTestFeature-1.0.mf")); + server.deleteFileFromLibertyInstallRoot("lib/test.bundle.threading_1.0.0.jar"); + assertFalse("Failed to clean up installed file: lib/test.bundle.threading_1.0.0.jar", server.fileExistsInLibertyInstallRoot("lib/test.bundle.threading_1.0.0.jar")); + + server.deleteFileFromLibertyInstallRoot("lib/features/threadingMemLeakTestFeature-1.0.mf"); + assertFalse("Failed to clean up installed file: lib/features/threadingMemLeakTestFeature-1.0.mf", + server.fileExistsInLibertyInstallRoot("lib/features/threadingMemLeakTestFeature-1.0.mf")); + server.deleteFileFromLibertyInstallRoot("lib/test.bundle.threading.memleak_1.0.0.jar"); + assertFalse("Failed to clean up installed file: lib/test.bundle.threading.memleak_1.0.0.jar", + server.fileExistsInLibertyInstallRoot("lib/test.bundle.threading.memleak_1.0.0.jar")); + } +} diff --git a/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/MemLeakTest.java b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/MemLeakTest.java new file mode 100755 index 00000000000..29d28bbc230 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/MemLeakTest.java @@ -0,0 +1,94 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.threading.fat; + +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.custom.junit.runner.Mode; +import componenttest.custom.junit.runner.Mode.TestMode; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +@Mode(TestMode.FULL) +public class MemLeakTest { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.threading.memleak_fat_server"); + private static final Class c = MemLeakTest.class; + + @BeforeClass + public static void beforeClass() throws Exception { + final String method = "beforeClass"; + Log.entering(c, method); + + boolean serverWasStarted = false; + + if (server != null && !server.isStarted()) { + server.startServer(); + serverWasStarted = true; + } + + Log.exiting(c, method, serverWasStarted); + } + + @AfterClass + public static void afterClass() throws Exception { + final String method = "afterClass"; + Log.entering(c, method); + + boolean serverWasStopped = false; + + if (server != null && server.isStarted()) { + server.stopServer(); + serverWasStopped = true; + } + + Log.exiting(c, method, serverWasStopped); + } + + /** + * Starting the server with this configuration memLeakTest=true will enabled the + * MemLeakChecker class to activate and run tests to see if we are leaking memory. + * + * This test checks to see if we leak memory by scheduling and then canceling + * a large number of tasks. + */ + @Test + public void testScheduleCancel() throws Exception { + final String method = "testScheduleCancel"; + Log.entering(c, method); + + assertNotNull("Expected message indicating the test passed on the server was not found.", server.waitForStringInLog("runScheduleCancelTest PASSED")); + + Log.exiting(c, method); + } + + /** + * Starting the server with this configuration memLeakTest=true will enabled the + * MemLeakChecker class to activate and run tests to see if we are leaking memory. + * + * This test checks to see if we leak memory by scheduling and then running + * a large number of tasks. + */ + @Test + public void testScheduleExecute() throws Exception { + final String method = "testScheduleExecute"; + Log.entering(c, method); + + assertNotNull("Expected message indicating the test passed on the server was not found.", server.waitForStringInLog("runScheduleExecuteTest PASSED")); + + Log.exiting(c, method); + } +} diff --git a/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/ThreadingExtensionFAT.java b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/ThreadingExtensionFAT.java new file mode 100755 index 00000000000..e30a1c5b357 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/fat/src/com/ibm/ws/threading/fat/ThreadingExtensionFAT.java @@ -0,0 +1,128 @@ +package com.ibm.ws.threading.fat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ThreadingExtensionFAT { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.threading_fat_server"); + private static String threadingTestServletURL = "http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/threadingtestapp/ThreadingTestServlet"; + private final Class c = ThreadingExtensionFAT.class; + + @Before + public void beforeTest() throws Exception { + final String method = "beforeTest"; + Log.entering(c, method); + + boolean serverWasStarted = false; + + if (server != null && !server.isStarted()) { + server.startServer(); + serverWasStarted = true; + } + + Log.exiting(c, method, serverWasStarted); + } + + @After + public void afterTest() throws Exception { + final String method = "afterTest"; + Log.entering(c, method); + + boolean serverWasStopped = false; + + if (server != null && server.isStarted()) { + server.stopServer(); + serverWasStopped = true; + } + + Log.exiting(c, method, serverWasStopped); + } + + /** + * Verifies that registering a java.util.concurrent.ThreadFactory implementation into the + * OSGi registry with property "com.ibm.ws.threading.defaultExecutorThreadFactory=true" + * results in all default executor threads being created by that factory. The test + * ThreadFactory that we registered prefixes the thread name of every thread it creates + * with "com.ibm.ws.threading_fat_ThreadFactoryImpl". The test servlet returns the name + * of the thread it executed on. We just need to invoke the servlet and verify that the + * returned thread name matches one created by our factory. + */ + @Test + public void testThreadFactoryExtension() throws Exception { + final String method = "testThreadFactoryExtension"; + Log.entering(c, method); + + String line = invokeURL(threadingTestServletURL).readLine(); + + Log.info(c, method, "Return data from test servlet: " + line); + + assertTrue("The response did not start with com.ibm.ws.threading_fat_ThreadFactoryImpl-thread-", line.startsWith("com.ibm.ws.threading_fat_ThreadFactoryImpl-thread-")); + + Log.exiting(c, method); + } + + /** + * Verifies that registering a com.ibm.wsspi.threading.ExecutorServiceTaskInterceptor implementation + * into the OSGi service registry results in all tasks submitted to the executor being wrapped by + * our interceptor. To verify this, we invoke a test URL (just to get work run) and then look in the + * log for System.out.printlns printed by a task created by our interceptor. + */ + @Test + public void testTaskInterceptorExtension() throws Exception { + final String method = "testTaskInterceptorExtension"; + Log.entering(c, method); + + invokeURL(threadingTestServletURL).readLine(); + + // verify that the task interceptor ran by looking for the System.out.printlns it puts in the server log + assertTrue("Did not find 'com.ibm.ws.threading_fat_beforeTask' in log file", server.findStringsInLogs("com.ibm.ws.threading_fat_beforeTask").size() > 0); + assertTrue("Did not find 'com.ibm.ws.threading_fat_afterTask' in log file", server.findStringsInLogs("com.ibm.ws.threading_fat_afterTask").size() > 0); + + Log.exiting(c, method); + } + + /** + * Invokes the specified URL and returns a BufferedReader to the returned content. + * + * @param urlString The URL to invoke + * @return a BufferedReader to the content returned from the invoked URL + * @throws Exception + */ + private BufferedReader invokeURL(String urlString) throws Exception { + final String method = "invokeURL"; + Log.entering(c, method, urlString); + + HttpURLConnection con = (HttpURLConnection) new URL(urlString).openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream())); + + Log.exiting(c, method, br); + return br; + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/publish/.gitignore b/dev/com.ibm.ws.threading_fat/publish/.gitignore new file mode 100644 index 00000000000..0968b1bceb6 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.threading_fat/publish/files/.gitignore b/dev/com.ibm.ws.threading_fat/publish/files/.gitignore new file mode 100644 index 00000000000..0968b1bceb6 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/files/.gitignore @@ -0,0 +1 @@ +/bundles diff --git a/dev/com.ibm.ws.threading_fat/publish/files/features/threadingMemLeakTestFeature-1.0.mf b/dev/com.ibm.ws.threading_fat/publish/files/features/threadingMemLeakTestFeature-1.0.mf new file mode 100755 index 00000000000..2fa190b772f --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/files/features/threadingMemLeakTestFeature-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: threadingMemLeakTestFeature-1.0 +Subsystem-SymbolicName: test.feature.threading.threadingMemLeakTestFeature-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Content: test.bundle.threading.memleak; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/publish/files/features/threadingTestFeature-1.0.mf b/dev/com.ibm.ws.threading_fat/publish/files/features/threadingTestFeature-1.0.mf new file mode 100755 index 00000000000..265855017dc --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/files/features/threadingTestFeature-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName: threadingTestFeature-1.0 +Subsystem-SymbolicName: test.feature.threading.threadingTestFeature-1.0; visibility:=public +Subsystem-Version: 1.0 +Subsystem-Content: test.bundle.threading; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/bootstrap.properties b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/server.xml b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/server.xml new file mode 100755 index 00000000000..62b6b2d12fb --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading.memleak_fat_server/server.xml @@ -0,0 +1,9 @@ + + + servlet-3.0 + threadingMemLeakTestFeature-1.0 + + + + + diff --git a/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/.gitignore b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/.gitignore new file mode 100644 index 00000000000..f3f483d82c0 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/.gitignore @@ -0,0 +1 @@ +/dropins diff --git a/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/bootstrap.properties b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/server.xml b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/server.xml new file mode 100755 index 00000000000..6397d1f4318 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/publish/servers/com.ibm.ws.threading_fat_server/server.xml @@ -0,0 +1,9 @@ + + + servlet-3.0 + threadingTestFeature-1.0 + + + + + diff --git a/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/.gitignore b/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/.gitignore new file mode 100644 index 00000000000..e47e1b33a74 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/.gitignore @@ -0,0 +1 @@ +/resources diff --git a/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/src/web/ThreadingTestServlet.java b/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/src/web/ThreadingTestServlet.java new file mode 100755 index 00000000000..e5033c6a803 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-applications/threadingtestapp/src/web/ThreadingTestServlet.java @@ -0,0 +1,46 @@ +package web; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Servlet implementation class TestServlet + */ +@WebServlet("/ThreadingTestServlet") +public class ThreadingTestServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public ThreadingTestServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + doGetPost(request, response); + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + doGetPost(request, response); + } + + private void doGetPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + System.out.println("IBMDEBUG: Servlet invoked!"); + response.getOutputStream().println(Thread.currentThread().getName()); + response.flushBuffer(); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/bnd.bnd b/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/bnd.bnd new file mode 100755 index 00000000000..7d72acf85fb --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/bnd.bnd @@ -0,0 +1,12 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: ThreadingMemLeakTestBundle +Bundle-SymbolicName: test.bundle.threading.memleak; singleton:=true +Bundle-Description: Bundle that tests that Liberty's threading model - particularly the ScheduledExecutorService - does not leak things like classloaders + +Export-Package: test.bundle.threading + +-dsannotations=test.bundle.threading.MemLeakChecker \ No newline at end of file diff --git a/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/src/test/bundle/threading/MemLeakChecker.java b/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/src/test/bundle/threading/MemLeakChecker.java new file mode 100755 index 00000000000..381597c792d --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-bundles/threadingmemleaktestbundle/src/test/bundle/threading/MemLeakChecker.java @@ -0,0 +1,144 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.bundle.threading; + +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +@Component +public class MemLeakChecker { + private static final int MAX = 10000; + + private ScheduledExecutorService scheduledExecutorService; + + @Reference + protected void setScheduledExecutorService(ScheduledExecutorService ses) { + scheduledExecutorService = ses; + } + + protected void unsetScheduledExecutorService(ScheduledExecutorService ses) { + scheduledExecutorService = null; + } + + @Activate + protected void activate() { + runScheduleCancelTest(); + runScheduleExecuteTest(); + } + + private void runScheduleCancelTest() { + List>> list = new ArrayList>>(MAX); + for (int i = 0; i < MAX; i++) { + ScheduledFuture schedFuture = scheduledExecutorService.schedule(new Task("CancelMe", i, null), 10, TimeUnit.MINUTES); + list.add(new WeakReference>(schedFuture)); + if (!schedFuture.cancel(false)) { + System.out.println("Failed to cancel " + schedFuture); + return; + } + } + + gc(); + for (int i = 0; i < MAX; i++) { + WeakReference> weakRef = list.get(i); + ScheduledFuture schedFuture = weakRef.get(); + if (schedFuture != null) { + System.out.println("runScheduleCancelTest FAILED - scheduledFuture[" + i + "] not GC'd"); + return; + } + } + System.out.println(scheduledExecutorService.toString() + " executed and canceled " + MAX + " tasks"); + System.out.println("runScheduleCancelTest PASSED"); + } + + private void runScheduleExecuteTest() { + // use a lower maximum since this test will actually be executing tasks + final int MAX = MemLeakChecker.MAX / 100; + + final CountDownLatch latch = new CountDownLatch(MAX); + List>> list = new ArrayList>>(MAX); + for (int i = 0; i < MAX; i++) { + ScheduledFuture schedFuture = scheduledExecutorService.schedule(new Task("RunMe", i, latch), 100, TimeUnit.MICROSECONDS); + list.add(new WeakReference>(schedFuture)); + schedFuture = null; + } + + try { + latch.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + gc(); + + for (int i = 0; i < MAX; i++) { + WeakReference> weakRef = list.get(i); + ScheduledFuture schedFuture = weakRef.get(); + if (schedFuture != null) { + System.out.println("runScheduleExecuteTest FAILED - scheduledFuture[" + i + "] not GC'd"); + return; + } + } + System.out.println("runScheduleExecuteTest PASSED"); + } + + private static void gc() { + System.gc(); + System.gc(); + Runtime.getRuntime().runFinalization(); + System.gc(); + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + System.gc(); + System.gc(); + Runtime.getRuntime().runFinalization(); + System.gc(); + } + + private static class Task implements Runnable { + private final String name; + private final int id; + private final CountDownLatch latch; + + Task(String name, int id, CountDownLatch latch) { + this.name = name; + this.id = id; + this.latch = latch; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Runnable#run() + */ + @Override + public void run() { + if (latch != null) { + latch.countDown(); + } + if (id % 1000 == 0) + System.out.println(name + id + " executed"); + + } + } +} diff --git a/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/bnd.bnd b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/bnd.bnd new file mode 100755 index 00000000000..bf496d45cb5 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/bnd.bnd @@ -0,0 +1,23 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: ThreadingTestBundle +Bundle-SymbolicName: test.bundle.threading; singleton:=true +Bundle-Description: Bundle that provides executor overrides for ThreadFactory and TaskInterceptor; version=${bVersion} + +Export-Package: test.bundle.threading + +Import-Package: com.ibm.wsspi.threading + +Private-Package: test.bundle.threading.internal.* + +Service-Component:\ + test.bundle.threading.ThreadFactoryImpl;\ + implementation:=test.bundle.threading.ThreadFactoryImpl;\ + provide:=java.util.concurrent.ThreadFactory;\ + properties:="com.ibm.ws.threading.defaultExecutorThreadFactory=true",\ + test.bundle.threading.TaskInterceptorImpl;\ + implementation:=test.bundle.threading.TaskInterceptorImpl;\ + provide:=com.ibm.wsspi.threading.ExecutorServiceTaskInterceptor diff --git a/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/TaskInterceptorImpl.java b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/TaskInterceptorImpl.java new file mode 100755 index 00000000000..ee919ef5374 --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/TaskInterceptorImpl.java @@ -0,0 +1,44 @@ +package test.bundle.threading; + +import java.util.concurrent.Callable; + +import com.ibm.wsspi.threading.ExecutorServiceTaskInterceptor; + +public class TaskInterceptorImpl implements ExecutorServiceTaskInterceptor { + @Override + public Runnable wrap(final Runnable oldTask) { + Runnable newTask = new Runnable() { + @Override + public void run() { + try { + System.out.println("com.ibm.ws.threading_fat_beforeTask"); + oldTask.run(); + } + finally { + System.out.println("com.ibm.ws.threading_fat_afterTask"); + } + } + }; + return newTask; + } + + @Override + public Callable wrap(final Callable oldTask) { + Callable newTask = new Callable() { + @Override + public T call() { + try { + System.out.println("com.ibm.ws.threading_fat_beforeTask"); + return oldTask.call(); + } + catch (Exception e) { + return null; + } + finally { + System.out.println("com.ibm.ws.threading_fat_afterTask"); + } + } + }; + return newTask; + } +} diff --git a/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/ThreadFactoryImpl.java b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/ThreadFactoryImpl.java new file mode 100755 index 00000000000..d9ae47900dc --- /dev/null +++ b/dev/com.ibm.ws.threading_fat/test-bundles/threadingtestbundle/src/test/bundle/threading/ThreadFactoryImpl.java @@ -0,0 +1,47 @@ +package test.bundle.threading; + +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicInteger; + +public class ThreadFactoryImpl implements ThreadFactory { + private final AtomicInteger createdThreadCount = new AtomicInteger(); + private final ThreadGroup threadGroup; + private final ClassLoader contextClassLoader; + + public ThreadFactoryImpl() { + this.threadGroup = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public ThreadGroup run() { + return new ThreadGroup("testThreadGroup"); + } + }); + this.contextClassLoader = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public ClassLoader run() { + return Thread.currentThread().getContextClassLoader(); + } + }); + } + + @Override + public Thread newThread(final Runnable runnable) { + int threadId = createdThreadCount.incrementAndGet(); + final String name = "com.ibm.ws.threading_fat_ThreadFactoryImpl-thread-" + threadId; + // The AccessControlContext is implicitly copied from the creating + // thread, so use doPrivileged to prevent that. + return AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Thread run() { + Thread thread = new Thread(threadGroup, runnable, name); + // The daemon, priority, and context class loader are implicitly + // copied from the creating thread, so reset them all. + thread.setDaemon(true); + thread.setPriority(Thread.NORM_PRIORITY); + thread.setContextClassLoader(contextClassLoader); + return thread; + } + }); + } +} diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/.classpath b/dev/com.ibm.ws.zos.command.processing_zfat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/.classpath.gradle b/dev/com.ibm.ws.zos.command.processing_zfat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/.project b/dev/com.ibm.ws.zos.command.processing_zfat/.project new file mode 100755 index 00000000000..ba2cb4c904a --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.zos.command.processing_zfat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..e88c46cebca --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Thu Dec 15 11:10:06 EST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.ltk.core.refactoring.prefs b/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100755 index 00000000000..5391abcacb3 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,3 @@ +#Thu Dec 15 11:56:18 EST 2011 +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd b/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd.gradle b/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd.gradle new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/build-ztest.xml b/dev/com.ibm.ws.zos.command.processing_zfat/build-ztest.xml new file mode 100755 index 00000000000..dcadaa86ac1 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/build-ztest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/build.gradle b/dev/com.ibm.ws.zos.command.processing_zfat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATSuite.java b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATSuite.java new file mode 100644 index 00000000000..fc762afc6cd --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATSuite.java @@ -0,0 +1,78 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.command.processing.zfat; + +import static org.junit.Assert.assertTrue; + +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import com.ibm.websphere.simplicity.log.Log; + +@RunWith(Suite.class) +@SuiteClasses({ FATTest.class, + ZosCommandHandlerTest.class }) +/** + * Suite. + */ +public class FATSuite { + + /** + * For use with logging + */ + private static final Class c = FATSuite.class; + // User product extension variables. + public static final String USER_FEATURE_PATH = "usr/extension/lib/features/"; + public static final String USER_BUNDLE_PATH = "usr/extension/lib"; + public static final String USER_FEATURE_PRODTEST_MF = "productExtensions/features/userProdtest-1.0.mf"; + public static final String USER_BUNDLE_JAR = "bundles/test.user.prod.extension_1.0.0.jar"; + + + /** + * Pre FAT processing. + * + * @throws Exception + */ + @BeforeClass + public static void setup() throws Exception { + final String METHOD_NAME = "setup"; + Log.info(c, METHOD_NAME, "Entry."); + + // Install user extension. + installUserProductExtension(); + + Log.info(c, METHOD_NAME, "Exit."); + } + + /** + * Installs a specific product extension if the default USR location. + * + * @throws Exception + */ + public static void installUserProductExtension() throws Exception { + String method = "installUserProductExtension"; + Log.info(c, method, "Entry. Intalling user product extension."); + + ZosCommandHandlerTest.server.copyFileToLibertyInstallRoot(USER_FEATURE_PATH, USER_FEATURE_PRODTEST_MF); + assertTrue("User product feature: " + USER_FEATURE_PRODTEST_MF + " should have been copied to: " + USER_FEATURE_PATH, + ZosCommandHandlerTest.server.fileExistsInLibertyInstallRoot(USER_FEATURE_PATH + "userProdtest-1.0.mf")); + + ZosCommandHandlerTest.server.copyFileToLibertyInstallRoot(USER_BUNDLE_PATH, USER_BUNDLE_JAR); + assertTrue("User product bundle: " + USER_BUNDLE_JAR + " should have been copied to: " + USER_BUNDLE_PATH, + ZosCommandHandlerTest.server.fileExistsInLibertyInstallRoot(USER_BUNDLE_PATH + "/test.user.prod.extension_1.0.0.jar")); + + Log.info(c, method, "Exit. User product extension using feature: " + USER_FEATURE_PRODTEST_MF + " has been installed."); + } + +} \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATTest.java b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATTest.java new file mode 100755 index 00000000000..78962dd2e73 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/FATTest.java @@ -0,0 +1,157 @@ +package com.ibm.ws.zos.command.processing.zfat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import test.common.zos.ZosOperationsFat; + +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * Verify that command processing works by default + * and that it does not with the bootstrap.properties update + */ +public class FATTest { + private static LibertyServer server = LibertyServerFactory.getLibertyServer("COM.IBM.WS.ZOS.COMMAND.PROCESSING"); + private static String serverName; + private static String installDir; + private static File pidFile; + private static String serversDir; + + /** + * For use with logging + */ + private static final Class c = FATTest.class; + private static final String WASJobName = "BBGZSRV"; + private int waitTime = 10; + private String startMsgID = "CWWKF0011I"; + + /** + * Start a server from the MVS console + * @throws Exception + */ + private void startServerViaMVS() throws Exception { + String mName = "startServerViaMVS"; + String cmd = "S " + WASJobName + ",PARMS=" + serverName; + Log.info(c, mName, "MVS Console Command: " + cmd); + new ZosOperationsFat().executeMVSConsoleCommand(cmd); + } + + /** + * Start a server + * Stop it via the MVS Console + * Verify it stopped + */ + @Test + public void testStopViaMVS() throws Exception { + String mName = "testStopViaMVS"; + + Log.info(c, mName, "Verify " + serverName + " is not running."); + assertFalse(pidFile.exists()); + + Log.info(c, mName, "Starting a new server to stop"); + startServerViaMVS(); + + Log.info(c, mName, "Verify " + serverName + " started"); + ZosOperationsFat zosOp = new ZosOperationsFat(); + String result = zosOp.waitForStringInJobLog(WASJobName, waitTime, startMsgID); + assertTrue(pidFile.exists()); + assertTrue(result != null); + + Log.info(c, mName, "Verify that we can stop server " + serverName); + zosOp.stopWASProcess(WASJobName); + assertFalse(pidFile.exists()); + } + + /** + * Update bootstrap.properties + * Start the server + * Attempt to stop it via the MVS Console + * Verify that it did not stop + */ + @Test + public void testNoStopViaMVS() throws Exception { + String mName = "testNoStopViaMVS"; + Log.info(c, mName, "Starting a new server not to stop"); + + server.copyFileToLibertyServerRoot("/NoConsole/bootstrap.properties"); + + Log.info(c, mName, "Verify " + serverName + " is not running."); + assertFalse(pidFile.exists()); + + Log.info(c, mName, "Starting a new server NOT to stop"); + startServerViaMVS(); + + + Log.info(c, mName, "Verify " + serverName + " started"); + ZosOperationsFat zosOp = new ZosOperationsFat(); + String result = zosOp.waitForStringInJobLog(WASJobName, waitTime, startMsgID); + assertTrue(pidFile.exists()); + assertTrue(result != null); + + Log.info(c, mName, "Verify that we CANNOT stop server " + serverName); + zosOp.stopWASProcess(WASJobName); + assertTrue(pidFile.exists()); + + // should still be able to cancel the job without talking to the server + zosOp.executeMVSConsoleCommand("C " + WASJobName); + + server.deleteFileFromLibertyServerRoot("bootstrap.properties"); + server.copyFileToLibertyServerRoot("/bootstrap.properties"); + } + + /** + * Prepare for test + * @throws Exception + */ + @Before + public void before() throws Exception { + String mName = "before"; + Log.info(c, mName, "Preparing for test..."); + + // precondition: no server or angel should be started. Stop if if there exist + // either + Log.info(c, mName, "Shutting down any existing angels and servers first"); + ZosOperationsFat zosOp = new ZosOperationsFat(); + zosOp.stopWASProcess(WASJobName); + zosOp.stopAngel(true); + + installDir = server.getInstallRoot(); + serverName = server.getServerName(); + serversDir = installDir + File.separatorChar + "usr" + File.separatorChar + "servers"; + String pidFileName = serversDir + File.separatorChar + ".pid" + File.separatorChar + serverName + ".pid"; + pidFile = new File(pidFileName); + Log.info(c, mName, "Expected PID file: " + pidFile.getAbsolutePath()); + } + + /** + * Cancel the server, just in case... + * + * @throws Exception + */ + @After + public void after() throws Exception { + String mName = "after"; + Log.info(c, mName, "Cleaning up..."); + new ZosOperationsFat().executeMVSConsoleCommand("C " + WASJobName); + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerTest.java b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerTest.java new file mode 100644 index 00000000000..1d55431e47f --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerTest.java @@ -0,0 +1,109 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.command.processing.zfat; + +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.zos.ZosOperationsFat; + +import com.ibm.websphere.simplicity.log.Log; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ZosCommandHandlerTest { + + private static test.common.zos.ZosOperationsFat zops = null; + + private static final Class c = ZosCommandHandlerTest.class; + + private static ZosCommandHandlerUtility util = null; + + private static String servrStcId; + + protected static LibertyServer server = LibertyServerFactory.getLibertyServer("com.ibm.ws.zos.command.feature"); + + @BeforeClass + public static void setUp() throws Exception { + Log.info(c, "setup", "Entry"); + + servrStcId = null; + + util = new ZosCommandHandlerUtility(server); + + zops = new ZosOperationsFat(); + + zops.executeMVSConsoleCommand("stop bbgzsrv"); + + Thread.sleep(5000); + + zops.executeMVSConsoleCommand("s \"bbgzsrv,parms='com.ibm.ws.zos.command.feature'\""); + servrStcId = ZosOperationsFat.waitForSTC(zops, "BBGZSRV", 10); + util.waitForOutputInLog(servrStcId, "CWWKF0011I", 10); + + + Log.info(c, "setup", "Exit"); + } + + @Test + public void testCommandHandler() throws Exception { + Log.info(c, "testCommandHandler", "Entry"); + boolean success = false; + // Test command + if (servrStcId != null && servrStcId.length() > 0) { + zops.executeMVSConsoleCommand("F \"bbgzsrv,'test.command'\""); + String servrJoblog = util.waitForOutputInLog(servrStcId, "UserProductExtensionCommandHandler_handleModify_respondingToModifyCommand: test.command", 10); + if (servrJoblog.indexOf("COMPLETED SUCCESSFULLY") >= 0) + success = true; + } else { + Log.info(c, "testCommandHandler", "unable to determine BBGZSRV job id"); + } + assertTrue("Successful completion message not found", success); + + } + + @Test + public void testCommandHandlerHelp() throws Exception { + Log.info(c, "testCommandHandlerHelp", "Entry"); + boolean success = false; + // test for help + if (servrStcId != null && servrStcId.length() > 0) { + zops.executeMVSConsoleCommand("F \"bbgzsrv,help\""); + String servrJoblog = util.waitForOutputInLog(servrStcId, "CWWKB0012I: Test Command Handler has no help.", 10); + if (servrJoblog.indexOf("CWWKB0012I: Test Command Handler has no help.") >= 0) { + success = true; + Log.info(c, "testCommandHandler", "help failed"); + } + } else { + Log.info(c, "testCommandHandlerHelp", "unable to determine BBGZSRV job id"); + } + assertTrue("Help message not found", success); + + + } + @AfterClass + public static void tearDown() { + if (zops != null) { + try { + zops.executeMVSConsoleCommand("stop bbgzsrv"); + } catch (Exception e) { + Log.info(c, "tearDown", "Error stopping server " + e.toString()); + } + } + + } + +} diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerUtility.java b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerUtility.java new file mode 100644 index 00000000000..d2dd7ab2ffc --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/fat/src/com/ibm/ws/zos/command/processing/zfat/ZosCommandHandlerUtility.java @@ -0,0 +1,78 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.command.processing.zfat; + +import com.ibm.websphere.simplicity.Machine; +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; + +/** + * + */ +public class ZosCommandHandlerUtility { + + private static final Class c = ZosCommandHandlerUtility.class; + + private final LibertyServer server; + + private static final int JOB_SEARCH_TIMEOUT = 5; // seconds + + protected ZosCommandHandlerUtility(LibertyServer server) { + this.server = server; + } + + /** + * Wait for some text to appear in a joblog / STC log, up to a timeout. + * + * @return the entire joblog + */ + protected String waitForOutputInLog(String jobId, String text, int timeoutInSeconds) throws Exception { + // This loop is somewhat silly, unfortunately. We want to loop until we have + // job output. However, sometimes the job output will seem available, but is + // not complete (sections are missing). If the caller has provided text to + // search for, we will wait to see if that text appears in the log, and if not, + // we'll keep waiting, up to our timeout. The caller still needs to check if + // that output appears in the log. + int i = 0; + String myJobLog = getRecentJoblog(jobId); + String textClue = (text != null) ? text : " "; + while (((myJobLog == null) || (myJobLog.isEmpty()) || (myJobLog.contains(textClue) == false)) + && (i++ < JOB_SEARCH_TIMEOUT)) { // give it a few seconds even though our methods are 100% foolproof + Thread.sleep(1000); + myJobLog = getRecentJoblog(jobId); + } + return myJobLog; + } + + /** + * Get joblog with jobId + * should this return ZWASJoblogReader ?? instead of String + * + * @param jobId JobID of the job + * @throws Exception + */ + private String getRecentJoblog(String jobId) throws Exception { + Log.info(c, "getJoblog", "get job log of most recent finished job"); + String joblog = null; + Machine machine = Machine.getLocalMachine(); + + if (jobId != null) { + ProgramOutput jobout = machine.execute("sysout", + new String[] { "-o", jobId }, + "/usr/local/bin"); + joblog = jobout.getStdout(); + } + return joblog; + } + +} diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/NoConsole/bootstrap.properties b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/NoConsole/bootstrap.properties new file mode 100755 index 00000000000..de6844a1cbc --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/NoConsole/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +websphere.os.extension=zosNoConsoleExtensions-1.0 \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bootstrap.properties b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bundles/.gitignore b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bundles/.gitignore new file mode 100644 index 00000000000..357e41093cc --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/bundles/.gitignore @@ -0,0 +1 @@ +/test.user.prod.extension_1.0.0.jar diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/productExtensions/features/userProdtest-1.0.mf b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/productExtensions/features/userProdtest-1.0.mf new file mode 100644 index 00000000000..c7dd53a1cd6 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/productExtensions/features/userProdtest-1.0.mf @@ -0,0 +1,7 @@ +Subsystem-ManifestVersion: 1 +IBM-ShortName:userProdtest-1.0 +Subsystem-SymbolicName: userProdtest-1.0; visibility:=public +Subsystem-Version: 1.0.0 +Subsystem-Content: test.user.prod.extension; version="[1,1.0.100)" +Subsystem-Type: osgi.subsystem.feature +IBM-Feature-Version: 2 diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/server.xml b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/server.xml new file mode 100755 index 00000000000..aa6e0aa65cd --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/files/server.xml @@ -0,0 +1,13 @@ + + + + + jsp-2.2 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/bootstrap.properties b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/server.xml b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/server.xml new file mode 100755 index 00000000000..aa6e0aa65cd --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/COM.IBM.WS.ZOS.COMMAND.PROCESSING/server.xml @@ -0,0 +1,13 @@ + + + + + jsp-2.2 + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/bootstrap.properties b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/bootstrap.properties new file mode 100644 index 00000000000..d2d997b6acb --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +ds.logLevel=debug \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/server.xml b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/server.xml new file mode 100644 index 00000000000..0163d54469e --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/publish/servers/com.ibm.ws.zos.command.feature/server.xml @@ -0,0 +1,12 @@ + + + + + + + + timedexit-1.0 + usr:userProdtest-1.0 + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/bnd.bnd b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/bnd.bnd new file mode 100644 index 00000000000..32fe637834c --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/bnd.bnd @@ -0,0 +1,20 @@ +-include= ~../../../cnf/resources/bnd/bundle.props +bVersion=1.0.0 + +# For more information, see http://was.pok.ibm.com/xwiki/bin/view/Liberty/UsingBnd + +Bundle-Name: User Product Extension Service +Bundle-SymbolicName: test.user.prod.extension; singleton:=true +Bundle-Description: This bundle provides some services to use for testing; version=${bVersion} + +# export the interface packages +Export-Package: \ + test.user.prod.extension;provide:=true + +Private-Package: test.user.prod.extension.internal.* + +Include-Resource:\ + OSGI-INF/metatype/metatype.xml=resources/metatype.xml + +-dsannotations: \ + test.user.prod.extension.internal.commandhandler.UserProductExtensionCommandHandler diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/resources/metatype.xml b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/resources/metatype.xml new file mode 100644 index 00000000000..678f1c5ea8b --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/resources/metatype.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/src/test/user/prod/extension/internal/commandhandler/UserProductExtensionCommandHandler.java b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/src/test/user/prod/extension/internal/commandhandler/UserProductExtensionCommandHandler.java new file mode 100644 index 00000000000..bbb56c9a0f8 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_zfat/test-bundles/userExtension/src/test/user/prod/extension/internal/commandhandler/UserProductExtensionCommandHandler.java @@ -0,0 +1,108 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package test.user.prod.extension.internal.commandhandler; + +import java.util.ArrayList; + +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ConfigurationPolicy; + +import com.ibm.wsspi.zos.command.processing.CommandHandler; +import com.ibm.wsspi.zos.command.processing.ModifyResults; + +/** + * User extension command handler + */ +@Component(configurationPid = "user.prod.extension.commandHandler", + configurationPolicy = ConfigurationPolicy.IGNORE, + property = { "modify.filter.regex=((?i)(test.command).*)", + "display.command.help=TRUE", + "service.vendor=IBM" }) +public class UserProductExtensionCommandHandler implements CommandHandler { + + protected String filterExpresson = null; + protected boolean getHelp = true; + + private ArrayList helpText = null; + + private final String name = "CommandHandlerTest"; + + /** + * This is the declarative services activate method. This gets driven + * when the runtime decides it actually needs our service (as opposed to + * when the bundle is activated). The metatype will be provided to us + * in the config parameter. + * + * @param cc The OSGi component context. + * @param config The configuration (metatype) + */ + protected void activate(ComponentContext cc, java.util.Map config) { + filterExpresson = (String) config.get(MODIFY_FILTER); + getHelp = Boolean.parseBoolean((String) config.get(DISPLAY_HELP)); + } + + /** + * This is the declarative services deactivate method. + * + * @param cc + */ + protected void deactivate(ComponentContext cc) { + filterExpresson = null; + getHelp = false; + } + + /** + * This is the declarative services modified method. When the + * configuration changes dynamically, this method is driven to + * give us the updated configuration. + * + * @param config The configuration (metatype). + */ + protected void modified(java.util.Map config) { + filterExpresson = (String) config.get(MODIFY_FILTER); + getHelp = Boolean.parseBoolean((String) config.get(DISPLAY_HELP)); + } + + @Override + public ArrayList getHelp() { + + if (helpText == null) { + helpText = new ArrayList(); + helpText.add("Test Command Handler has no help"); + } + return helpText; + } + + @Override + public String getName() { + return name; + } + + @Override + public void handleModify(String handle, ModifyResults mod) { + if (handle.equals("test.command")) { + ArrayList response = new ArrayList(); + response.add("UserProductExtensionCommandHandler_handleModify_respondingToModifyCommand: " + handle); + mod.setResponses(response); + mod.setCompletionStatus(ModifyResults.PROCESSED_COMMAND); + mod.setResponsesContainMSGIDs(false); + } else { + ArrayList response = new ArrayList(); + response.add("Test Failed command " + handle + " not valid"); + mod.setResponses(response); + mod.setCompletionStatus(ModifyResults.ERROR_PROCESSING_COMMAND); + mod.setResponsesContainMSGIDs(false); + } + + } +} diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.classpath b/dev/com.ibm.ws.zos.command.processing_ztest/.classpath new file mode 100644 index 00000000000..bd880329225 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.classpath.gradle b/dev/com.ibm.ws.zos.command.processing_ztest/.classpath.gradle new file mode 100644 index 00000000000..bd880329225 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.gitignore b/dev/com.ibm.ws.zos.command.processing_ztest/.gitignore new file mode 100644 index 00000000000..9c10d02b453 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.gitignore @@ -0,0 +1,4 @@ +/dist +/bundles +/lib +/*.log* diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.project b/dev/com.ibm.ws.zos.command.processing_ztest/.project new file mode 100755 index 00000000000..09a8e588f02 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.zos.command.processing_ztest + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..2d37f3472a8 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +encoding/=UTF-8 +eclipse.preferences.version=1 diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..95719ae3709 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=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_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +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_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not 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_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=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_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=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_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=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_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=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_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=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_and_in_type_parameter=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_assignment_operator=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_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=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.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=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_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=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_new_line_before_closing_brace_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_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=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_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=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_after_at_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=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_labeled_statement=do not 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_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.compact_else_if=true +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_while=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_for_increments=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_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..6da3e89478a --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.remove_trailing_whitespaces=true +cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.add_missing_nls_tags=false +org.eclipse.jdt.ui.staticondemandthreshold=99 +cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_blocks=false +sp_cleanup.make_private_fields_final=true +org.eclipse.jdt.ui.ignorelowercasenames=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.remove_private_constructors=true +sp_cleanup.never_use_parentheses_in_expressions=true +cleanup.remove_unnecessary_casts=true +sp_cleanup.organize_imports=true +sp_cleanup.never_use_blocks=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_fields=true +org.eclipse.jdt.ui.text.custom_code_templates= +cleanup.always_use_parentheses_in_expressions=false +cleanup.use_parentheses_in_expressions=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.always_use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.correct_indentation=true +cleanup.make_private_fields_final=false +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.correct_indentation=false +cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +org.eclipse.jdt.ui.ondemandthreshold=99 +sp_cleanup.sort_members_all=false +sp_cleanup.use_this_for_non_static_field_access=false +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +org.eclipse.jdt.ui.exception.name=e +sp_cleanup.format_source_code=true +org.eclipse.jdt.ui.javadoc=true +cleanup.format_source_code=false +cleanup.remove_unused_imports=true +cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_methods=true +cleanup.add_missing_annotations=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_private_methods=true +cleanup.always_use_this_for_non_static_method_access=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.sort_members=false +sp_cleanup.use_parentheses_in_expressions=false +cleanup.add_missing_override_annotations=true +org.eclipse.jdt.ui.gettersetter.use.is=false +cleanup.convert_to_enhanced_for_loop=false +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.overrideannotation=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.add_missing_annotations=true +cleanup.make_variable_declarations_final=false +cleanup.remove_unused_private_types=true +cleanup.use_blocks=true +eclipse.preferences.version=1 +cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.remove_unused_imports=true +cleanup.add_missing_deprecated_annotations=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.convert_to_enhanced_for_loop=false +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.sort_members=false +sp_cleanup.remove_unused_private_members=false +org.eclipse.jdt.ui.importorder=java;javax;org;com; +cleanup.remove_unused_private_members=false +sp_cleanup.format_source_code_changes_only=false +cleanup.never_use_blocks=false +cleanup.organize_imports=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_generated_serial_version_id=false +cleanup.make_parameters_final=true +org.eclipse.jdt.ui.keywordthis=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.always_use_blocks=true +cleanup.add_serial_version_id=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.always_use_blocks=true +cleanup.remove_unused_local_variables=false +cleanup.sort_members_all=false +sp_cleanup.remove_trailing_whitespaces=true +cleanup.format_source_code_changes_only=false +cleanup.add_generated_serial_version_id=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.remove_private_constructors=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_local_variable_final=false +cleanup.make_local_variable_final=false +sp_cleanup.add_serial_version_id=false +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.add_default_serial_version_id=false +cleanup.add_missing_methods=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.add_missing_methods=false diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd b/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd new file mode 100755 index 00000000000..fffb3bb0326 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd @@ -0,0 +1,23 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + org.eclipse.osgi;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.command.processing;version=latest diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd.gradle b/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd.gradle new file mode 100755 index 00000000000..fffb3bb0326 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/bnd.bnd.gradle @@ -0,0 +1,23 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + com.ibm.websphere.appserver.spi.kernel.service;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + org.eclipse.osgi;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.boot.nested;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.command.processing;version=latest diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/build-zunittest.xml b/dev/com.ibm.ws.zos.command.processing_ztest/build-zunittest.xml new file mode 100755 index 00000000000..78ec5e5bc1e --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/build-zunittest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/build.gradle b/dev/com.ibm.ws.zos.command.processing_ztest/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.zos.command.processing_ztest/unittest/src/com/ibm/ws/zos/command/processing/internal/UnitTest.java b/dev/com.ibm.ws.zos.command.processing_ztest/unittest/src/com/ibm/ws/zos/command/processing/internal/UnitTest.java new file mode 100755 index 00000000000..ab611834042 --- /dev/null +++ b/dev/com.ibm.ws.zos.command.processing_ztest/unittest/src/com/ibm/ws/zos/command/processing/internal/UnitTest.java @@ -0,0 +1,230 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.command.processing.internal; + +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import test.common.SharedOutputManager; +import test.common.zos.NativeLibraryUtils; +import test.common.zos.ZosOperations; + +/** + * + */ +public class UnitTest { + private static SharedOutputManager outputMgr; + private static boolean registeredWithAngel = false; + + /** + * Capture stdout/stderr output to the manager. + * + * @throws Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // There are variations of this constructor: + // e.g. to specify a log location or an enabled trace spec. Ctrl-Space + // for suggestions + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + + new ZosOperations().restartAngel(); + + NativeLibraryUtils.loadUnauthorized(); + if (!registeredWithAngel) { + registeredWithAngel = (NativeLibraryUtils.registerServer() == 0); + } + NativeLibraryUtils.registerNatives(CommandProcessor.class); + } + + /** + * Final teardown work when class is exiting. + * + * @throws Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + + NativeLibraryUtils.reset(); + + if (registeredWithAngel) { + registeredWithAngel = (NativeLibraryUtils.deregisterServer() != 0); + } + + new ZosOperations().cancelAngel(); + + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + /** + * Individual teardown after each test. + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + // Clear the output generated after each method invocation + outputMgr.resetStreams(); + } + + /** + * Test CommandProcessor.ntv_getIEZCOMReference returns a CIB + * pointer. + */ + @Test + public void test_ntv_getIEZCOMReference() { + final String m = "test_ntv_getIEZCOMReference"; + try { + // Do stuff here. The outputMgr catches all output issued to stdout + // or stderr + // unless/until an unexpected exception occurs. failWithThrowable + // will copy + // all captured output back to the original streams before failing + // the testcase. + CommandProcessor cp = new CommandProcessor(); + long iezcom = cp.ntv_getIEZCOMReference(); + assertTrue(iezcom != 0); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * Call to stop listening + * + */ + @Test + public void test_ntv_stopListeningForCommands() { + final String m = "test_ntv_stopListeningForCommands"; + try { + CommandProcessor cp = new CommandProcessor(); + long iezcom = cp.ntv_getIEZCOMReference(); + assertTrue(iezcom != 0); + cp.ntv_stopListeningForCommands(); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * To test the "Call to native code to wait for a Command" (ntv_getCommand) + * we would need another thread to issue the method and this + * thread to then monitor it. We could then either issue a + * command to break it out or issue the ntv_stopListeningForCommands + * method to break it out. + * TODO: + */ + @Ignore + @Test + public void test_ntv_getCommand() { + // TODO: + } + + /** + * Test issuing command responses + * + * + */ + @Test + public void test_ntv_issueCommandResponse() { + final String m = "test_ntv_issueCommandResponse"; + try { + CommandProcessor cp = new CommandProcessor(); + long iezcom = cp.ntv_getIEZCOMReference(); + assertTrue(iezcom != 0); + + //int ntv_issueCommandResponse(byte[] response, long cart, int consid); + + int masterConid = 1; + long cart = 0; + byte[] response = "TSTCP0001: simple message, no cart, consid(1)".getBytes("Cp1047"); + int rc = cp.ntv_issueCommandResponse(response, cart, masterConid); + assertTrue(rc == 0); + + rc = cp.ntv_issueCommandResponse((byte[]) null, cart, masterConid); + assertTrue(rc == -1); + + response = "TSTCP0003: simple message, cart(12345678), consid(1)".getBytes("Cp1047"); + rc = cp.ntv_issueCommandResponse(response, cart, masterConid); + assertTrue(rc == 0); + + cp.ntv_stopListeningForCommands(); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * Test issuing command responses + * + * + */ + @Test + public void test_ntv_issueCommandResponse_ml() { + final String m = "test_ntv_issueCommandResponse"; + try { + CommandProcessor cp = new CommandProcessor(); + long iezcom = cp.ntv_getIEZCOMReference(); + assertTrue(iezcom != 0); + + // 1 2 3 4 5 6 7 + String longMsg = "TSTCP0004I: This message should be split just about almost here, " + + "thenthenextlinewillcomeouttobesplithere " + + "becauseoftheblankIputinthetext,you know it would be nice to split " + + "near some data like this that has a lot of blanks in the line " + + " like this, the end "; + // 1 2 3 4 5 6 7 + String longMsg2 = "TSTCP0005I: extemelylongmessagetoexceedthetenlinesofMultline1234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567ENDOFTENLINES" + + "Eleventhline"; + int masterConid = 1; + long cart = 0; + byte[] response = longMsg.getBytes("Cp1047"); + int rc = cp.ntv_issueCommandResponse(response, cart, masterConid); + assertTrue(rc == 0); + + response = longMsg2.getBytes("Cp1047"); + rc = cp.ntv_issueCommandResponse(response, cart, masterConid); + assertTrue(rc == 0); + + // Generate a message that will exceed the 1,000 continuation limit. + int i = 0; + String tooLong = ""; + for (; i < 1001; i++) { + tooLong = tooLong + longMsg2; + } + response = tooLong.getBytes("Cp1047"); + rc = cp.ntv_issueCommandResponse(response, cart, masterConid); + + // Assert that we truncated the response + assertTrue(rc == -12); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } +} diff --git a/dev/com.ibm.ws.zos.logging_zfat/.classpath b/dev/com.ibm.ws.zos.logging_zfat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_zfat/.classpath.gradle b/dev/com.ibm.ws.zos.logging_zfat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_zfat/.gitignore b/dev/com.ibm.ws.zos.logging_zfat/.gitignore new file mode 100644 index 00000000000..27e131e35a6 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/com.ibm.ws.zos.logging_zfat/.project b/dev/com.ibm.ws.zos.logging_zfat/.project new file mode 100755 index 00000000000..ba8488e3ced --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.zos.logging_zfat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.zos.logging_zfat/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.zos.logging_zfat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..7341ab1683c --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd b/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd.gradle b/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd.gradle new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/com.ibm.ws.zos.logging_zfat/build-ztest.xml b/dev/com.ibm.ws.zos.logging_zfat/build-ztest.xml new file mode 100755 index 00000000000..6d67fbd4749 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/build-ztest.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_zfat/build.gradle b/dev/com.ibm.ws.zos.logging_zfat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/EbcdicUtils.java b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/EbcdicUtils.java new file mode 100755 index 00000000000..e44e0417994 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/EbcdicUtils.java @@ -0,0 +1,133 @@ +package com.ibm.ws.zos.logging.zfat; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; + +import componenttest.topology.impl.LibertyServer; + +public class EbcdicUtils { + + /** + * The given fileName is copied from the files/ dir to ${server.config.dir} + * and converted to EBCDIC. + * + * @returns the fileName (absolute path) of the ebcdic version of the file. + */ + public static String convertToEbcdic(LibertyServer server, String fileName) throws Exception { + + // Copy to server root so that the jbatch utility can find it + server.copyFileToLibertyServerRoot( fileName ); + String absFileName = StringUtils.join( Arrays.asList( server.getServerRoot(), fileName ), File.separator); + String absFileNameEbc = absFileName + ".ebc"; + + // Convert to ebcdic. + IOUtils.convertFile(absFileName, + Charset.forName("UTF-8"), + absFileNameEbc, + Charset.forName("IBM-1047")); + + return absFileNameEbc; + } + +} + +/** + * + * Could have imported apache.commons.lang3, but only needed a few methods. + */ +class StringUtils { + + /** + * @return the given strs joined on the given delim. + */ + public static String join(Collection strs, String delim) { + StringBuffer retMe = new StringBuffer(); + String d = ""; + for (String str : ( (strs != null) ? strs : new ArrayList() ) ) { + retMe.append(d).append(str); + d = delim; + } + return retMe.toString(); + } + + /** + * @return true if the string is null or "" or nothing but whitespace. + */ + public static boolean isEmpty(String s) { + return s == null || s.trim().length() == 0; + } +} + +/** + * IO utilities. + */ +class IOUtils { + + /** + * Copy the given InputStream to the given OutputStream. + * + * Note: the InputStream is closed when the copy is complete. The OutputStream + * is left open. + */ + public static void copyStream(InputStream from, OutputStream to) throws IOException { + byte buffer[] = new byte[2048]; + int bytesRead; + while ((bytesRead = from.read(buffer)) != -1) { + to.write(buffer, 0, bytesRead); + } + from.close(); + } + + /** + * Copy the given Reader to the given Writer. + * + * This method is basically the same as copyStream; however Reader and Writer + * objects are cognizant of character encoding, whereas InputStream and OutputStreams + * objects deal only with bytes. + * + * Note: the Reader is closed when the copy is complete. The Writer + * is left open. The Write is flushed when the copy is complete. + */ + public static void copyReader(Reader from, Writer to) throws IOException { + + char buffer[] = new char[2048]; + int charsRead; + while ((charsRead = from.read(buffer)) != -1) { + to.write(buffer, 0, charsRead); + } + from.close(); + to.flush(); + } + + /** + * Copy and convert from the given file and charset to the given file and charset. + * + * @return File(toFileName) + */ + public static File convertFile(String fromFileName, + Charset fromCharset, + String toFileName, + Charset toCharset) throws IOException { + + Reader reader = new InputStreamReader( new FileInputStream(fromFileName), fromCharset); + Writer writer = new OutputStreamWriter( new FileOutputStream(toFileName), toCharset) ; + + copyReader(reader, writer); + writer.close(); + + return new File(toFileName); + } + +} diff --git a/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/FATSuite.java b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/FATSuite.java new file mode 100755 index 00000000000..2fb8c1242ee --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/FATSuite.java @@ -0,0 +1,45 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2015 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.logging.zfat; + +import static org.junit.Assert.assertNotNull; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import componenttest.topology.impl.LibertyServer; + +/** + * Collection of all example tests + */ +@RunWith(Suite.class) +/* + * The classes specified in the @SuiteClasses annotation + * below should represent all of the test cases for this FAT. + */ +@SuiteClasses( { ZosLoggingTest.class }) +public class FATSuite { + + /** + * Wait for the "smarter planet" message in the log. + * + * Note: this method resets the log marks before searching the log. + */ + public static void waitForSmarterPlanet(LibertyServer server) { + + server.resetLogMarks(); + assertNotNull("The CWWKF0011I smarter planet message not found for server: " + server.getServerRoot(), + server.waitForStringInLog("CWWKF0011I")); + } + +} diff --git a/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/ZosLoggingTest.java b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/ZosLoggingTest.java new file mode 100755 index 00000000000..452fbabdafb --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/fat/src/com/ibm/ws/zos/logging/zfat/ZosLoggingTest.java @@ -0,0 +1,366 @@ +package com.ibm.ws.zos.logging.zfat; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011, 2016 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.List; + +import org.junit.BeforeClass; +import org.junit.Test; + +import test.common.zos.ZosOperationsFat; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.RemoteFile; +import com.ibm.websphere.simplicity.log.Log; +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +/** + * + */ +public class ZosLoggingTest { + + /** + * Default server. + */ + private static LibertyServer server = LibertyServerFactory.getLibertyServer("defaultServer"); + + /** + * z/OS Operations utility class instance. + */ + private static ZosOperationsFat zosOperationsFat = new ZosOperationsFat(); + + /** + * Default server job name. + */ + private static final String SERVER_JOBNAME_DEFAULT = "BBGZSRV"; + + /** + * Custom server job name. + */ + private static final String SERVER_JOBNAME_CUSTOM1 = "BBGZSRV1"; + + /** + * Log helper. + */ + private static void log(String method, String msg) { + Log.info(ZosLoggingTest.class, method, msg); + } + + /** + * Pre-FAT execution setup. + * + * @throws Exception + */ + @BeforeClass + public static void setUp() throws Exception { + log("setUp", "Entry."); + + // Try to stop/cancel any active jobs left around by this or other FATs. + stopProcess(SERVER_JOBNAME_DEFAULT, 1, true); + stopProcess(SERVER_JOBNAME_CUSTOM1, 1, true); + server.stopServer(); + + log("setUp", "Exit."); + } + + /** + * + */ + @Test + public void testStartedTaskProc() throws Exception { + + String prevJobId = zosOperationsFat.getMostRecentJobId(SERVER_JOBNAME_DEFAULT); + + zosOperationsFat.startWASProcess(SERVER_JOBNAME_DEFAULT); + + try { + String newJobId = zosOperationsFat.waitForNewJobId(SERVER_JOBNAME_DEFAULT, prevJobId, 30); + + zosOperationsFat.waitForStringInJobLog(newJobId, + "CWWKF0011I: The server defaultServer is ready to run a smarter planet", + 30); + + stopProcess(SERVER_JOBNAME_DEFAULT, 30, false); + + List joblog = ZosOperationsFat.getJoblogRaw(newJobId); + + assertNotNull("Joblog is null; job must have failed to start", joblog); + + log("testStartedTaskProc", "joblog: "); + for (String s : joblog) { + log("testStartedTaskProc", s); + } + + // These are routed to hardcopy by LoggingWtoLogHandler + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKE0001I: The server defaultServer has been launched.", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKF0011I: The server defaultServer is ready to run a smarter planet.", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKB0001I: Stop command received for server defaultServer.", joblog)); + + // These are routed to hardcopy by LoggingHardcopyLogHandler + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0001I: Application userRegistry started", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0009I: The application userRegistry has stopped successfully.", joblog)); + + // Issued to STDOUT + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0001I: The server defaultServer has been launched", joblog)); + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0036I: The server defaultServer stopped after", joblog)); + } finally { + stopProcess(SERVER_JOBNAME_DEFAULT, 5, true); + } + } + + /** + * + */ + @Test + public void testSubmittedJob() throws Exception { + + String prevJobId = zosOperationsFat.getMostRecentJobId(SERVER_JOBNAME_CUSTOM1); + + ProgramOutput po = server.getMachine().execute("/bin/submit", + new String[] { EbcdicUtils.convertToEbcdic(server, "bbgzsrv1.jcl") }, + server.getServerRoot(), + null); + + try { + log("testSubmittedJob", "JCL submit: RC: " + po.getReturnCode()); + log("testSubmittedJob", "JCL submit: stdout:\n" + po.getStdout()); + log("testSubmittedJob", "JCL submit: stderr:\n" + po.getStderr()); + + assertEquals(0, po.getReturnCode()); + + String newJobId = zosOperationsFat.waitForNewJobId(SERVER_JOBNAME_CUSTOM1, prevJobId, 30); + + zosOperationsFat.waitForStringInJobLog(newJobId, + "CWWKF0011I: The server defaultServer is ready to run a smarter planet", + 30); + + stopProcess(SERVER_JOBNAME_CUSTOM1, 30, false); + + List joblog = ZosOperationsFat.getJoblogRaw(newJobId); + + assertNotNull("Joblog is null; job must have failed to start", joblog); + + log("testSubmittedJob", "joblog: "); + for (String s : joblog) { + log("testSubmittedJob", s); + } + + // These are routed to hardcopy by LoggingHardcopyLogHandler + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0001I: Application userRegistry started", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0009I: The application userRegistry has stopped successfully.", joblog)); + + // Issued to STDOUT + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0001I: The server defaultServer has been launched", joblog)); + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0036I: The server defaultServer stopped after", joblog)); + } finally { + stopProcess(SERVER_JOBNAME_CUSTOM1, 5, true); + } + } + + /** + * + */ + @Test + public void testMsgLog() throws Exception { + + String prevJobId = zosOperationsFat.getMostRecentJobId(SERVER_JOBNAME_CUSTOM1); + + ProgramOutput po = server.getMachine().execute("/bin/submit", + new String[] { EbcdicUtils.convertToEbcdic(server, "bbgzsrv1.msglog.jcl") }, + server.getServerRoot(), + null); + + try { + log("testMsgLog", "JCL submit: RC: " + po.getReturnCode()); + log("testMsgLog", "JCL submit: stdout:\n" + po.getStdout()); + log("testMsgLog", "JCL submit: stderr:\n" + po.getStderr()); + + assertEquals(0, po.getReturnCode()); + + String newJobId = zosOperationsFat.waitForNewJobId(SERVER_JOBNAME_CUSTOM1, prevJobId, 30); + + zosOperationsFat.waitForStringInJobLog(newJobId, + "CWWKF0011I: The server defaultServer is ready to run a smarter planet", + 30); + + stopProcess(SERVER_JOBNAME_CUSTOM1, 30, false); + + List joblog = ZosOperationsFat.getJoblogRaw(newJobId); + + assertNotNull("Joblog is null; job must have failed to start", joblog); + + log("testMsgLog", "joblog: "); + for (String s : joblog) { + log("testMsgLog", s); + } + + // These are routed to hardcopy by LoggingHardcopyLogHandler + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0001I: Application userRegistry started", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0009I: The application userRegistry has stopped successfully.", joblog)); + + // Issued to STDOUT + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0001I: The server defaultServer has been launched", joblog)); + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0036I: The server defaultServer stopped after", joblog)); + + // MsgLogLogHandler messages + assertTrue(zosOperationsFat.isStringInLog(" TRAS0018I: The trace state has been changed.", joblog)); + assertTrue(zosOperationsFat.isStringInLog(" CWWKB0104I: Authorized service group ", joblog)); + } finally { + stopProcess(SERVER_JOBNAME_CUSTOM1, 5, true); + } + } + + /** + * + */ + @Test + public void testMsgLogSegmented() throws Exception { + + String prevJobId = zosOperationsFat.getMostRecentJobId(SERVER_JOBNAME_CUSTOM1); + + ProgramOutput po = server.getMachine().execute("/bin/submit", + new String[] { EbcdicUtils.convertToEbcdic(server, "bbgzsrv1.msglog.segment.jcl") }, + server.getServerRoot(), + null); + + try { + log("testMsgLogSegmented", "JCL submit: RC: " + po.getReturnCode()); + log("testMsgLogSegmented", "JCL submit: stdout:\n" + po.getStdout()); + log("testMsgLogSegmented", "JCL submit: stderr:\n" + po.getStderr()); + + assertEquals(0, po.getReturnCode()); + + String newJobId = zosOperationsFat.waitForNewJobId(SERVER_JOBNAME_CUSTOM1, prevJobId, 30); + + zosOperationsFat.waitForStringInJobLog(newJobId, + "CWWKF0011I: The server defaultServer is ready to run a smarter planet", + 30); + + stopProcess(SERVER_JOBNAME_CUSTOM1, 30, false); + + List joblog = ZosOperationsFat.getJoblogRaw(newJobId); + + assertNotNull("Joblog is null; job must have failed to start", joblog); + + log("testMsgLogSegmented", "joblog: "); + for (String s : joblog) { + log("testMsgLogSegmented", s); + } + + // These are routed to hardcopy by LoggingHardcopyLogHandler + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0001I: Application userRegistry started", joblog)); + assertTrue(zosOperationsFat.isStringInLog(newJobId + " +CWWKZ0009I: The application userRegistry has stopped successfully.", joblog)); + + // Issued to STDOUT + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0001I: The server defaultServer has been launched", joblog)); + assertTrue(zosOperationsFat.isStringInLog("[AUDIT ] CWWKE0036I: The server defaultServer stopped after", joblog)); + + // MsgLogLogHandler messages + assertTrue(zosOperationsFat.isStringInLog(" TRAS0018I: The trace state has been changed.", joblog)); + assertTrue(zosOperationsFat.isStringInLog(" CWWKB0104I: Authorized service group ", joblog)); + } finally { + stopProcess(SERVER_JOBNAME_CUSTOM1, 5, true); + } + } + + @Test + public void testMsgRouterConfig() throws Exception { + String method = "testMsgRouterConfig"; + String wtoMsg = "TRAS0042I: The message routing group WTO contains the following messages: CWWKG9999E CWWKE4445I"; + String hardcopyMsg = "TRAS0042I: The message routing group HARDCOPY contains the following messages: CWWKG3333E CWWKG4444E CWWKG6666E CWWKG7777E"; + String wtoMsg2 = "TRAS0042I: The message routing group WTO contains the following messages: CWWKE4445I"; + String hardcopyMsg2 = "TRAS0042I: The message routing group HARDCOPY contains the following messages:"; + + log(method, "Starting server with message router config"); + server.setServerConfigurationFile("msgRouterConfig.xml"); + server.startServerAndValidate(true, true, true); + try { + validateStringInLog(wtoMsg, method); + validateStringInLog(hardcopyMsg, method); + + log(method, "Changing server configuration to secondary message router config"); + server.setServerConfigurationFile("msgRouterConfig2.xml"); + validateStringInLog(wtoMsg2, method); + validateStringInLog(hardcopyMsg2, method); + + log(method, "Changing server configuration back to first message router config"); + server.setServerConfigurationFile("msgRouterConfig.xml"); + validateStringInLog(wtoMsg, method); + validateStringInLog(hardcopyMsg, method); + + dumpLogFile(method); + } finally { + server.stopServer(); + } + } + + private void validateStringInLog(String searchString, String method) throws Exception { + String match = server.waitForStringInLogUsingLastOffset(searchString); + if (match != null) { + log(method, match); + } else { + // Did not find an expected string: dump the log and fail the test + dumpLogFile(method); + server.stopServer(); + fail(method + ": Expected string was not found in server log: " + searchString); + } + } + + private void dumpLogFile(String method) throws Exception { + RemoteFile log = server.getDefaultLogFile(); + BufferedReader reader = new BufferedReader(new InputStreamReader(log.openForReading())); + String line; + while ((line = reader.readLine()) != null) { + log(method, line); + } + } + + /** + * Stops the process/job identified by the input jobname. If the process/job cannot be verified to be stopped, a cancel command is issued. + * + * @param jobName The job name that identifies the process/job to be stopped. + * @param timeout The time, in seconds, to wait for the job to become inactive. + * @param force If true, the process is cancelled after an unsuccessful stop. If False, we just print a message. + * @throws Exception + */ + private static void stopProcess(String jobName, int timeout, boolean force) throws Exception { + int iterations = (timeout <= 0) ? 1 : timeout; + + zosOperationsFat.stopWASProcess(jobName); + String activeJobId = null; + for (int i = 0; i < iterations; i++) { + activeJobId = zosOperationsFat.getActiveJobId(jobName); + + // If there is no active jobid with the specified jobname, we are done. + if (activeJobId == null) { + return; + } + + Thread.sleep(1000); + } + + // We waited for "timeout" seconds. Cancel the process or just print a message. + if (force) { + zosOperationsFat.cancelWASProcess(jobName); + } else { + Log.warning(ZosLoggingTest.class, "stopProcess: Server with jobID: " + activeJobId + " did not stop. Time waited: " + timeout + " seconds."); + } + } +} \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/.gitignore b/dev/com.ibm.ws.zos.logging_zfat/publish/.gitignore new file mode 100644 index 00000000000..343032067df --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/.gitignore @@ -0,0 +1,3 @@ +dropins +/bundles +/resourceadapters diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.jcl b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.jcl new file mode 100755 index 00000000000..56da9628201 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.jcl @@ -0,0 +1,51 @@ +//BBGZSRV1 JOB +//*------------------------------------------------------------------ +//* This proc may be overwritten by fixpacks or iFixes. +//* You must copy to another location before customizing. +//*------------------------------------------------------------------ +//* INSTDIR - the path to the WebSphere Liberty Profile install. +//* This path is used to find the product code and is +//* equivalent to the WLP_INSTALL_DIR environment variable +//* in the Unix shell. +//* USERDIR - the path to the WebSphere Liberty Profile user area. +//* This path is used to store shared and server specific +//* configuration information and is equivalent to the +//* WLP_USER_DIR environment variable in the Unix shell. +//*------------------------------------------------------------------ +// SET INSTDIR='/u/MSTONE1/wlp' +// SET USERDIR='/u/MSTONE1/wlp/usr' +//*------------------------------------------------------------------ +//* Start the Liberty server +//* +//* WLPUDIR - PATH DD that points to the Liberty Profile's "user" +//* directory. If the DD is not allocated, the user +//* directory location defaults to the wlp/usr directory +//* in the install tree. +//* STDOUT - Destination for stdout (System.out) +//* STDERR - Destination for stderr (System.err) +//* STDENV - Initial Unix environment - read by the system. The +//* installation default and server specific server +//* environment files will be merged into this environment +//* before the JVM is launched. +//*------------------------------------------------------------------ +//STEP1 EXEC PGM=BPXBATSL,REGION=0M, +// PARM='PGM &INSTDIR./lib/native/zos/s390x/bbgzsrv' +//WLPUDIR DD PATH='&USERDIR.' +//STDOUT DD SYSOUT=* +//STDERR DD SYSOUT=* +//*STDENV DD PATH='/etc/system.env',PATHOPTS=(ORDONLY) +//*STDOUT DD PATH='&ROOT/std.out', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//*STDERR DD PATH='&ROOT/std.err', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//* ================================================================ */ +//* PROPRIETARY-STATEMENT: */ +//* Licensed Material - Property of IBM */ +//* */ +//* (C) Copyright IBM Corp. 2011, 2012 */ +//* All Rights Reserved */ +//* US Government Users Restricted Rights - Use, duplication or */ +//* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.*/ +//* ================================================================ */ diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.jcl b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.jcl new file mode 100755 index 00000000000..db6a525d9f7 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.jcl @@ -0,0 +1,52 @@ +//BBGZSRV1 JOB +//*------------------------------------------------------------------ +//* This proc may be overwritten by fixpacks or iFixes. +//* You must copy to another location before customizing. +//*------------------------------------------------------------------ +//* INSTDIR - the path to the WebSphere Liberty Profile install. +//* This path is used to find the product code and is +//* equivalent to the WLP_INSTALL_DIR environment variable +//* in the Unix shell. +//* USERDIR - the path to the WebSphere Liberty Profile user area. +//* This path is used to store shared and server specific +//* configuration information and is equivalent to the +//* WLP_USER_DIR environment variable in the Unix shell. +//*------------------------------------------------------------------ +// SET INSTDIR='/u/MSTONE1/wlp' +// SET USERDIR='/u/MSTONE1/wlp/usr' +//*------------------------------------------------------------------ +//* Start the Liberty server +//* +//* WLPUDIR - PATH DD that points to the Liberty Profile's "user" +//* directory. If the DD is not allocated, the user +//* directory location defaults to the wlp/usr directory +//* in the install tree. +//* STDOUT - Destination for stdout (System.out) +//* STDERR - Destination for stderr (System.err) +//* STDENV - Initial Unix environment - read by the system. The +//* installation default and server specific server +//* environment files will be merged into this environment +//* before the JVM is launched. +//*------------------------------------------------------------------ +//STEP1 EXEC PGM=BPXBATSL,REGION=0M, +// PARM='PGM &INSTDIR./lib/native/zos/s390x/bbgzsrv' +//WLPUDIR DD PATH='&USERDIR.' +//STDOUT DD SYSOUT=* +//STDERR DD SYSOUT=* +//MSGLOG DD SYSOUT=* +//*STDENV DD PATH='/etc/system.env',PATHOPTS=(ORDONLY) +//*STDOUT DD PATH='&ROOT/std.out', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//*STDERR DD PATH='&ROOT/std.err', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//* ================================================================ */ +//* PROPRIETARY-STATEMENT: */ +//* Licensed Material - Property of IBM */ +//* */ +//* (C) Copyright IBM Corp. 2011, 2012 */ +//* All Rights Reserved */ +//* US Government Users Restricted Rights - Use, duplication or */ +//* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.*/ +//* ================================================================ */ diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.segment.jcl b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.segment.jcl new file mode 100755 index 00000000000..aab884afc53 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/files/bbgzsrv1.msglog.segment.jcl @@ -0,0 +1,52 @@ +//BBGZSRV1 JOB +//*------------------------------------------------------------------ +//* This proc may be overwritten by fixpacks or iFixes. +//* You must copy to another location before customizing. +//*------------------------------------------------------------------ +//* INSTDIR - the path to the WebSphere Liberty Profile install. +//* This path is used to find the product code and is +//* equivalent to the WLP_INSTALL_DIR environment variable +//* in the Unix shell. +//* USERDIR - the path to the WebSphere Liberty Profile user area. +//* This path is used to store shared and server specific +//* configuration information and is equivalent to the +//* WLP_USER_DIR environment variable in the Unix shell. +//*------------------------------------------------------------------ +// SET INSTDIR='/u/MSTONE1/wlp' +// SET USERDIR='/u/MSTONE1/wlp/usr' +//*------------------------------------------------------------------ +//* Start the Liberty server +//* +//* WLPUDIR - PATH DD that points to the Liberty Profile's "user" +//* directory. If the DD is not allocated, the user +//* directory location defaults to the wlp/usr directory +//* in the install tree. +//* STDOUT - Destination for stdout (System.out) +//* STDERR - Destination for stderr (System.err) +//* STDENV - Initial Unix environment - read by the system. The +//* installation default and server specific server +//* environment files will be merged into this environment +//* before the JVM is launched. +//*------------------------------------------------------------------ +//STEP1 EXEC PGM=BPXBATSL,REGION=0M, +// PARM='PGM &INSTDIR./lib/native/zos/s390x/bbgzsrv' +//WLPUDIR DD PATH='&USERDIR.' +//STDOUT DD SYSOUT=* +//STDERR DD SYSOUT=* +//MSGLOG DD SYSOUT=*,FREE=CLOSE,SPIN=(UNALLOC,1M) +//*STDENV DD PATH='/etc/system.env',PATHOPTS=(ORDONLY) +//*STDOUT DD PATH='&ROOT/std.out', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//*STDERR DD PATH='&ROOT/std.err', +//* PATHOPTS=(OWRONLY,OCREAT,OTRUNC), +//* PATHMODE=SIRWXU +//* ================================================================ */ +//* PROPRIETARY-STATEMENT: */ +//* Licensed Material - Property of IBM */ +//* */ +//* (C) Copyright IBM Corp. 2011, 2012 */ +//* All Rights Reserved */ +//* US Government Users Restricted Rights - Use, duplication or */ +//* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.*/ +//* ================================================================ */ diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig.xml b/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig.xml new file mode 100755 index 00000000000..0a099bd7f3d --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig.xml @@ -0,0 +1,10 @@ + + + jsp-2.2 + osgiConsole-1.0 + + + + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig2.xml b/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig2.xml new file mode 100755 index 00000000000..6ecc8dff624 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/files/msgRouterConfig2.xml @@ -0,0 +1,10 @@ + + + jsp-2.2 + osgiConsole-1.0 + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/bootstrap.properties b/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/bootstrap.properties new file mode 100755 index 00000000000..4bed6a27bb6 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/bootstrap.properties @@ -0,0 +1,2 @@ +bootstrap.include=../testports.properties +# osgi.console=bossxxxx:5678 \ No newline at end of file diff --git a/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/server.xml b/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/server.xml new file mode 100755 index 00000000000..b79f713d372 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_zfat/publish/servers/defaultServer/server.xml @@ -0,0 +1,8 @@ + + + jsp-2.2 + osgiConsole-1.0 + + + + diff --git a/dev/com.ibm.ws.zos.logging_ztest/.classpath b/dev/com.ibm.ws.zos.logging_ztest/.classpath new file mode 100644 index 00000000000..bd880329225 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_ztest/.classpath.gradle b/dev/com.ibm.ws.zos.logging_ztest/.classpath.gradle new file mode 100644 index 00000000000..bd880329225 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/com.ibm.ws.zos.logging_ztest/.gitignore b/dev/com.ibm.ws.zos.logging_ztest/.gitignore new file mode 100644 index 00000000000..9c10d02b453 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.gitignore @@ -0,0 +1,4 @@ +/dist +/bundles +/lib +/*.log* diff --git a/dev/com.ibm.ws.zos.logging_ztest/.project b/dev/com.ibm.ws.zos.logging_ztest/.project new file mode 100755 index 00000000000..ead8f1ae68c --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.project @@ -0,0 +1,23 @@ + + + com.ibm.ws.zos.logging_ztest + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..2d37f3472a8 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +encoding/=UTF-8 +eclipse.preferences.version=1 diff --git a/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..95719ae3709 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,286 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=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_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +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_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.comment.format_html=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not 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_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=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_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=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_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=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_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=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_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=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_and_in_type_parameter=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_assignment_operator=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_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=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.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.lineSplit=180 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=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_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=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_new_line_before_closing_brace_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_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=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_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=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_after_at_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=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_labeled_statement=do not 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_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.compact_else_if=true +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_while=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_for_increments=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_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert diff --git a/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.ui.prefs b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..6da3e89478a --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,117 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +cleanup.remove_trailing_whitespaces=true +cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.add_missing_nls_tags=false +org.eclipse.jdt.ui.staticondemandthreshold=99 +cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_blocks=false +sp_cleanup.make_private_fields_final=true +org.eclipse.jdt.ui.ignorelowercasenames=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.remove_private_constructors=true +sp_cleanup.never_use_parentheses_in_expressions=true +cleanup.remove_unnecessary_casts=true +sp_cleanup.organize_imports=true +sp_cleanup.never_use_blocks=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_fields=true +org.eclipse.jdt.ui.text.custom_code_templates= +cleanup.always_use_parentheses_in_expressions=false +cleanup.use_parentheses_in_expressions=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.always_use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.correct_indentation=true +cleanup.make_private_fields_final=false +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.correct_indentation=false +cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +org.eclipse.jdt.ui.ondemandthreshold=99 +sp_cleanup.sort_members_all=false +sp_cleanup.use_this_for_non_static_field_access=false +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +org.eclipse.jdt.ui.exception.name=e +sp_cleanup.format_source_code=true +org.eclipse.jdt.ui.javadoc=true +cleanup.format_source_code=false +cleanup.remove_unused_imports=true +cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.remove_unused_private_methods=true +cleanup.add_missing_annotations=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_private_methods=true +cleanup.always_use_this_for_non_static_method_access=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.sort_members=false +sp_cleanup.use_parentheses_in_expressions=false +cleanup.add_missing_override_annotations=true +org.eclipse.jdt.ui.gettersetter.use.is=false +cleanup.convert_to_enhanced_for_loop=false +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +org.eclipse.jdt.ui.overrideannotation=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.add_missing_annotations=true +cleanup.make_variable_declarations_final=false +cleanup.remove_unused_private_types=true +cleanup.use_blocks=true +eclipse.preferences.version=1 +cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.remove_unused_imports=true +cleanup.add_missing_deprecated_annotations=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.convert_to_enhanced_for_loop=false +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.sort_members=false +sp_cleanup.remove_unused_private_members=false +org.eclipse.jdt.ui.importorder=java;javax;org;com; +cleanup.remove_unused_private_members=false +sp_cleanup.format_source_code_changes_only=false +cleanup.never_use_blocks=false +cleanup.organize_imports=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_generated_serial_version_id=false +cleanup.make_parameters_final=true +org.eclipse.jdt.ui.keywordthis=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.always_use_blocks=true +cleanup.add_serial_version_id=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.always_use_blocks=true +cleanup.remove_unused_local_variables=false +cleanup.sort_members_all=false +sp_cleanup.remove_trailing_whitespaces=true +cleanup.format_source_code_changes_only=false +cleanup.add_generated_serial_version_id=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.remove_private_constructors=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_local_variable_final=false +cleanup.make_local_variable_final=false +sp_cleanup.add_serial_version_id=false +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.add_default_serial_version_id=false +cleanup.add_missing_methods=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.add_missing_methods=false diff --git a/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd b/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd new file mode 100755 index 00000000000..d4f9800081d --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd @@ -0,0 +1,26 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.websphere.appserver.spi.zosCommandProcessing;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.logging;version=latest diff --git a/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd.gradle b/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd.gradle new file mode 100755 index 00000000000..d4f9800081d --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/bnd.bnd.gradle @@ -0,0 +1,26 @@ +-include= ~../cnf/resources/bnd/liberty-release.props +bVersion=1.0 + +-nobundles=true + +src: \ + unittest/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/jmock-legacy.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/objenesis.jar;version=file, \ + ../build.sharedResources/lib/jmock/legacy/cglib-nodep.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.appserver.spi.logging;version=latest,\ + com.ibm.websphere.appserver.spi.zosCommandProcessing;version=latest,\ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.zos.core;version=latest,\ + com.ibm.ws.zos.logging;version=latest diff --git a/dev/com.ibm.ws.zos.logging_ztest/build-zunittest.xml b/dev/com.ibm.ws.zos.logging_ztest/build-zunittest.xml new file mode 100755 index 00000000000..49c6f1a8c59 --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/build-zunittest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/dev/com.ibm.ws.zos.logging_ztest/build.gradle b/dev/com.ibm.ws.zos.logging_ztest/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/LoggingHardcopyLogHandlerTest.java b/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/LoggingHardcopyLogHandlerTest.java new file mode 100755 index 00000000000..b88df5ea8cf --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/LoggingHardcopyLogHandlerTest.java @@ -0,0 +1,170 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.logging.internal; + +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.ws.zos.jni.NativeMethodUtils; + +import test.common.SharedOutputManager; +import test.common.zos.NativeLibraryUtils; +import test.common.zos.ZosOperations; + +/** + * + */ +public class LoggingHardcopyLogHandlerTest { + private static SharedOutputManager outputMgr; + private static Class testClass = LoggingHardcopyLogHandler.class; + private static boolean registeredWithAngel = false; + + /** + * Capture stdout/stderr output to the manager. + * + * @throws Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // There are variations of this constructor: + // e.g. to specify a log location or an enabled trace spec. Ctrl-Space + // for suggestions + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + + new ZosOperations().restartAngel(); + + NativeLibraryUtils.loadUnauthorized(); + if (!registeredWithAngel) { + registeredWithAngel = (NativeLibraryUtils.registerServer() == 0); + } + if (testClass != null) { + NativeLibraryUtils.registerNatives(testClass); + } + + } + + /** + * Final teardown work when class is exiting. + * + * @throws Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + + NativeLibraryUtils.reset(); + + if (testClass != null) { + NativeLibraryUtils.deregisterNatives(testClass); + } + + if (registeredWithAngel) { + registeredWithAngel = (NativeLibraryUtils.deregisterServer() != 0); + } + + new ZosOperations().cancelAngel(); + + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + /** + * Individual teardown after each test. + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + // Clear the output generated after each method invocation + outputMgr.resetStreams(); + } + + /** + * Test write to programmer and hardcopy + * + * + */ + @Test + public void test_ntv_WriteToOperatorProgrammerAndHardcopy() { + final String m = "test_ntv_WriteToOperatorProgrammerAndHardcopy"; + try { + LoggingHardcopyLogHandler loggingHardcopyLogHandler = new LoggingHardcopyLogHandler(); + + int rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy(NativeMethodUtils.convertToEBCDIC("CWWKF0001I: This is a programmer and hardcopy test", + false)); + assertTrue(rc == 0); + + byte[] msg = null; + rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy(msg); + assertTrue(rc == -102); + + rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy(NativeMethodUtils.convertToEBCDIC("", false)); + assertTrue(rc == 4); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * Test write to programmer and hardcopy multiple line message + * + * + */ + @Test + public void test_ntv_WriteToOperatorProgrammerAndHardcopy_ml() { + final String m = "test_ntv_WriteToOperatorProgrammerAndHardcopy_ml"; + try { + LoggingHardcopyLogHandler loggingHardcopyLogHandler = new LoggingHardcopyLogHandler(); + // 1 2 3 4 5 6 7 + String longMsg = "TSTCP0004I: This message should be split just about almost here, " + + "thenthenextlinewillcomeouttobesplithere " + + "becauseoftheblankIputinthetext,you know it would be nice to split " + + "near some data like this that has a lot of blanks in the line " + + " like this, the end "; + // 1 2 3 4 5 6 7 + String longMsg2 = "TSTCP0005I: extemelylongmessagetoexceedthetenlinesofMultline1234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567ENDOFTENLINES" + + "Eleventhline"; + int rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy((longMsg + '\0').getBytes("Cp1047")); + assertTrue(rc == 0); + + rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy((longMsg2 + '\0').getBytes("Cp1047")); + assertTrue(rc == 0); + + // Generate a message that will exceed the 1,000 continuation limit. + int i = 0; + String tooLong = ""; + for (; i < 1001; i++) { + tooLong = tooLong + longMsg2; + } + rc = loggingHardcopyLogHandler.ntv_WriteToOperatorProgrammerAndHardcopy((tooLong + '\0').getBytes("Cp1047")); + // Assert that we truncated the response + assertTrue(rc == -12); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + +} diff --git a/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/ZosLoggingBundleActivatorTest.java b/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/ZosLoggingBundleActivatorTest.java new file mode 100755 index 00000000000..57a5f42581f --- /dev/null +++ b/dev/com.ibm.ws.zos.logging_ztest/unittest/src/com/ibm/ws/zos/logging/internal/ZosLoggingBundleActivatorTest.java @@ -0,0 +1,176 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package com.ibm.ws.zos.logging.internal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ibm.ws.zos.jni.NativeMethodUtils; + +import test.common.SharedOutputManager; +import test.common.zos.NativeLibraryUtils; +import test.common.zos.ZosOperations; + +/** + * + */ +public class ZosLoggingBundleActivatorTest { + + private static SharedOutputManager outputMgr; + + /** + * Capture stdout/stderr output to the manager. + * + * @throws Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + // There are variations of this constructor: + // e.g. to specify a log location or an enabled trace spec. Ctrl-Space + // for suggestions + outputMgr = SharedOutputManager.getInstance(); + outputMgr.captureStreams(); + + new ZosOperations().restartAngel(); + + NativeLibraryUtils.loadUnauthorized(); + NativeLibraryUtils.registerServer(); + NativeLibraryUtils.registerNatives(ZosLoggingBundleActivator.class); + } + + /** + * Final teardown work when class is exiting. + * + * @throws Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + + NativeLibraryUtils.reset(); + + NativeLibraryUtils.deregisterNatives(ZosLoggingBundleActivator.class); + NativeLibraryUtils.deregisterServer(); + + new ZosOperations().cancelAngel(); + + // Make stdout and stderr "normal" + outputMgr.restoreStreams(); + } + + /** + * Individual teardown after each test. + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + // Clear the output generated after each method invocation + outputMgr.resetStreams(); + } + + /** + * Test write to operator console + * + * + */ + @Test + public void test_ntv_WriteToOperatorConsole() { + final String m = "test_ntv_WriteToOperatorConsole"; + try { + ZosLoggingBundleActivator zosLoggingBundleActivator = new ZosLoggingBundleActivator(); + + int rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole(NativeMethodUtils.convertToEBCDIC("CWWKF0000I: This is a operator console test", false)); + assertTrue(rc == 0); + + byte[] msg = null; + rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole(msg); + assertTrue(rc == -102); + + rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole(NativeMethodUtils.convertToEBCDIC("", false)); + assertTrue(rc == 4); + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * Test write to operator console multiple line message + * + * + */ + @Test + public void test_ntv_WriteToOperatorConsole_ml() { + final String m = "test_ntv_WriteToOperatorConsole_ml"; + try { + ZosLoggingBundleActivator zosLoggingBundleActivator = new ZosLoggingBundleActivator(); + // 1 2 3 4 5 6 7 + String longMsg = "TSTCP0004I: This message should be split just about almost here, " + + "thenthenextlinewillcomeouttobesplithere " + + "becauseoftheblankIputinthetext,you know it would be nice to split " + + "near some data like this that has a lot of blanks in the line " + + " like this, the end "; + // 1 2 3 4 5 6 7 + String longMsg2 = "TSTCP0005I: extemelylongmessagetoexceedthetenlinesofMultline1234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "1234567890123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567ENDOFTENLINES" + + "Eleventhline"; + int rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole((longMsg + '\0').getBytes("Cp1047")); + assertTrue(rc == 0); + + rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole((longMsg2 + '\0').getBytes("Cp1047")); + assertTrue(rc == 0); + + // Generate a message that will exceed the 1,000 continuation limit. + int i = 0; + String tooLong = ""; + for (; i < 1001; i++) { + tooLong = tooLong + longMsg2; + } + rc = zosLoggingBundleActivator.ntv_WriteToOperatorConsole((tooLong + '\0').getBytes("Cp1047")); + // Assert that we truncated the response + assertTrue(rc == -12); + + } catch (Throwable t) { + outputMgr.failWithThrowable(m, t); + } + } + + /** + * This test expects the the JVM not to have been launched as a started task. + */ + @Test + public void test_ntv_isLaunchContextShell_true() { + ZosLoggingBundleActivator zosLoggingBundleActivator = new ZosLoggingBundleActivator(); + assertTrue(zosLoggingBundleActivator.ntv_isLaunchContextShell()); + } + + /** + * The unit-testing environment does not have the MSGLOG dd defined. + */ + @Test + public void test_ntv_isMsgLogDDDefined() { + ZosLoggingBundleActivator zosLoggingBundleActivator = new ZosLoggingBundleActivator(); + assertFalse(zosLoggingBundleActivator.ntv_isMsgLogDDDefined()); + } +} diff --git a/dev/fattest.simplicity/bnd.bnd b/dev/fattest.simplicity/bnd.bnd index 980f3dc72cf..575b414813f 100755 --- a/dev/fattest.simplicity/bnd.bnd +++ b/dev/fattest.simplicity/bnd.bnd @@ -39,26 +39,27 @@ Export-Package: \ componenttest.vulnerability;version=1.0.16 -buildpath: \ - ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ - lib/com.ibm.componenttest.common.jar;version=file,\ - lib/com.ibm.ws.topology.helper.jar;version=file,\ - lib/commons-httpclient-3.1.jar;version=file,\ - lib/httpunit.jar;version=file,\ - lib/jlanclient.jar;version=file,\ - lib/jtidy-r938.jar;version=file,\ - lib/provider.api.jar;version=file,\ - lib/public.api.jar;version=file,\ - lib/remoteaccess.jar;version=file,\ - lib/shrinkwrap-api-1.2.3.jar;version=file,\ - lib/shrinkwrap-impl-base-1.2.3.jar;version=file,\ - lib/shrinkwrap-spi-1.2.3.jar;version=file,\ - lib/ssh.jar;version=file,\ - autoFVT-defaults/lib/fat.util.jar;version=file,\ - jdbc/derby/derbynet.jar;version=file,\ - ../build.sharedResources/lib/jmock/old/jmock.jar;version=file,\ - ../build.sharedResources/lib/hamcrest-all.jar;version=file,\ - ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file,\ - com.ibm.websphere.javaee.servlet.3.1;version=latest,\ - com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ - com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ - com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0;version=latest + ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ + lib/com.ibm.componenttest.common.jar;version=file,\ + lib/com.ibm.ws.topology.helper.jar;version=file,\ + lib/commons-httpclient-3.1.jar;version=file,\ + lib/httpunit.jar;version=file,\ + lib/jlanclient.jar;version=file,\ + lib/jtidy-r938.jar;version=file,\ + lib/provider.api.jar;version=file,\ + lib/public.api.jar;version=file,\ + lib/remoteaccess.jar;version=file,\ + lib/shrinkwrap-api-1.2.3.jar;version=file,\ + lib/shrinkwrap-impl-base-1.2.3.jar;version=file,\ + lib/shrinkwrap-spi-1.2.3.jar;version=file,\ + lib/ssh.jar;version=file,\ + autoFVT-defaults/lib/fat.util.jar;version=file,\ + jdbc/derby/derbynet.jar;version=file,\ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file,\ + ../build.sharedResources/lib/hamcrest-all.jar;version=file,\ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file,\ + com.ibm.websphere.javaee.servlet.3.1;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0;version=latest,\ + com.ibm.ws.jmx.connector.client.rest;version=latest diff --git a/dev/fattest.simplicity/bnd.bnd.gradle b/dev/fattest.simplicity/bnd.bnd.gradle index 612b321fc08..575b414813f 100755 --- a/dev/fattest.simplicity/bnd.bnd.gradle +++ b/dev/fattest.simplicity/bnd.bnd.gradle @@ -39,25 +39,27 @@ Export-Package: \ componenttest.vulnerability;version=1.0.16 -buildpath: \ - ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ - lib/com.ibm.componenttest.common.jar;version=file,\ - lib/com.ibm.ws.topology.helper.jar;version=file,\ - lib/commons-httpclient-3.1.jar;version=file,\ - lib/httpunit.jar;version=file,\ - lib/jlanclient.jar;version=file,\ - lib/jtidy-r938.jar;version=file,\ - lib/provider.api.jar;version=file,\ - lib/public.api.jar;version=file,\ - lib/remoteaccess.jar;version=file,\ - lib/shrinkwrap-api-1.2.3.jar;version=file,\ - lib/shrinkwrap-impl-base-1.2.3.jar;version=file,\ - lib/shrinkwrap-spi-1.2.3.jar;version=file,\ - lib/ssh.jar;version=file,\ - autoFVT-defaults/lib/fat.util.jar;version=file,\ - jdbc/derby/derbynet.jar;version=file,\ - ../build.sharedResources/lib/jmock/old/jmock.jar;version=file,\ - ../build.sharedResources/lib/hamcrest-all.jar;version=file,\ - ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file,\ - com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ - com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ - com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0;version=latest + ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ + lib/com.ibm.componenttest.common.jar;version=file,\ + lib/com.ibm.ws.topology.helper.jar;version=file,\ + lib/commons-httpclient-3.1.jar;version=file,\ + lib/httpunit.jar;version=file,\ + lib/jlanclient.jar;version=file,\ + lib/jtidy-r938.jar;version=file,\ + lib/provider.api.jar;version=file,\ + lib/public.api.jar;version=file,\ + lib/remoteaccess.jar;version=file,\ + lib/shrinkwrap-api-1.2.3.jar;version=file,\ + lib/shrinkwrap-impl-base-1.2.3.jar;version=file,\ + lib/shrinkwrap-spi-1.2.3.jar;version=file,\ + lib/ssh.jar;version=file,\ + autoFVT-defaults/lib/fat.util.jar;version=file,\ + jdbc/derby/derbynet.jar;version=file,\ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file,\ + ../build.sharedResources/lib/hamcrest-all.jar;version=file,\ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file,\ + com.ibm.websphere.javaee.servlet.3.1;version=latest,\ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.org.osgi.service.component.annotations.1.3.0;version=latest,\ + com.ibm.ws.jmx.connector.client.rest;version=latest diff --git a/dev/fattest.simplicity/src/componenttest/rules/DumpUtils.java b/dev/fattest.simplicity/src/componenttest/rules/DumpUtils.java index c87964e5905..b45e7b8a99f 100755 --- a/dev/fattest.simplicity/src/componenttest/rules/DumpUtils.java +++ b/dev/fattest.simplicity/src/componenttest/rules/DumpUtils.java @@ -5,8 +5,8 @@ * * WLP Copyright IBM Corp. 2015 * - * The source code for this program is not published or otherwise divested - * of its trade secrets, irrespective of what has been deposited with the + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the * U.S. Copyright Office. */ package componenttest.rules; @@ -44,7 +44,7 @@ import org.junit.runner.Description; import com.ibm.websphere.simplicity.log.Log; - +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; import componenttest.topology.impl.LibertyServer; /** @@ -52,11 +52,6 @@ */ public class DumpUtils { - private static final String CLIENT_DOMAIN = "com.ibm.ws.jmx.connector.client"; - private static final String REST_CLIENT_DOMAIN = "com.ibm.ws.jmx.connector.client.rest"; - private static final String DISABLE_HOSTNAME_VERIFICATION = CLIENT_DOMAIN + ".disableURLHostnameVerification"; - private static final String READ_TIMEOUT = REST_CLIENT_DOMAIN + ".readTimeout"; - private static final String CollectiveRepositoryMBean_OBJECT_NAME = "WebSphere:feature=collectiveController,type=CollectiveRepository,name=CollectiveRepository"; private static final String COLLECTIVE_DUMP_URL = "/ibm/api/collective/v1/dump"; private static final String BASIC_AUTH_CREDS = "YWRtaW46YWRtaW5wd2Q="; // base64 encoded "admin:adminpwd" if this ever changes this needs to be updated @@ -111,7 +106,7 @@ public void captureCollectiveAPIDiagnostics(final Class c, final String dumpF /** * Creates the File object, and any necessary parent directories. - * + * * @param filename The file name * @return The created File object */ @@ -152,7 +147,7 @@ public void dumpCollectiveRepository(final Class c, final String dumpFilePref /** * Tries to close the Closeable. - * + * * @param c The Closeable, may be {@code null}. */ private void close(Closeable c) { @@ -237,8 +232,8 @@ public boolean verify(String urlHostName, SSLSession session) { Map environment = new HashMap(); environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); environment.put(JMXConnector.CREDENTIALS, new String[] { adminUser, adminPassword }); - environment.put(DISABLE_HOSTNAME_VERIFICATION, true); - environment.put(READ_TIMEOUT, 2 * 60 * 1000); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); JMXServiceURL url = new JMXServiceURL("REST", "localhost", server.getHttpDefaultSecurePort(), "/IBMJMXConnectorREST"); return JMXConnectorFactory.connect(url, environment); } diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServer.java b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServer.java index c4b8ea770d5..9eeeed85e3e 100755 --- a/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServer.java +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyServer.java @@ -72,6 +72,7 @@ import org.junit.Assert; +import com.ibm.websphere.jmx.connector.rest.ConnectorSettings; import com.ibm.websphere.simplicity.LocalFile; import com.ibm.websphere.simplicity.Machine; import com.ibm.websphere.simplicity.OperatingSystem; @@ -86,6 +87,7 @@ import com.ibm.websphere.simplicity.log.Log; import com.ibm.websphere.soe_reporting.SOEHttpPostUtil; import com.ibm.ws.fat.util.ACEScanner; +import com.ibm.ws.jmx.connector.client.rest.ClientProvider; import componenttest.common.apiservices.Bootstrap; import componenttest.common.apiservices.LocalMachine; @@ -101,13 +103,6 @@ public class LibertyServer implements LogMonitorClient { protected static final Class c = LibertyServer.class; protected static final String CLASS_NAME = c.getName(); protected static Logger LOG = Logger.getLogger(CLASS_NAME); // why don't we always use the Logger directly? - - protected static final String CLIENT_DOMAIN = "com.ibm.ws.jmx.connector.client"; - protected static final String REST_CLIENT_DOMAIN = "com.ibm.ws.jmx.connector.client.rest"; - protected static final String CUSTOM_SSLSOCKETFACTORY = CLIENT_DOMAIN + ".CUSTOM_SSLSOCKETFACTORY"; - protected static final String DISABLE_HOSTNAME_VERIFICATION = CLIENT_DOMAIN + ".disableURLHostnameVerification"; - protected static final String READ_TIMEOUT = REST_CLIENT_DOMAIN + ".readTimeout"; - /** How frequently we poll the logs when waiting for something to happen */ protected static final int WAIT_INCREMENT = 300; @@ -5983,8 +5978,8 @@ public JMXConnector getJMXRestConnector(String userName, String password, String Map environment = new HashMap(); environment.put("jmx.remote.protocol.provider.pkgs", "com.ibm.ws.jmx.connector.client"); environment.put(JMXConnector.CREDENTIALS, new String[] { userName, password }); - environment.put(DISABLE_HOSTNAME_VERIFICATION, true); - environment.put(READ_TIMEOUT, 2 * 60 * 1000); + environment.put(ClientProvider.DISABLE_HOSTNAME_VERIFICATION, true); + environment.put(ClientProvider.READ_TIMEOUT, 2 * 60 * 1000); KeyStore keyStore = KeyStore.getInstance("JKS"); FileInputStream is = new FileInputStream(getServerRoot() + "/resources/security/key.jks"); @@ -5994,7 +5989,7 @@ public JMXConnector getJMXRestConnector(String userName, String password, String trustManagerFactory.init(keyStore); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustManagerFactory.getTrustManagers(), null); - environment.put(CUSTOM_SSLSOCKETFACTORY, sslContext.getSocketFactory()); + environment.put(ConnectorSettings.CUSTOM_SSLSOCKETFACTORY, sslContext.getSocketFactory()); JMXServiceURL url = new JMXServiceURL("REST", getHostname(), getHttpDefaultSecurePort(), "/IBMJMXConnectorREST"); diff --git a/dev/wlp.lib.extract_fat/.classpath b/dev/wlp.lib.extract_fat/.classpath new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/wlp.lib.extract_fat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/wlp.lib.extract_fat/.classpath.gradle b/dev/wlp.lib.extract_fat/.classpath.gradle new file mode 100644 index 00000000000..c422489df40 --- /dev/null +++ b/dev/wlp.lib.extract_fat/.classpath.gradle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/wlp.lib.extract_fat/.gitignore b/dev/wlp.lib.extract_fat/.gitignore new file mode 100644 index 00000000000..27e131e35a6 --- /dev/null +++ b/dev/wlp.lib.extract_fat/.gitignore @@ -0,0 +1 @@ +/bootstrapping.properties diff --git a/dev/wlp.lib.extract_fat/.project b/dev/wlp.lib.extract_fat/.project new file mode 100755 index 00000000000..568e8fa58b9 --- /dev/null +++ b/dev/wlp.lib.extract_fat/.project @@ -0,0 +1,23 @@ + + + wlp.lib.extract_fat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + diff --git a/dev/wlp.lib.extract_fat/.settings/org.eclipse.core.resources.prefs b/dev/wlp.lib.extract_fat/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 00000000000..25d9425fe34 --- /dev/null +++ b/dev/wlp.lib.extract_fat/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +#Ant properties +#Automatically generated by the ant prepare.settings.files task +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.core.prefs b/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..870320143e5 --- /dev/null +++ b/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,292 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +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=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=180 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=true +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +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_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=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_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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=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_try=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_semicolon_in_try_resources=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_try=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=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=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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_semicolon_in_try_resources=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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +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=180 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.ui.prefs b/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 00000000000..51bbe7fcd53 --- /dev/null +++ b/dev/wlp.lib.extract_fat/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,61 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=1 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/dev/wlp.lib.extract_fat/bnd.bnd b/dev/wlp.lib.extract_fat/bnd.bnd new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/wlp.lib.extract_fat/bnd.bnd @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/wlp.lib.extract_fat/bnd.bnd.gradle b/dev/wlp.lib.extract_fat/bnd.bnd.gradle new file mode 100644 index 00000000000..20b28a82bd2 --- /dev/null +++ b/dev/wlp.lib.extract_fat/bnd.bnd.gradle @@ -0,0 +1,28 @@ +-include= ~../cnf/resources/bnd/bundle.props +bVersion=1.0 + +src: \ + fat/src + +-buildpath: \ + ${javac.bootclasspath.java6}, \ + ../build.sharedResources/lib/junit/old/junit.jar;version=file, \ + ../build.sharedResources/lib/ws-junit/ws-junit.jar;version=file, \ + ../build.sharedResources/lib/hamcrest-all.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock-junit4.jar;version=file, \ + ../build.sharedResources/lib/jmock/old/jmock.jar;version=file, \ + fattest.simplicity;version=latest, \ + ../fattest.simplicity/lib/public.api.jar;version=file, \ + ../com.ibm.ws.kernel.boot.archive/lib/org.apache.commons.compress-1.10.jar;version=file, \ + com.ibm.websphere.org.osgi.core.6.0.0;version=latest, \ + com.ibm.websphere.org.osgi.service.cm.1.5.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component.1.3.0;version=latest,\ + com.ibm.wsspi.thirdparty.equinox;version=latest, \ + com.ibm.ws.kernel.boot.core;version=latest,\ + com.ibm.ws.kernel.service;version=latest,\ + com.ibm.ws.kernel.service.location;version=latest,\ + com.ibm.ws.logging.core;version=latest,\ + com.ibm.ws.org.eclipse.equinox.region.1.3.2;version=latest, \ + com.ibm.ws.runtime.update;version=latest, \ + com.ibm.ws.kernel.feature.core;version=latest, \ + com.ibm.ws.kernel.feature;version=latest diff --git a/dev/wlp.lib.extract_fat/build-test.xml b/dev/wlp.lib.extract_fat/build-test.xml new file mode 100755 index 00000000000..d492e74eab9 --- /dev/null +++ b/dev/wlp.lib.extract_fat/build-test.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/wlp.lib.extract_fat/build.gradle b/dev/wlp.lib.extract_fat/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/wlp.lib.extract_fat/delivery.sets b/dev/wlp.lib.extract_fat/delivery.sets new file mode 100755 index 00000000000..674398425a0 --- /dev/null +++ b/dev/wlp.lib.extract_fat/delivery.sets @@ -0,0 +1 @@ +SLE diff --git a/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/ExternalDependencyDownloadTest.java b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/ExternalDependencyDownloadTest.java new file mode 100755 index 00000000000..112c014940b --- /dev/null +++ b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/ExternalDependencyDownloadTest.java @@ -0,0 +1,338 @@ +package wlp.lib.extract; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.*; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class ExternalDependencyDownloadTest { + private static LibertyServer hostingServer = LibertyServerFactory.getLibertyServer("dependencyHostServer"); + private static final String HOST_APP_NAME = "dependencyHost"; + private static final File FILES_DIR = new File("lib/LibertyFATTestFiles/"); + private static final File SERVERS_DIR = new File("publish/servers"); + + @BeforeClass + public static void setupClass() throws Exception { + // Start the server which hosts the dependency URLs + // This runs for the whole test suite while we test installing samples which reference it + hostingServer.startServer(); + } + + @AfterClass + public static void tearDownClass() throws Exception { + if (hostingServer != null && hostingServer.isStarted()) { + hostingServer.stopServer(); + } + } + + @Test + public void testHTTP2HTTPSRedirect() throws Exception { + String serverName = "http2httpsRedirectGood"; + String dependencyTargetFile = "shared/lib/" + serverName + ".testfile.jar"; + + File tmpJar = new File(FILES_DIR, serverName + ".jar"); + if (tmpJar.exists()) { + tmpJar.delete(); + } + + String dependencyUrl = "http://search.maven.org/remotecontent?filepath=com/datastax/cassandra/cassandra-driver-core/2.0.4/cassandra-driver-core-2.0.4.jar"; + String dependencyTargetPath = "servers/" + serverName + "/" + dependencyTargetFile; + createExternalDependencySample(tmpJar, serverName, dependencyUrl, dependencyTargetPath); + tmpJar.deleteOnExit(); + + LibertyServer installServer = createEmptyServer(serverName); + installServer.installSampleWithExternalDependencies(serverName); + + assertTrue(installServer.fileExistsInLibertyServerRoot(dependencyTargetFile)); + } + + @Test + public void testInstallDependency() throws Exception { + assertGoodInstall("/good", "depGood"); + } + + @Test + public void testInstallNotFound() throws Exception { + assertBadInstall("/notfound", "depNotFound"); + } + + @Test + public void testInstallBadRequest() throws Exception { + assertBadInstall("/badrequest", "depBadRequest"); + } + + @Test + public void testInstallForbidden() throws Exception { + assertBadInstall("/forbidden", "depForbidden"); + } + + @Test + public void testInstallServerError() throws Exception { + assertBadInstall("/serverError", "depServerError"); + } + + @Test + public void testRedirect301() throws Exception { + assertGoodInstall("/redirect301", "dep301"); + } + + @Test + public void testRedirect302() throws Exception { + assertGoodInstall("/redirect302", "dep302"); + } + + @Test + public void testRedirect303() throws Exception { + assertGoodInstall("/redirect303", "dep303"); + } + + @Test + public void testRedirect307() throws Exception { + assertGoodInstall("/redirect307", "dep307"); + } + + @Test + public void testRedirectNotFound() throws Exception { + assertBadInstall("/redirectnotfound", "depRedirectNotFound"); + } + + @Test + public void testInstallProtocolRedirect() throws Exception { + assertGoodInstall("/protocolchange", "depProtoChange"); + } + + /** + * Generate a sample with the given dependency and server name and ensure that installing it fails. + * + * @param dependencyPath the path to download the dependency from, relative to the root of the dependency hosting app + * @param serverName the server name that should be included in the sample + * @throws Exception + */ + private void assertGoodInstall(String dependencyPath, String serverName) throws Exception { + String dependencyTargetFile = serverName + ".testfile"; + + prepareSampleJar(dependencyPath, serverName); + LibertyServer installServer = createEmptyServer(serverName); + + // This method uses the sample jar created above + installServer.installSampleWithExternalDependencies(serverName); + + assertTrue(installServer.fileExistsInLibertyServerRoot(dependencyTargetFile)); + } + + /** + * Generate a sample with the given dependency and server name and ensure that installing it fails. + * + * @param dependencyPath the path to download the dependency from, relative to the root of the dependency hosting app + * @param serverName the server name that should be included in the sample + * @throws Exception + */ + private void assertBadInstall(String dependencyPath, String serverName) throws Exception { + String dependencyTargetFile = serverName + ".testfile"; + + prepareSampleJar(dependencyPath, serverName); + LibertyServer installServer = createEmptyServer(serverName); + + try { + // This method uses the sample jar created above + installServer.installSampleWithExternalDependencies(serverName); + fail("Expected sample installation to fail but it did not"); + } catch (Exception e) { + // Expected exception, do nothing + } + + assertFalse(installServer.fileExistsInLibertyServerRoot(dependencyTargetFile)); + } + + /** + * Generate a simple sample with a dependency + *

+ * The sample has one external dependency which points to a path under the depedencyHost app. + * + * @param dependencyPath the path to download the dependency from, relative to the root of the dependency hosting app + * @param serverName the server name that should be included in the sample + * @throws Exception + */ + private void prepareSampleJar(String dependencyPath, String serverName) throws Exception { + File tmpJar = new File(FILES_DIR, serverName + ".jar"); + if (tmpJar.exists()) { + tmpJar.delete(); + } + + String dependencyUrl = "http://" + hostingServer.getHostname() + ":" + hostingServer.getHttpDefaultPort() + "/" + HOST_APP_NAME + dependencyPath; + String dependencyTargetFile = serverName + ".testfile"; + String dependencyTargetPath = "servers/" + serverName + "/" + dependencyTargetFile; + createExternalDependencySample(tmpJar, serverName, dependencyUrl, dependencyTargetPath); + tmpJar.deleteOnExit(); + } + + /** + * Ensure the server directory exists and create a new LibertyServer. + * + * @param serverName the name for the new server + * @return the newly created server + */ + private LibertyServer createEmptyServer(String serverName) { + File serverDir = new File(SERVERS_DIR, serverName); + serverDir.mkdirs(); + + return LibertyServerFactory.getLibertyServer(serverName); + } + + /** + * Create a new minimal sample file with the given external dependency. + *

+ * The generated sample includes + *

    + *
  • The wlp.lib.extract classes
  • + *
  • A server directory with the given name
  • + *
  • A basic server.xml from publish/files/sampleServer.xml
  • + *
  • A generated externaldependencies.xml
  • + * + * + * @param outSample the jar file to write the new sample to + * @param serverName the name of the server to include in the sample jar + * @param dependencyUrl the URL which the externaldependencies.xml file should point to + * @param dependencyTargetPath the path which the external dependency should be downloaded to + */ + private static void createExternalDependencySample(File outSample, String serverName, String dependencyUrl, String dependencyTargetPath) throws IOException { + ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outSample)); + + writeDir(out, "META-INF"); + writeFile(out, "META-INF/MANIFEST.MF", new File(FILES_DIR, "MANIFEST.MF")); + + writeExternalDependencies(out, dependencyUrl, dependencyTargetPath); + + copyArchive(out, new File(FILES_DIR, "wlp.lib.extract.zip")); + + writeDir(out, "wlp/usr"); + writeDir(out, "wlp/usr/servers"); + writeDir(out, "wlp/usr/servers/" + serverName); + writeFile(out, "wlp/usr/servers/" + serverName + "/server.xml", new File(FILES_DIR, "sampleServer.xml")); + + out.close(); + assertTrue(outSample.getAbsolutePath() + " was not created", outSample.exists()); + } + + /** + * Write a directory to an archive + * + * @param out + * @param path + * @throws IOException + */ + private static void writeDir(ZipOutputStream out, String path) throws IOException { + if (!path.endsWith("/")) { + path += "/"; + } + out.putNextEntry(new ZipEntry(path)); + } + + /** + * Read a file from disk and write it into an archive + * + * @param out + * @param path + * @param file + * @throws IOException + */ + private static void writeFile(ZipOutputStream out, String path, File file) throws IOException { + if (path.endsWith("/")) { + throw new IOException("File paths may not end with a slash"); + } + out.putNextEntry(new ZipEntry(path)); + InputStream in = new FileInputStream(file); + copyStream(out, in); + in.close(); + out.closeEntry(); + } + + /** + * Copy the contents of one archive into another archive + * + * @param out + * @param archive + * @throws IOException + */ + private static void copyArchive(ZipOutputStream out, File archive) throws IOException { + ZipInputStream in = new ZipInputStream(new FileInputStream(archive)); + ZipEntry e; + while ((e = in.getNextEntry()) != null) { + out.putNextEntry(new ZipEntry(e.getName())); + if (!e.isDirectory()) { + copyStream(out, in); + } + out.closeEntry(); + } + in.close(); + } + + /** + * Copy from an input stream into an output stream until the end of the input stream is reached. + *

    + * Does not close either stream. + * + * @param out + * @param in + * @throws IOException + */ + private static void copyStream(OutputStream out, InputStream in) throws IOException { + byte[] buf = new byte[1024]; + int count; + while ((count = in.read(buf)) != -1) { + out.write(buf, 0, count); + } + } + + /** + * Write a simple externaldependencies.xml file entry into a ZipOutputStream. + *

    + * The generated file specifies one dependency with the given url and target path. + * + * @param out the ZipOutputStream to write to + * @param dependencyUrl the URL hosting the dependency + * @param dependencyTargetPath the destination path for the dependency + * @throws IOException + */ + private static void writeExternalDependencies(ZipOutputStream out, String dependencyUrl, String dependencyTargetPath) throws IOException { + out.putNextEntry(new ZipEntry("externaldependencies.xml")); + OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8"); + writer.append("\n"); + + writer.append(" \n"); + + writer.append("\n"); + writer.flush(); + out.closeEntry(); + } +} \ No newline at end of file diff --git a/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/FATSuite.java b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/FATSuite.java new file mode 100755 index 00000000000..25bbf754ff5 --- /dev/null +++ b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/FATSuite.java @@ -0,0 +1,30 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2012 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package wlp.lib.extract; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Collection of all example tests + */ +@RunWith(Suite.class) +/* + * The classes specified in the @SuiteClasses annotation + * below should represent all of the test cases for this FAT. + */ +@SuiteClasses({ + ExternalDependencyDownloadTest.class, + PackageRunnableTest.class +}) +public class FATSuite {} diff --git a/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/PackageRunnableTest.java b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/PackageRunnableTest.java new file mode 100755 index 00000000000..b7e00c34adb --- /dev/null +++ b/dev/wlp.lib.extract_fat/fat/src/wlp/lib/extract/PackageRunnableTest.java @@ -0,0 +1,217 @@ +/* + * IBM Confidential + * + * OCO Source Materials + * + * WLP Copyright IBM Corp. 2016 + * + * The source code for this program is not published or otherwise divested + * of its trade secrets, irrespective of what has been deposited with the + * U.S. Copyright Office. + */ +package wlp.lib.extract; + +/* + * IBM Confidential + * + * OCO Source Materials + * + * Copyright IBM Corp. 2011 + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + */ +import static org.junit.Assert.*; +import static org.junit.Assume.*; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.util.Iterator; +import java.util.Map; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import componenttest.topology.impl.LibertyServer; +import componenttest.topology.impl.LibertyServerFactory; + +public class PackageRunnableTest { + private static String serverName = "runnableTestServer"; + private static LibertyServer server = LibertyServerFactory.getLibertyServer(serverName); + private static final File runnableJar = new File("publish/" + serverName + ".jar"); + private static final File extractDirectory = new File("publish" + File.separator + "wlpExtract"); + + /* + * return env as array and add WLP_JAR_EXTRACT_DIR=extractDirectory + */ + private static String[] runEnv(String extractDirectory) { + + Map envmap = System.getenv(); + Iterator iKeys = envmap.keySet().iterator(); + String[] envArray = new String[envmap.size() + 1]; + + int i = 0; + while (iKeys.hasNext()) { + String key = iKeys.next(); + String val = envmap.get(key); + envArray[i++] = key + "=" + val; + } + // add extract dir to end + String extDirVar = "WLP_JAR_EXTRACT_DIR=" + extractDirectory; + envArray[envArray.length - 1] = extDirVar; + + return envArray; + + } + + @BeforeClass + public static void setupClass() throws Exception {} + + @AfterClass + public static void tearDownClass() throws Exception {} + + @Test + public void testRunnableJar() throws Exception { + + // Doesn't work on z/OS (because you can't package into a jar on z/OS) + assumeTrue(!System.getProperty("os.name").equals("z/OS")); + + String stdout = server.executeServerScript("package", + new String[] { "--archive=" + runnableJar.getAbsolutePath(), + "--include=minify,runnable" }).getStdout(); + + String searchString = "Server " + serverName + " package complete"; + if (!stdout.contains(searchString)) { + System.out.println("Warning: test case " + PackageRunnableTest.class.getName() + " could not package server " + serverName); + return; // get out + } + + if (!extractDirectory.exists()) { + extractDirectory.mkdirs(); + } + + assertTrue("Extract directory " + extractDirectory.getAbsolutePath() + " does not exist.", extractDirectory.exists()); + + String cmd = "java -jar " + runnableJar.getAbsolutePath(); + Process proc = Runtime.getRuntime().exec(cmd, runEnv(extractDirectory.getAbsolutePath()), null); // run server + + // setup and start reader threads for error and output streams + StreamReader errorReader = new StreamReader(proc.getErrorStream(), "ERROR", null); + errorReader.start(); + StreamReader outputReader = new StreamReader(proc.getInputStream(), "OUTPUT", "CWWKF0011I"); + outputReader.start(); + + int count = 0; + + // wait up to 90 seconds to find watch for string + + boolean found = outputReader.foundWatchFor(); + while (!found && count <= 90) { + + synchronized (proc) { + proc.wait(1000); // wait 1 second + System.out.println("Waiting for server to complete initialization - " + count + " seconds elapsed."); + } + found = outputReader.foundWatchFor(); + count++; + } + + assertTrue("Server did not start successfully in time.", found); + + proc.destroy(); // ensure no process left behind + + } + + class StreamReader extends Thread + { + InputStream is; + String type; + OutputStream os; + String watchFor; + boolean foundWatchFor = false; + + StreamReader(InputStream is, String type, String watchFor) + { + this(is, type, watchFor, null); + } + + StreamReader(OutputStream os, String type, String watchFor) + { + this.os = os; + this.type = type; + this.watchFor = watchFor; + + } + + StreamReader(InputStream is, String type, String watchFor, OutputStream redirect) + { + this.is = is; + this.type = type; + this.os = redirect; + this.watchFor = watchFor; + } + + public boolean foundWatchFor() { + return foundWatchFor; + } + + @Override + public void run() + { + try { + // stdin, process stream is output + if (type.equals("INPUT")) { + runOutputStream(); + } + // else stdout, stderr, process stream is input + else { + runInputStream(); + } + } catch (IOException e) { + throw new RuntimeException(e.getMessage()); + } + } + + public void runInputStream() throws IOException { + PrintWriter pw = null; + if (os != null) + pw = new PrintWriter(os); + + InputStreamReader isr = new InputStreamReader(is, "UTF-8"); + BufferedReader br = new BufferedReader(isr); + String line = null; + while ((line = br.readLine()) != null) + { + if (pw != null) + pw.println(line); + System.out.println(line); + // if watchFor string supplied - search for it + if (watchFor != null) { + if (line.indexOf(watchFor) > -1) { + foundWatchFor = true; + } + } + + } + + if (pw != null) + pw.flush(); + } + + public void runOutputStream() throws IOException { + OutputStreamWriter osr = new OutputStreamWriter(os, "UTF-8"); + BufferedWriter br = new BufferedWriter(osr); + br.write("Y"); + } + } + +} diff --git a/dev/wlp.lib.extract_fat/publish/files/MANIFEST.MF b/dev/wlp.lib.extract_fat/publish/files/MANIFEST.MF new file mode 100755 index 00000000000..da15908105e --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/files/MANIFEST.MF @@ -0,0 +1,10 @@ +Manifest-Version: 1.0 +Ant-Version: Apache Ant 1.8.4 +Created-By: pwa6460sr11-20120806_01 (SR11) (IBM Corporation) +Applies-To: com.ibm.websphere.appserver +Archive-Root: wlp/usr/ +Bundle-Vendor: IBM +Import-Package: javax.xml.parsers,org.w3c.dom +Main-Class: wlp.lib.extract.SelfExtract +Map-Based-Self-Extractor: wlp.lib.extract.MapBasedSelfExtractor +Archive-Content-Type: sample diff --git a/dev/wlp.lib.extract_fat/publish/files/sampleServer.xml b/dev/wlp.lib.extract_fat/publish/files/sampleServer.xml new file mode 100755 index 00000000000..a88bac7394d --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/files/sampleServer.xml @@ -0,0 +1,8 @@ + + + + servlet-3.0 + + + + diff --git a/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/.gitignore b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/.gitignore new file mode 100644 index 00000000000..47ebb767c4d --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/.gitignore @@ -0,0 +1,2 @@ +/apps +/dropins diff --git a/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/bootstrap.properties b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/bootstrap.properties new file mode 100755 index 00000000000..31f32c6fd52 --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/bootstrap.properties @@ -0,0 +1 @@ +bootstrap.include=../testports.properties \ No newline at end of file diff --git a/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/server.xml b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/server.xml new file mode 100755 index 00000000000..2e841a22e05 --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/servers/dependencyHostServer/server.xml @@ -0,0 +1,9 @@ + + + servlet-3.0 + + + + + + diff --git a/dev/wlp.lib.extract_fat/publish/servers/runnableTestServer/server.xml b/dev/wlp.lib.extract_fat/publish/servers/runnableTestServer/server.xml new file mode 100755 index 00000000000..8514878d301 --- /dev/null +++ b/dev/wlp.lib.extract_fat/publish/servers/runnableTestServer/server.xml @@ -0,0 +1,8 @@ + + + + servlet-3.0 + + + + diff --git a/dev/wlp.lib.extract_fat/test-applications/dependencyHost/resources/WEB-INF/web.xml b/dev/wlp.lib.extract_fat/test-applications/dependencyHost/resources/WEB-INF/web.xml new file mode 100755 index 00000000000..14e0d231315 --- /dev/null +++ b/dev/wlp.lib.extract_fat/test-applications/dependencyHost/resources/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + + Dependency Host + This is a servlet hosts test dependencies for test samples. + + + + Dependency Host Servlet + Dependency Host Servlet + Hosts sample dependencies + web.DependencyHostServlet + + + + + + Dependency Host Servlet + /* + + diff --git a/dev/wlp.lib.extract_fat/test-applications/dependencyHost/src/web/DependencyHostServlet.java b/dev/wlp.lib.extract_fat/test-applications/dependencyHost/src/web/DependencyHostServlet.java new file mode 100755 index 00000000000..4c4ce0b1c98 --- /dev/null +++ b/dev/wlp.lib.extract_fat/test-applications/dependencyHost/src/web/DependencyHostServlet.java @@ -0,0 +1,95 @@ +package web; + +import java.io.IOException; +import java.io.Writer; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * A servlet that can return a variety of HTTP response codes and redirects. + *

    + * Used to test that the sample extractor can cope with various server responses. + */ +@SuppressWarnings("serial") +public class DependencyHostServlet extends HttpServlet { + + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + String path = request.getPathInfo(); + boolean validRequest = true; + if (path != null) { + if (path.equals("/good")) { + sendGoodFile(response); + } else if (path.equals("/notfound")) { + sendErrorCode(response, HttpServletResponse.SC_NOT_FOUND); + } else if (path.equals("/badrequest")) { + sendErrorCode(response, HttpServletResponse.SC_BAD_REQUEST); + } else if (path.equals("/forbidden")) { + sendErrorCode(response, HttpServletResponse.SC_FORBIDDEN); + } else if (path.equals("/serverError")) { + sendErrorCode(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } else if (path.equals("/redirect302")) { + sendRedirect(response, request, 302, "good"); + } else if (path.equals("/redirect301")) { + sendRedirect(response, request, 301, "good"); + } else if (path.equals("/redirect303")) { + sendRedirect(response, request, 303, "good"); + } else if (path.equals("/redirect307")) { + sendRedirect(response, request, 307, "good"); + } else if (path.equals("/redirectnotfound")) { + sendRedirect(response, request, 302, "notfound"); + } else if (path.equals("/protocolchange")) { + sendAbsoluteRedirect(response, 302, "https://example.com"); + } else { + validRequest = false; + } + } else { + validRequest = false; + } + + if (validRequest) { + log("Request OK: " + path); + } else { + log("Bad request: " + path); + sendErrorCode(response, HttpServletResponse.SC_NOT_FOUND); + } + } + + private void sendGoodFile(HttpServletResponse response) throws IOException { + response.setStatus(HttpServletResponse.SC_OK); + sendText(response, "DependencyContent"); + } + + private void sendErrorCode(HttpServletResponse response, int code) throws IOException { + response.setStatus(code); + sendText(response, "ErrorContent"); + } + + private void sendRedirect(HttpServletResponse response, HttpServletRequest request, int code, String location) throws IOException { + response.setStatus(code); + StringBuffer locationUrl = request.getRequestURL(); + locationUrl.delete(locationUrl.lastIndexOf("/"), locationUrl.length()); + locationUrl.append("/").append(location); + response.setHeader("Location", locationUrl.toString()); + sendText(response, "Redirecting..."); + } + + private void sendAbsoluteRedirect(HttpServletResponse response, int code, String location) throws IOException { + response.setStatus(code); + response.setHeader("Location", location); + sendText(response, "Redirecting..."); + } + + private void sendText(HttpServletResponse response, String text) throws IOException { + response.setContentType("text/plain"); + response.setCharacterEncoding("UTF-8"); + Writer writer = response.getWriter(); + writer.append(text); + writer.append("\r\n"); + writer.close(); + } +}