diff options
Diffstat (limited to 'rse/tests/org.eclipse.rse.tests')
133 files changed, 0 insertions, 16076 deletions
diff --git a/rse/tests/org.eclipse.rse.tests/.classpath b/rse/tests/org.eclipse.rse.tests/.classpath deleted file mode 100644 index 5a81d914d..000000000 --- a/rse/tests/org.eclipse.rse.tests/.classpath +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> - <accessrules> - <accessrule kind="accessible" pattern="org/eclipse/rse/internal/**"/> - </accessrules> - </classpathentry> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/rse/tests/org.eclipse.rse.tests/.project b/rse/tests/org.eclipse.rse.tests/.project deleted file mode 100644 index 0b0e2b5a0..000000000 --- a/rse/tests/org.eclipse.rse.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.rse.tests</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.core.resources.prefs b/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 418192e35..000000000 --- a/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Thu Aug 06 17:22:00 CEST 2009 -eclipse.preferences.version=1 -encoding//GVT/chs/test.txt=MS936 -encoding//GVT/cht/test.txt=MS950 -encoding//GVT/jpn/test.txt=MS932 -encoding//GVT/kor/test.txt=MS949 -encoding/<project>=ISO-8859-1 diff --git a/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.core.prefs b/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7a97eac73..000000000 --- a/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,71 +0,0 @@ -#Fri Mar 28 14:14:24 CET 2008 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4 -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=ignore -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.4 diff --git a/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.ui.prefs b/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index a8af14299..000000000 --- a/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,59 +0,0 @@ -#Thu Dec 21 14:47:13 CET 2006 -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_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_serial_version_id=true -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.format_comment=true -cleanup.format_javadoc=true -cleanup.format_multi_line_comment=true -cleanup.format_single_line_comment=true -cleanup.format_source_code=true -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -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_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.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=false -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 -cleanup_profile=_RSE JUnittest Code Cleanup Profile -cleanup_settings_version=2 -eclipse.preferences.version=1 -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=<?xml version\="1.0" encoding\="UTF-8"?><templates/> diff --git a/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.ltk.core.refactoring.prefs b/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.ltk.core.refactoring.prefs deleted file mode 100644 index 0fd7e0a11..000000000 --- a/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.ltk.core.refactoring.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Thu Dec 21 14:47:13 CET 2006 -eclipse.preferences.version=1 -org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/rse/tests/org.eclipse.rse.tests/GVT/bra/test.txt b/rse/tests/org.eclipse.rse.tests/GVT/bra/test.txt deleted file mode 100644 index 316636cac..000000000 --- a/rse/tests/org.eclipse.rse.tests/GVT/bra/test.txt +++ /dev/null @@ -1,20 +0,0 @@ - ***************************************************************** - * The program contains source to be used for NL testing. * - ***************************************************************** - - ***************************************************************** - * The following lines are comments with text in BRA * - * The text should appear same on the client as the host * - ***************************************************************** - * * - * O próximo vôo à noite sobre o Atlântico, põe freqüentemente o * - * médico. * - ***************************************************************** - - ***************************************************************** - * The following lines define Fspecs with the "special chars" * - * There should be no syntax or veryfy errors on these lines * - * due to the special chars * - ***************************************************************** - File@#$ if f 80 disk - File#$@ if f 80 disk
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/GVT/chs/test.txt b/rse/tests/org.eclipse.rse.tests/GVT/chs/test.txt deleted file mode 100644 index df5845bd8..000000000 --- a/rse/tests/org.eclipse.rse.tests/GVT/chs/test.txt +++ /dev/null @@ -1,11 +0,0 @@ - ***************************************************************** - * The program contains source to be used for NL testing. * - ***************************************************************** - - ***************************************************************** - * The following lines are comments with text in dbcs * - * The text should appear same on the client as the host * - ***************************************************************** - * £ô£è£é£ó¡¡£é£ó¡¡£Ä£Â£Ã£Ó¡¡£Ô£Å£Ø£Ô - * ÎÒÄÜÍÌϲ£Á§¶ø²»ÉËÉíÌå¡£ - *****************************************************************
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/GVT/cht/test.txt b/rse/tests/org.eclipse.rse.tests/GVT/cht/test.txt deleted file mode 100644 index 86bf15a73..000000000 --- a/rse/tests/org.eclipse.rse.tests/GVT/cht/test.txt +++ /dev/null @@ -1,19 +0,0 @@ - ***************************************************************** - * The program contains source to be used for NL testing. * - ***************************************************************** - - ***************************************************************** - * The following lines are comments with text in DBCS * - * The text should appear same on the client as the host * - ***************************************************************** - * ¢â¢ð¢ñ¢û¡@¢ñ¢û¡@¢û¢÷¢õ¢í¡@¢Ò¢Ð¢Ñ¢á - * ³±¶§¾Ç»¡¬O¥j¤H»{ÃÑÆ[¹î¦ÛµMªº²z©Êª¾ÃÑ¡C - ***************************************************************** - - ***************************************************************** - * The following lines define Fspecs with the "special chars" * - * There should be no syntax or veryfy errors on these lines * - * due to the special chars * - ***************************************************************** - File@#$ if f 80 disk - File#$@ if f 80 disk
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/GVT/deu/test.txt b/rse/tests/org.eclipse.rse.tests/GVT/deu/test.txt deleted file mode 100644 index c9b812a86..000000000 --- a/rse/tests/org.eclipse.rse.tests/GVT/deu/test.txt +++ /dev/null @@ -1,19 +0,0 @@ -***************************************************************** - * The program contains source to be used for NL testing. * - ***************************************************************** - - ***************************************************************** - * The following lines are comments with text in DEU * - * The text should appear same on the client as the host * - ***************************************************************** - * * - * Falsches Üben von Xylophonmusik quält jeden größeren Zwerg. * - ***************************************************************** - - ***************************************************************** - * The following lines define Fspecs with the "special chars" * - * There should be no syntax or veryfy errors on these lines * - * due to the special chars * - ***************************************************************** - File§#$ if f 80 disk - File#$§ if f 80 disk
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/GVT/esp/test.txt b/rse/tests/org.eclipse.rse.tests/GVT/esp/test.txt deleted file mode 100644 index 651a115dc..000000000 --- a/rse/tests/org.eclipse.rse.tests/GVT/esp/test.txt +++ /dev/null @@ -1,20 +0,0 @@ - ***************************************************************** - * The program contains source to be used for NL testing. * - ***************************************************************** - - ***************************************************************** - * The following lines are comments with text in ESP * - * The text should appear same on the client as the host * - ***************************************************************** - * * - * El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío, - * AÑORABA a su querido cachorro. * - ***************************************************************** - - ***************************************************************** - * The following lines define Fspecs with the "special chars" * - * There should be no syntax or veryfy errors on these lines * - * due to the special chars * - ***************************************************************** - File@Ñ$ if f 80 disk - FileÑ$@ if f 80 disk
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/GVT/fre/test.txt b/rse/tests/org.eclipse.rse.tests/GVT/fre/test.txt deleted file mode 100644 index 7966192aa..000000000 --- a/rse/tests/org.eclipse.rse.tests/GVT/fre/test.txt +++ /dev/null @@ -1,20 +0,0 @@ - ***************************************************************** - * The program contains source to be used for NL testing. * - ***************************************************************** - - ***************************************************************** - * The following lines are comments with text in FRE * - * The text should appear same on the client as the host * - ***************************************************************** - * * - * Les naïfs ægithales hâtifs pondant à Noël où il gèle sont sûrs - * d'être déçus et de voir leurs drôles d'oeufs abîmés. * - ***************************************************************** - - ***************************************************************** - * The following lines define Fspecs with the "special chars" * - * There should be no syntax or veryfy errors on these lines * - * due to the special chars * - ***************************************************************** - Fileà£$ if f 80 disk - File£$à if f 80 disk
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/GVT/instructions.txt b/rse/tests/org.eclipse.rse.tests/GVT/instructions.txt deleted file mode 100644 index 050fe8d51..000000000 --- a/rse/tests/org.eclipse.rse.tests/GVT/instructions.txt +++ /dev/null @@ -1,14 +0,0 @@ -The GVT folder has resources that can be used to run Globalization tests. The folder consists of a subfolder for each language -that is to be tested. - -Below are the folder names and the corresponding language: - -bra = Brazilian Portuguese -chs = Simplified Chinese -cht = Traditional Chinese -deu = German -esp = Spanish -fre = French -ita = Italian -jpn = Japanese -kor = Korean
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/GVT/ita/test.txt b/rse/tests/org.eclipse.rse.tests/GVT/ita/test.txt deleted file mode 100644 index 47e8110e3..000000000 --- a/rse/tests/org.eclipse.rse.tests/GVT/ita/test.txt +++ /dev/null @@ -1,20 +0,0 @@ - ***************************************************************** - * The program contains source to be used for NL testing. * - ***************************************************************** - - ***************************************************************** - * The following lines are comments with text in ITA * - * The text should appear same on the client as the host * - ***************************************************************** - * * - * El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío, - * AÑORABA a su querido cachorro. * - ***************************************************************** - - ***************************************************************** - * The following lines define Fspecs with the "special chars" * - * There should be no syntax or veryfy errors on these lines * - * due to the special chars * - ***************************************************************** - File@Ñ$ if f 80 disk - FileÑ$@ if f 80 disk
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/GVT/jpn/test.txt b/rse/tests/org.eclipse.rse.tests/GVT/jpn/test.txt deleted file mode 100644 index 698308fed..000000000 --- a/rse/tests/org.eclipse.rse.tests/GVT/jpn/test.txt +++ /dev/null @@ -1,34 +0,0 @@ - ***************************************************************** - * THE PROGRAM CONTAINS SOURCE TO BE USED FOR NL TESTING. * - ***************************************************************** - - ***************************************************************** - * THE FOLLOWING LINES ARE COMMENTS WITH TEXT IN NL * - * THE TEXT SHOULD APPEAR SAME ON THE CLIENT AS THE HOST * - ***************************************************************** - * ¶±Ã¹ÂÓ ±Ä´ ¶È¹µÄ´Í ¸Ï´´Âµ´ ¹Ä ± ³Å´ ȱ¹Ä ÅÄ Î¸µ ÍÎ. ÀŸÄ'Í - * ѱεȶÈÅÄÎ - * Îϵʹ±Ó ¶ÅÈ Î¸µ ÏÄе¹Â¹Ä· Ŷ ± ÃÅÄÏõÄÎ ÅÄ Î¸µ ÍÆÅΠѸµÈµ εÈÈÓ ¶ÅÒ - * ²µ·±Ä ¸¹Í ñȱθÅÄ Å¶ ¸ÅƵ 25 Óµ±ÈÍ ±·Å ÎŠθµ ´±Ó. - ***************************************************************** - - ***************************************************************** - * THE FOLLOWING LINES ARE COMMENTS WITH TEXT IN DBCS * - * THE TEXT SHOULD APPEAR SAME ON THE CLIENT AS THE HOST * - ***************************************************************** - *‚s‚ˆ‚‰‚“@‚‰‚“@‚“‚‚‚…@‚c‚a‚b‚r@‚”‚…‚˜‚” - *‚s‚ˆ‚‰‚“@‚‰‚“@‚“‚‚‚…@‚„‚‚‚ƒ‚“@‚”‚…‚˜‚” - ***************************************************************** - * ‚¢‚ë‚Í‚É‚Ù‚Ö‚Ç@‚¿‚è‚Ê‚é‚ð - * ‚킪‚悽‚ꂼ@‚‚˂Ȃç‚Þ - * ‚¤‚î‚Ì‚¨‚‚â‚Ü@‚¯‚Ó‚±‚¦‚Ä - * ‚ ‚³‚«‚ä‚ß‚Ý‚¶@‚ï‚Ð‚à‚¹‚¸ - ***************************************************************** - - ***************************************************************** - * THE FOLLOWING LINES DEFINE FSPECS WITH THE "SPECIAL CHARS" * - * THERE SHOULD BE NO SYNTAX OR VERYFY ERRORS ON THESE LINES * - * DUE TO THE SPECIAL CHARS * - ***************************************************************** - FILE@#\ IF F 80 DISK - FILE#\@ IF F 80 DISK
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/GVT/kor/test.txt b/rse/tests/org.eclipse.rse.tests/GVT/kor/test.txt deleted file mode 100644 index 57078297f..000000000 --- a/rse/tests/org.eclipse.rse.tests/GVT/kor/test.txt +++ /dev/null @@ -1,21 +0,0 @@ - ***************************************************************** - * The program contains source to be used for NL testing. * - ***************************************************************** - - ***************************************************************** - * The following lines are comments with DBCS text - * The text should appear same on the client as the host * - ***************************************************************** - * £Ô£È£É£Ó¡¡£É£Ó¡¡£Ó£Ï£Í£Å¡¡£Ä£Â£Ã£Ó¡¡£Ô£Å£Ø£Ô * - *£ä£â£ã£ó - * - *³ª´Â À¯¸®¸¦ ¸ÔÀ» ¼ö ÀÖ¾î¿ä. ±×·¡µµ ¾ÆÇÁÁö ¾Ê¾Æ¿ä - ***************************************************************** - - ***************************************************************** - * The following lines define Fspecs with the "special chars" * - * There should be no syntax or veryfy errors on these lines * - * due to the special chars * - ***************************************************************** - File@#$ if f 80 disk - File#$@ if f 80 disk
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/META-INF/MANIFEST.MF b/rse/tests/org.eclipse.rse.tests/META-INF/MANIFEST.MF deleted file mode 100644 index ca3242151..000000000 --- a/rse/tests/org.eclipse.rse.tests/META-INF/MANIFEST.MF +++ /dev/null @@ -1,52 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.rse.tests;singleton:=true -Bundle-Version: 3.1.1.qualifier -Bundle-Activator: org.eclipse.rse.tests.RSETestsPlugin -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Require-Bundle: org.junit, - org.eclipse.core.runtime, - org.eclipse.core.resources, - org.eclipse.core.filesystem, - org.eclipse.team.core, - org.eclipse.ui, - org.eclipse.ui.views, - org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)", - org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)", - org.eclipse.rse.subsystems.files.core;bundle-version="[3.0.0,4.0.0)", - org.eclipse.rse.subsystems.files.local;bundle-version="[2.1.0,3.0.0)", - org.eclipse.rse.subsystems.processes.core;bundle-version="[3.0.0,4.0.0)", - org.eclipse.rse.subsystems.shells.core;bundle-version="[3.0.0,4.0.0)", - org.eclipse.rse.services;bundle-version="[3.1.0,4.0.0)", - org.eclipse.rse.services.files.ftp;bundle-version="[3.0.0,4.0.0)", - org.eclipse.rse.services.ssh;bundle-version="[3.0.0,3.1.0)", - org.eclipse.rse.subsystems.files.ftp;bundle-version="[2.1.0,3.0.0)", - org.eclipse.rse.importexport;bundle-version="[1.2.0,1.3.0)", - org.eclipse.rse.files.ui, - org.eclipse.rse.efs, - org.eclipse.rse.tests.framework;bundle-version="[2.0.0,3.0.0)", - org.apache.commons.net;bundle-version="[1.4.1,3.0.0)", - org.eclipse.rse.subsystems.terminals.core;bundle-version="[1.0.0,2.0.0)" -Bundle-ActivationPolicy: lazy -Eclipse-LazyStart: true -Bundle-RequiredExecutionEnvironment: J2SE-1.4 -Export-Package: org.eclipse.rse.tests, - org.eclipse.rse.tests.core, - org.eclipse.rse.tests.core.connection, - org.eclipse.rse.tests.core.passwords, - org.eclipse.rse.tests.core.registries, - org.eclipse.rse.tests.initialization, - org.eclipse.rse.tests.internal;x-internal:=true, - org.eclipse.rse.tests.internal.testsubsystem;x-internal:=true, - org.eclipse.rse.tests.persistence, - org.eclipse.rse.tests.preferences, - org.eclipse.rse.tests.profiles, - org.eclipse.rse.tests.subsystems.files, - org.eclipse.rse.tests.subsystems.testsubsystem, - org.eclipse.rse.tests.testsubsystem, - org.eclipse.rse.tests.testsubsystem.interfaces, - org.eclipse.rse.tests.ui.mnemonics, - org.eclipse.rse.tests.ui.preferences -Bundle-ClassPath: rsetests.jar diff --git a/rse/tests/org.eclipse.rse.tests/about.html b/rse/tests/org.eclipse.rse.tests/about.html deleted file mode 100644 index d4cc693f9..000000000 --- a/rse/tests/org.eclipse.rse.tests/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>June 5, 2007</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> - -</body> -</html>
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/about.ini b/rse/tests/org.eclipse.rse.tests/about.ini deleted file mode 100644 index fbbb9f83d..000000000 --- a/rse/tests/org.eclipse.rse.tests/about.ini +++ /dev/null @@ -1,27 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=dsdp32.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/about.mappings b/rse/tests/org.eclipse.rse.tests/about.mappings deleted file mode 100644 index bddaab431..000000000 --- a/rse/tests/org.eclipse.rse.tests/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/about.properties b/rse/tests/org.eclipse.rse.tests/about.properties deleted file mode 100644 index 214e378b2..000000000 --- a/rse/tests/org.eclipse.rse.tests/about.properties +++ /dev/null @@ -1,25 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 Wind River Systems, Inc. and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=RSE Unit Tests\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Wind River Systems, Inc. and others 2006, 2009. All rights reserved.\n\ -Visit http://www.eclipse.org/dsdp/tm diff --git a/rse/tests/org.eclipse.rse.tests/build.properties b/rse/tests/org.eclipse.rse.tests/build.properties deleted file mode 100644 index 8b2f10cce..000000000 --- a/rse/tests/org.eclipse.rse.tests/build.properties +++ /dev/null @@ -1,36 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2009 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -# Martin Oberhuber (Wind River) - fix ant build and make consistent -############################################################################### -source.rsetests.jar = src/ -output.rsetests.jar = bin/ -bin.includes = rsetests.jar,\ - plugin.xml,\ - META-INF/,\ - test.data/,\ - test.xml,\ - plugin.properties,\ - about.html,\ - about.ini,\ - about.mappings,\ - about.properties,\ - dsdp32.png,\ - icons/,\ - GVT/,\ - teamConfig/ - -# build with "assert" keyword enabled -javacSource = 1.4 -javacTarget = 1.4 -source.rsetests.jar = src/ -src.includes = teamConfig/,\ - about.html,\ - .settings/,\ - build.properties diff --git a/rse/tests/org.eclipse.rse.tests/dsdp32.png b/rse/tests/org.eclipse.rse.tests/dsdp32.png Binary files differdeleted file mode 100644 index 3077b1220..000000000 --- a/rse/tests/org.eclipse.rse.tests/dsdp32.png +++ /dev/null diff --git a/rse/tests/org.eclipse.rse.tests/icons/branch.gif b/rse/tests/org.eclipse.rse.tests/icons/branch.gif Binary files differdeleted file mode 100644 index 4a00a34a1..000000000 --- a/rse/tests/org.eclipse.rse.tests/icons/branch.gif +++ /dev/null diff --git a/rse/tests/org.eclipse.rse.tests/icons/leaf.gif b/rse/tests/org.eclipse.rse.tests/icons/leaf.gif Binary files differdeleted file mode 100644 index 015831ddb..000000000 --- a/rse/tests/org.eclipse.rse.tests/icons/leaf.gif +++ /dev/null diff --git a/rse/tests/org.eclipse.rse.tests/icons/systemconnection.gif b/rse/tests/org.eclipse.rse.tests/icons/systemconnection.gif Binary files differdeleted file mode 100644 index e8efe69dc..000000000 --- a/rse/tests/org.eclipse.rse.tests/icons/systemconnection.gif +++ /dev/null diff --git a/rse/tests/org.eclipse.rse.tests/icons/systemconnectionlive.gif b/rse/tests/org.eclipse.rse.tests/icons/systemconnectionlive.gif Binary files differdeleted file mode 100644 index f97fa6b48..000000000 --- a/rse/tests/org.eclipse.rse.tests/icons/systemconnectionlive.gif +++ /dev/null diff --git a/rse/tests/org.eclipse.rse.tests/plugin.properties b/rse/tests/org.eclipse.rse.tests/plugin.properties deleted file mode 100644 index feef8bc92..000000000 --- a/rse/tests/org.eclipse.rse.tests/plugin.properties +++ /dev/null @@ -1,25 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2009 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -# Martin Oberhuber (Wind River) - fix ant build for "Assert", make consistent -############################################################################### -pluginName=RSE Unit Tests -providerName=Eclipse.org - DSDP - -testSubSystemName = Tests -testSubSystemDescription = Test Subsystem - -testSubSystem2Name = Tests2 -testSubSystem2Description = Test Subsystem 2 - -testSubSystem3Name = Tests3 -testSubSystem3Description = Test Subsystem 3 - -testSystemTypeLabel = Tests Only -testSystemTypeDescription = RSE Test plugin internal system type diff --git a/rse/tests/org.eclipse.rse.tests/plugin.xml b/rse/tests/org.eclipse.rse.tests/plugin.xml deleted file mode 100644 index b17c8b0b9..000000000 --- a/rse/tests/org.eclipse.rse.tests/plugin.xml +++ /dev/null @@ -1,132 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?>
<!-- - Copyright (c) 2005, 2008 IBM Corporation and others. - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - which accompanies this distribution, and is available at - http://www.eclipse.org/legal/epl-v10.html - - Contributors: - IBM Corporation - initial API and implementation - --> - -<plugin> - <extension point="org.eclipse.rse.tests.framework.suites"> - <suite type="org.eclipse.rse.tests.RSECombinedTestSuite" name="RSE Combined Test Suite"/> - <type name="org.eclipse.rse.tests.RSECombinedTestSuite" class="org.eclipse.rse.tests.RSECombinedTestSuite" /> - - <suite type="org.eclipse.rse.tests.internal.RSEInternalFrameworkTestSuite" name="RSE Internal Framework Test Suite"/> - <type name="org.eclipse.rse.tests.internal.RSEInternalFrameworkTestSuite" class="org.eclipse.rse.tests.internal.RSEInternalFrameworkTestSuite" /> - - <suite type="org.eclipse.rse.tests.core.connection.RSEConnectionTestSuite" name="RSE Connection Test Suite"/> - <type name="org.eclipse.rse.tests.core.connection.RSEConnectionTestSuite" class="org.eclipse.rse.tests.core.connection.RSEConnectionTestSuite" /> - - <suite type="org.eclipse.rse.tests.subsystems.files.RSEFileSubsystemTestSuite" name="RSEFileSubsystemTestSuite"/> - <type name="org.eclipse.rse.tests.subsystems.files.RSEFileSubsystemTestSuite" class="org.eclipse.rse.tests.subsystems.files.RSEFileSubsystemTestSuite" /> - - <suite type="org.eclipse.rse.tests.subsystems.shells.RSEShellSubsystemTestSuite" name="RSEShellSubsystemTestSuite"/> - <type name="org.eclipse.rse.tests.subsystems.shells.RSEShellSubsystemTestSuite" class="org.eclipse.rse.tests.subsystems.shells.RSEShellSubsystemTestSuite" /> - - <suite type="org.eclipse.rse.tests.persistence.PersistenceTestSuite" name="RSE Persistence Test Suite"/> - <type name="org.eclipse.rse.tests.persistence.PersistenceTestSuite" class="org.eclipse.rse.tests.persistence.PersistenceTestSuite" /> - </extension> - - <!-- Do not replace the use of systemTypes here as long it only deprecated! --> - <extension point="org.eclipse.rse.core.subsystemConfigurations"> - <configuration - id="org.eclipse.rse.tests.subsystems.TestSubSystem" - systemTypeIds="org.eclipse.rse.systemtype.local;org.eclipse.rse.systemtype.windows" - name="%testSubSystemName" - class="org.eclipse.rse.tests.internal.testsubsystem.TestSubSystemConfiguration" - category="users" - vendor="%providerName" - description="%testSubSystemDescription" - iconlive="icons/systemconnectionlive.gif" - icon="icons/systemconnection.gif" - priority="50000"> - </configuration> - - <configuration - id="org.eclipse.rse.tests.subsystems.TestSubSystem2" - systemTypeIds="org.eclipse.rse.tests.*" - name="%testSubSystem2Name" - class="org.eclipse.rse.tests.internal.testsubsystem.TestSubSystemConfiguration" - category="users" - vendor="%providerName" - description="%testSubSystem2Description" - iconlive="icons/systemconnectionlive.gif" - icon="icons/systemconnection.gif" - priority="100000"> - </configuration> - - <!-- Do not replace the use of systemTypes here as long it only deprecated! --> - <configuration - id="org.eclipse.rse.tests.subsystems.TestSubSystem3" - systemTypeIds="org.eclipse.rse.systemtype.*n?x" - name="%testSubSystem3Name" - class="org.eclipse.rse.tests.internal.testsubsystem.TestSubSystemConfiguration" - category="users" - vendor="%providerName" - description="%testSubSystem3Description" - iconlive="icons/systemconnectionlive.gif" - icon="icons/systemconnection.gif" - priority="2000"> - </configuration> - - <configuration - id="org.eclipse.rse.tests.subsystems.ftp.windows" - systemTypeIds="org.eclipse.rse.tests.systemType.ftp.windows" - name="FTP Windows" - description="FTP Windows Description" - category="files" - class="org.eclipse.rse.tests.subsystems.files.FTPWindowsFileSubSystemConfiguration" - priority="100" - vendor="Tests" - serviceType="_ftp._tcp"> - </configuration> - - </extension> - - <extension - point="org.eclipse.rse.core.systemTypes"> - <systemType - label="%testSystemTypeLabel" - description="%testSystemTypeDescription" - enableOffline="false" - id="org.eclipse.rse.tests.testSystemType" - name="Tests Only"> - </systemType> - <systemType - enableOffline="false" - id="org.eclipse.rse.tests.systemType.ftp.windows" - label="FTP Windows" - name="FTP Windows"> - <property - name="isWindows" - value="true"> - </property> - </systemType> - <systemType - description="Linux without shells subsystem" - id="org.eclipse.rse.tests.systemType.sshTerminal" - label="Ssh without shells" - name="Ssh without shells" - subsystemConfigurationIds="ssh.terminals;ssh.files;processes.shell.linux"> - </systemType> - <systemType - description="FTP with SSH Shell" - id="org.eclipse.rse.tests.systemType.ftpSsh" - label="FTP with SSH shell" - name="FTP with SSH shell" - subsystemConfigurationIds="ssh.shells;ftp.files"> - </systemType> - </extension> - - <extension point="org.eclipse.rse.core.modelInitializers"> - <modelInitializer class="org.eclipse.rse.tests.initialization.GoodInitializer"/> - <modelInitializer class="org.eclipse.rse.tests.initialization.BadInitializer"/> - <modelInitializer class="org.eclipse.rse.tests.initialization.UglyInitializer"/> - <modelInitializer class="org.eclipse.rse.tests.initialization.ListenerInitializer"/> - </extension> - -</plugin> diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSECombinedTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSECombinedTestSuite.java deleted file mode 100644 index 3304f12de..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSECombinedTestSuite.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - *******************************************************************************/ -package org.eclipse.rse.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -/** - * Main class bundling all single specialized test suites into a - * overall complete one. - */ -public class RSECombinedTestSuite extends DelegatingTestSuiteHolder { - - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE Combined Test Suite"); //$NON-NLS-1$ - - // add the single test suites to the overall one here. - suite.addTest(org.eclipse.rse.tests.core.AllTests.suite()); - suite.addTest(org.eclipse.rse.tests.core.connection.RSEConnectionTestSuite.suite()); - suite.addTest(org.eclipse.rse.tests.core.registries.RSERegistriesTestSuite.suite()); - suite.addTest(org.eclipse.rse.tests.internal.RSEInternalFrameworkTestSuite.suite()); - suite.addTest(org.eclipse.rse.tests.persistence.PersistenceTestSuite.suite()); - suite.addTest(org.eclipse.rse.tests.preferences.RSEPreferencesTestSuite.suite()); - suite.addTest(org.eclipse.rse.tests.subsystems.files.RSEFileSubsystemTestSuite.suite()); - suite.addTest(org.eclipse.rse.tests.subsystems.shells.RSEShellSubsystemTestSuite.suite()); - suite.addTest(org.eclipse.rse.tests.subsystems.testsubsystem.RSETestSubsystemTestSuite.suite()); - suite.addTestSuite(org.eclipse.rse.tests.synchronize.RSESynchronizeTest.class); - suite.addTest(org.eclipse.rse.tests.ui.mnemonics.MnemonicsTestSuite.suite()); - suite.addTest(org.eclipse.rse.tests.ui.preferences.PreferencesTestSuite.suite()); - // //Manual test below -- cannot be run in unattended builds - // suite.addTest(org.eclipse.rse.tests.ui.connectionwizard.RSENewConnectionWizardTestSuite.suite()); - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)RSECombinedTestSuite.suite(); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsPlugin.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsPlugin.java deleted file mode 100644 index 767eb2cf1..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsPlugin.java +++ /dev/null @@ -1,237 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Don Yantzi (IBM) - initial contribution. - * David Dykstal (IBM) - initial contribution. - * Uwe Stieber (Wind River) - restructuring and cleanup - * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin - ********************************************************************************/ -package org.eclipse.rse.tests; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.core.runtime.IAdapterManager; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.tests.core.IRSETestLogCollectorDelegate; -import org.eclipse.rse.tests.internal.RSEDefaultTestLogCollectorDelegate; -import org.eclipse.rse.tests.internal.testsubsystem.TestSubSystemAdapterFactory; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystem; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemConfiguration; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNode; -import org.eclipse.rse.ui.SystemBasePlugin; -import org.osgi.framework.BundleContext; - -/** - * Main plugin class for the RSE JUnit tests framework. This - * class provides basic infra structure for accessing externalized - * string data. - */ -public class RSETestsPlugin extends SystemBasePlugin { - // The shared plugin instance. - private static RSETestsPlugin plugin; - // The resource bundle associated with this plugin. - private ResourceBundle resourceBundle; - - // Test log collector delegates storage. - private final List logCollectorDelegates = new ArrayList(); - - // Default test log collector delegate - private final IRSETestLogCollectorDelegate defaultLogCollectorDelegate = new RSEDefaultTestLogCollectorDelegate(); - - /** - * Constructor. - */ - public RSETestsPlugin() { - super(); - plugin = this; - } - - /** - * Returns the shared plugin instance. - * - * @return The plugin instance or <code>null</code> if not yet constructed. - */ - public static RSETestsPlugin getDefault() { - return plugin; - } - - /** - * Returns the associated resource bundle. If necessary, the resource - * bundle will be initialized. - * - * @return The resource bundle instance. - */ - public ResourceBundle getResourceBundle() { - // If the resource bundle got created already, return the - // existing instance. - if (resourceBundle != null) return resourceBundle; - - // The resource bundle had not been created yet -> create it. - resourceBundle = ResourceBundle.getBundle("org.eclipse.rse.tests.RSETestsResources"); //$NON-NLS-1$ - return resourceBundle; - } - - /** - * Queries the externalized string for the specified resource key from - * the plugins associated resource bundle. - * - * @param key The resource key. Must be not <code>null</code>! - * @return The externalized string or the resource key enclosed in exlamation marks. - */ - public static String getResourceString(String key) { - assert key != null; - - // Query the resource bundle from the plugin instance. - ResourceBundle bundle = RSETestsPlugin.getDefault().getResourceBundle(); - if (bundle != null) { - try { - // Lookup the key and return the corresponding string if found. - return bundle.getString(key); - } catch (MissingResourceException e) { - // return the key as is enclosed in exlamation marks. - } - } - - // If we could not found the key or the bundle is invalid, - // return the key as is enclosed in exlamation marks. - return '!' + key + '!'; - } - - /** - * Queries the externalized string for the specified resource key from - * the plugins associated resource bundle. If a externalized resource - * for the specified key exist, a possible argument placeholder will be - * replaced by the specified value. - * - * @param key The resource key. Must be not <code>null</code>! - * @param argument The content for a possible placeholder. Must be not <code>null</code>. - * @return The externalized string or the resource key enclosed in exlamation marks. - */ - public static String getResourceString(String key, Object argument) { - assert argument != null; - return getResourceString(key, new Object[] { argument }); - } - - /** - * Queries the externalized string for the specified resource key from - * the plugins associated resource bundle. If a externalized resource - * for the specified key exist, possible argument placeholder will be - * replaced by their specified values. - * - * @param key The resource key. Must be not <code>null</code>! - * @param arguments The content for the possible arguments. Must be not <code>null</code>. - * @return The externalized string or the resource key enclosed in exlamation marks. - */ - public static String getResourceString(String key, Object[] arguments) { - assert arguments != null; - String resourceString = getResourceString(key); - if (!resourceString.startsWith("!")) { //$NON-NLS-1$ - return MessageFormat.format(resourceString, arguments); - } - return resourceString; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - addDelegate(defaultLogCollectorDelegate); - - IAdapterManager manager = Platform.getAdapterManager(); - TestSubSystemAdapterFactory subSystemAdapterFactory = new TestSubSystemAdapterFactory(); - manager.registerAdapters(subSystemAdapterFactory, ITestSubSystem.class); - manager.registerAdapters(subSystemAdapterFactory, ITestSubSystemNode.class); - manager.registerAdapters(subSystemAdapterFactory, ITestSubSystemConfiguration.class); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - removeDelegate(defaultLogCollectorDelegate); - super.stop(context); - } - - /** - * Checks if the test case given through the specified key is enabled for - * execution. A test case is considered enabled if either<br> - * <ul> - * <li>-D<testId> is true or</li> - * <li>getResourceString(<testId>) is true or</li> - * <li>neither the explicit -D option is specified nor the key exist in the associated - * resource bundle.</li> - * </ul> - * - * @param testId The unique string id of the test case to execute. Must be not <code>null</code>! - * @return <code>true</code> if the test case is enabled for execution, <code>false</code> otherwise. - */ - public static boolean isTestCaseEnabled(String testId) { - assert testId != null; - - // Test first for the system property (explicit -D option). - String value = System.getProperty(testId); - if (value != null) return Boolean.getBoolean(value); - - // If the system property is not set, check for the key in the resource bundle - value = getResourceString(testId); - if (value != null && !value.startsWith("!")) return Boolean.valueOf(value).booleanValue(); //$NON-NLS-1$ - - // the test is considered enabled as well if not otherwise explicitly overriden - return true; - } - - /** - * Add the specified test collector delegate to the list. If the specified - * delegate had been already added to the list before, the method will return - * without re-adding the test collector delegate again. - * - * @param delegate The test collector delegate to add. Must be not <code>null</code>. - */ - public synchronized void addDelegate(IRSETestLogCollectorDelegate delegate) { - assert delegate != null; - if (delegate != null && !logCollectorDelegates.contains(delegate)) { - logCollectorDelegates.add(delegate); - } - } - - /** - * Removes the specified test collector delegate from the list. If the specified - * delegate had not been added to the list before, the method will return immediatelly. - * - * @param delegate The test collector delegate to remove. Must be not <code>null</code>. - */ - public synchronized void removeDelegate(IRSETestLogCollectorDelegate delegate) { - assert delegate != null; - if (delegate != null) { - logCollectorDelegates.remove(delegate); - } - } - - /** - * Returns the currently list of known test log collector delegates. - * - * @return The currently known list of test collector delegates. - */ - public synchronized IRSETestLogCollectorDelegate[] getTestLogCollectorDelegates() { - return (IRSETestLogCollectorDelegate[])logCollectorDelegates.toArray(new IRSETestLogCollectorDelegate[logCollectorDelegates.size()]); - } - - /** - * Initialize the image registry by declaring all of the required graphics. - */ - protected void initializeImageRegistry() { - String path = getIconPath(); - putImageInRegistry("ICON_ID_BRANCH", path + "branch.gif"); //$NON-NLS-1$ //$NON-NLS-2$ - putImageInRegistry("ICON_ID_LEAF", path + "leaf.gif"); //$NON-NLS-1$ //$NON-NLS-2$ - } -} - diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsResources.properties b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsResources.properties deleted file mode 100644 index 465dfb7a4..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsResources.properties +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2008 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -# Uwe Stieber (Wind River) - Rework test data location & connection management -# Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases -############################################################################### - -# -# The following section controls the execution of the single test cases. -# Each test case can be disabled individually here. -# - -RSETestsPluginTestCase.testPluginResourceBundle=true - -RSEInternalFrameworkTestCase.testCoreTestPropertiesHandling=true -RSEInternalFrameworkTestCase.testWaitAndDispatch=true -RSEInternalFrameworkTestCase.testTestDataLocationManagement=true -RSEInternalFrameworkTestCase.testConnectionManager=true - -RSEConnectionTestCase.testConnectionCreation=true -RSEConnectionTestCase.testConnectionRemoval=true -RSEConnectionTestCase.testConnect=true -RSEConnectionTestCase.testResolveFilterString=true - -FileServiceTest.testCaseSensitive=true -FileServiceTest.testCreateFile=true -FileServiceTest.testCreateCaseSensitive=true -FTPFileSubsystemTestCase.testFTPReadAccessToRemoteHost=true - -TestSubsystemTestCase.testAddAndDeleteDeepNodes=true -TestSubsystemTestCase.testAddAndDeleteFlatNodes=true -TestSubsystemTestCase.testBugzilla170728=true - -RSENewConnectionWizardTestCase.testRestrictToSystemType=true - -# -# The following section controls enablement of test cases by target or client platform. -# Uncomment a line to disable running unit tests on the specified target connection. -# Target connections refer to connection properties files, e.g. ftp --> ftpConnection.properties -# For active target connections, the Properties file must contain valid connection properties. -# -*.ftp=true -*.ftpWindows=true -*.linux=true -*.local=true -*.ssh=true -*.windows=true - -Windows_XP.x86.*=true -Linux.x86.*=true -Linux.ppc.*=true - -# -# The following section contains externalized string for the single classes -# - -RSETestsPluginTestCase.dontRemove.testNeverEnabledThis=false -RSETestsPluginTestCase.dontRemove.testResolveString=testResolveString -RSETestsPluginTestCase.dontRemove.testResolveStringOneParameter=testResolveString, param={0} -RSETestsPluginTestCase.dontRemove.testResolveStringMultiParameter=testResolveString, param={0}, param={1} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/AllTests.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/AllTests.java deleted file mode 100644 index 8adab9619..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/AllTests.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Martin Oberhuber (Wind River) - initial API and implementation - *******************************************************************************/ - -package org.eclipse.rse.tests.core; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.core.connection.RSEConnectionTestSuite; -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -/** - * Suite for RSE Core Model test cases. - */ -public class AllTests extends DelegatingTestSuiteHolder { - - /** Run this test suite stand-alone. Only makes sense if no plugin test */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - public static Test suite() { - TestSuite suite = new TestSuite(AllTests.class.getName()); - // add the single test suites to the overall one here. - suite.addTestSuite(HostMoveTest.class); - - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)RSEConnectionTestSuite.suite(); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/HostMoveTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/HostMoveTest.java deleted file mode 100644 index 54a73570c..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/HostMoveTest.java +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation. - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - ********************************************************************************/ - -package org.eclipse.rse.tests.core; - -import java.util.Properties; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.tests.core.connection.IRSEConnectionProperties; -import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; - -/** - * Tests for host move in the host pool. - * Each testcase method should leave the host pool as it was prior to running the method. - */ -public class HostMoveTest extends RSEBaseConnectionTestCase { - - static final int NUMBER_OF_HOSTS = 6; // number of hosts - private IHost hostArray[] = null; - private ISystemRegistry registry = null; - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - registry = RSECorePlugin.getTheSystemRegistry(); - createHosts(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - deleteHosts(); - super.tearDown(); - } - - public void testMoveOneUp() throws Exception { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - checkPrecondition(); - IHost host = hostArray[NUMBER_OF_HOSTS - 1]; - IHost[] hosts = new IHost[] {host}; - registry.moveHosts("TestProfile", hosts, -1); - assertEquals(NUMBER_OF_HOSTS - 2, registry.getHostPosition(host)); - flushEventQueue(); - assertEquals(NUMBER_OF_HOSTS - 2, registry.getHostPosition(host)); - registry.moveHosts("TestProfile", hosts, 1); - assertEquals(NUMBER_OF_HOSTS - 1, registry.getHostPosition(host)); - } - - public void testMoveManyUp() throws Exception { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - checkPrecondition(); - IHost[] hosts = new IHost[] {hostArray[NUMBER_OF_HOSTS - 1], hostArray[NUMBER_OF_HOSTS - 2]}; - registry.moveHosts("TestProfile", hosts, -2); - assertEquals(NUMBER_OF_HOSTS - 3, registry.getHostPosition(hostArray[NUMBER_OF_HOSTS - 1])); - assertEquals(NUMBER_OF_HOSTS - 4, registry.getHostPosition(hostArray[NUMBER_OF_HOSTS - 2])); - flushEventQueue(); - assertEquals(NUMBER_OF_HOSTS - 3, registry.getHostPosition(hostArray[NUMBER_OF_HOSTS - 1])); - assertEquals(NUMBER_OF_HOSTS - 4, registry.getHostPosition(hostArray[NUMBER_OF_HOSTS - 2])); - registry.moveHosts("TestProfile", hosts, 2); - assertEquals(NUMBER_OF_HOSTS - 1, registry.getHostPosition(hostArray[NUMBER_OF_HOSTS - 1])); - assertEquals(NUMBER_OF_HOSTS - 2, registry.getHostPosition(hostArray[NUMBER_OF_HOSTS - 2])); - } - - public void testMoveFirstUp() throws Exception { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - checkPrecondition(); - IHost host = hostArray[0]; - assertEquals(0, registry.getHostPosition(host)); - IHost[] hosts = new IHost[] {host}; - registry.moveHosts("TestProfile", hosts, -1); // should not actually move - assertEquals(0, registry.getHostPosition(host)); - } - - public void testMoveOneDown() throws Exception { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - checkPrecondition(); - IHost host = hostArray[1]; // second in the list - assertEquals(1, registry.getHostPosition(host)); - IHost[] hosts = new IHost[] {host}; - registry.moveHosts("TestProfile", hosts, 1); - assertEquals(2, registry.getHostPosition(host)); - registry.moveHosts("TestProfile", hosts, -1); - assertEquals(1, registry.getHostPosition(host)); - } - - public void testMoveManyDown() throws Exception { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - checkPrecondition(); - IHost[] hosts = new IHost[] {hostArray[0], hostArray[2], hostArray[4]}; - assertEquals(0, registry.getHostPosition(hostArray[0])); - assertEquals(2, registry.getHostPosition(hostArray[2])); - assertEquals(4, registry.getHostPosition(hostArray[4])); - registry.moveHosts("TestProfile", hosts, 1); - assertEquals(1, registry.getHostPosition(hostArray[0])); - assertEquals(3, registry.getHostPosition(hostArray[2])); - assertEquals(5, registry.getHostPosition(hostArray[4])); - registry.moveHosts("TestProfile", hosts, -1); - assertEquals(0, registry.getHostPosition(hostArray[0])); - assertEquals(2, registry.getHostPosition(hostArray[2])); - assertEquals(4, registry.getHostPosition(hostArray[4])); - } - - public void testMoveLastDown() throws Exception { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - checkPrecondition(); - IHost host = hostArray[NUMBER_OF_HOSTS - 1]; - assertEquals(NUMBER_OF_HOSTS - 1, registry.getHostPosition(host)); - IHost[] hosts = new IHost[] {host}; - registry.moveHosts("TestProfile", hosts, 1); // should not actually move - assertEquals(NUMBER_OF_HOSTS - 1, registry.getHostPosition(host)); - } - - public void testNoHost() throws Exception { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - checkPrecondition(); - IHost[] hosts = new IHost[] {}; - registry.moveHosts("TestProfile", hosts, -1); // should not fail - } - - /** - * Create the test hosts. - */ - private void createHosts() throws Exception { - - hostArray = new IHost[NUMBER_OF_HOSTS]; - - /* Common host properties */ - Properties properties = new Properties(); - properties.setProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME, "TestProfile"); //$NON-NLS-1$ - properties.setProperty(IRSEConnectionProperties.ATTR_ADDRESS, "localhost"); //$NON-NLS-1$ - properties.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID, IRSESystemType.SYSTEMTYPE_UNIX_ID); - properties.setProperty(IRSEConnectionProperties.ATTR_USERID, "userid"); //$NON-NLS-1$ - properties.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, "password"); //$NON-NLS-1$ - IRSEConnectionProperties props = getConnectionManager().loadConnectionProperties(properties, false); - - for (int i = 0; i < hostArray.length; i++) { - String hostName = getHostName(i); - properties.setProperty(IRSEConnectionProperties.ATTR_NAME, hostName); - hostArray[i] = getConnectionManager().findOrCreateConnection(props); - assertNotNull("Failed to create connection " + props.getProperty(IRSEConnectionProperties.ATTR_NAME), hostArray[i]); //$NON-NLS-1$ - } - - } - - private void deleteHosts() { - for (int i = 1; i < hostArray.length; i++) { - registry.deleteHost(hostArray[i]); - } - } - - private void checkPrecondition() { - for (int i = 0; i < hostArray.length; i++) { - assertEquals("Precondition check failed", i, registry.getHostPosition(hostArray[i])); - } - } - - private String getHostName(int i) { - String hostName = "TestHost" + Integer.toString(i); - return hostName; - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSECoreTestCaseProperties.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSECoreTestCaseProperties.java deleted file mode 100644 index 6ba738535..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSECoreTestCaseProperties.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.core; - -/** - * Interface declaring public known and usable core test case properties. - */ -public interface IRSECoreTestCaseProperties { - static final String PROP_BASE_KEY = "org.eclipse.rse.tests.core"; //$NON-NLS-1$ - - /** - * Boolean property controling if or if not the Remote Systems View will be - * expanded before the test case is starting. The original view maximized - * state will be restored after the test case finished. - * <p> - * Default value is <b><code>false</code></b>. - */ - public static final String PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW = PROP_BASE_KEY + ".maximizeRemoteSystemsView"; //$NON-NLS-1$ - - /** - * String property specifying the perspective id to switch to before the - * test case is starting. The original perspective will be restored after - * the test case finished. - * <p> - * Default value is <b><code>org.eclipse.rse.ui.view.SystemPerspective</code></b>. - */ - public static final String PROP_SWITCH_TO_PERSPECTIVE = PROP_BASE_KEY + ".switchToPerspective"; //$NON-NLS-1$ - - /** - * Boolean property controling if the test execution should be forced into a non - * display thread (if not already running in a non display thread anyway). - * <p> - * Default value is <b><code>false</code></b>. - */ - public static final String PROP_FORCE_BACKGROUND_EXECUTION = PROP_BASE_KEY + ".forceBackgroundExecution"; //$NON-NLS-1$ - - /** - * Boolean property controling if the printed test start, stop and delay information - * includes the time consumed from calling <code>setUp</code> and <code>tearDown</code>. - * <p> - * Default value is <b><code>false</code></b>. - */ - public static final String PROP_PERFORMANCE_TIMING_INCLUDE_SETUP_TEARDOWN = PROP_BASE_KEY + ".timingsIncludeSetupAndTearDown"; //$NON-NLS-1$ -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSETestLogCollectorDelegate.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSETestLogCollectorDelegate.java deleted file mode 100644 index dca415c7e..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSETestLogCollectorDelegate.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.core; - -import org.eclipse.core.runtime.IPath; - -/** - * Test log collector delegate interface contract. The test - * collector delegates will be called from the <code>RSECoreTestCase</code> - * in case the last test which had been run failed. - */ -public interface IRSETestLogCollectorDelegate { - - /** - * Returns the list of absolute file locations to included - * within the collected logs archive file. The returned - * absolute file locations must denote real existing files. - * Possible dynamic content to collect can be written to - * temporary files. The log collector delegate is responsible - * for removing these temporary files if the <code>dispose()</code> - * method is called. - * - * @return An array of absolute file locations. - */ - public IPath[] getAbsoluteLogFileLocations(); - - /** - * Signal the RSE test log collector delegate to dispose - * any resource created. Possibly created temporary files - * should be deleted. Open streams or handles should be - * closed. - */ - public void dispose(); -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSEViews.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSEViews.java deleted file mode 100644 index d77b49cd2..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSEViews.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.core; - -/** - * Defines the several unique shared RSE view ids. - */ -public interface IRSEViews { - - /** - * The unique remote systems perspective id. - */ - public final String RSE_PERSPECTIVE_ID = "org.eclipse.rse.ui.view.SystemPerspective"; //$NON-NLS-1$ - - /** - * The unique remote systems view id. - */ - public final String RSE_REMOTE_SYSTEMS_VIEW_ID = "org.eclipse.rse.ui.view.systemView"; //$NON-NLS-1$ - - /** - * The unique remote team view id. - */ - public final String RSE_TEAM_VIEW_ID = "org.eclipse.rse.ui.view.teamView"; //$NON-NLS-1$ - - /** - * The unique remote system details view id. - */ - public final String RSE_REMOTE_SYSTEMS_DETAILS_VIEW_ID = "org.eclipse.rse.ui.view.systemTableView"; //$NON-NLS-1$ - - /** - * The unique remote search view id. - */ - public final String RSE_REMOTE_SEARCH_VIEW_ID = "org.eclipse.rse.ui.view.SystemSearchView"; //$NON-NLS-1$ - - /** - * The unique remote scratchpad view id. - */ - public final String RSE_REMOTE_SCRATCHPAD_VIEW_ID = "org.eclipse.rse.ui.view.scratchpad.SystemScratchpadViewPart"; //$NON-NLS-1$ - - /** - * The unique remote monitor view id. - */ - public final String RSE_REMOTE_MONITOR_VIEW_ID = "org.eclipse.rse.ui.view.monitorView"; //$NON-NLS-1$ -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/RSECoreTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/RSECoreTestCase.java deleted file mode 100644 index a97b441cc..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/RSECoreTestCase.java +++ /dev/null @@ -1,954 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation. - * Martin Oberhuber (Wind River) - fix build against 3.2.1, fix javadoc errors - * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin - * Martin Oberhuber (Wind River) - [219086] flush event queue to shield tests from each other - * Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases - ********************************************************************************/ -package org.eclipse.rse.tests.core; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URL; -import java.text.DateFormat; -import java.util.Date; -import java.util.HashSet; -import java.util.Locale; -import java.util.Properties; -import java.util.Set; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import junit.framework.AssertionFailedError; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestListener; -import junit.framework.TestResult; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.persistence.IRSEPersistenceManager; -import org.eclipse.rse.tests.RSETestsPlugin; -import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition; -import org.eclipse.rse.ui.SystemBasePlugin; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IViewReference; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.WorkbenchException; -import org.osgi.framework.Bundle; - -/** - * Core RSE test case infrastructure implementation. - */ -public class RSECoreTestCase extends TestCase { - // Test properties storage. - private final Properties properties = new Properties(); - - // Internal. Used to remember view zoom state changes. - private final String PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED = "rseSystemsViewZoomStateChanged"; //$NON-NLS-1$ - - // Target name, if set. - private String targetName = null; - - // Client name, if set. - private static final String defaultClientName = (System.getProperty("os.name") + '.' + System.getProperty("os.arch")).replace(' ', '_'); - private String clientName = defaultClientName; - - /** - * Constructor. - */ - public RSECoreTestCase() { - this(null); - } - - /** - * Constructor. - * - * @param name The test name. - */ - public RSECoreTestCase(String name) { - super(name); - // clear out all properties on construction. - properties.clear(); - // initialize the core test properties - initializeProperties(); - } - - /** - * Set the name of the target platform against which this test runs. Must be - * done from Constructor. Used to filter tests in {@link #isTestDisabled()}. - * - * @param targetName target platform name. - */ - public void setTargetName(String targetName) { - this.targetName = targetName; - } - - /** - * Set the name of the client platform on which this test runs. Usually not - * necessary, since the default is computed automatically. If set, this must - * be done from the Constructor. Used to filter tests in - * {@link #isTestDisabled()}. - * - * @param clientName client platform name. - */ - public void setClientName(String clientName) { - this.clientName = clientName; - } - - // ***** Test properties management and support methods ***** - - /** - * Initialize the core test properties. Override to modify core - * test properties or to add additional ones. - */ - protected void initializeProperties() { - setProperty(IRSECoreTestCaseProperties.PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW, false); - setProperty(IRSECoreTestCaseProperties.PROP_SWITCH_TO_PERSPECTIVE, IRSEViews.RSE_PERSPECTIVE_ID); - setProperty(IRSECoreTestCaseProperties.PROP_FORCE_BACKGROUND_EXECUTION, false); - setProperty(IRSECoreTestCaseProperties.PROP_PERFORMANCE_TIMING_INCLUDE_SETUP_TEARDOWN, false); - setProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, false); - } - - /** - * Enables or disables the specified property. - * - * @param key The key of the property to enable or disable. Must be not <code>null</code>! - * @param enable Specify <code>true</code> to enable the property, <code>false</code> to disable the property. - */ - protected final void setProperty(String key, boolean enable) { - setProperty(key, enable ? Boolean.TRUE.toString() : Boolean.FALSE.toString()); - } - - /** - * Test if the specified property is equal to the specified value. - * - * @param key The key of the property to test. Must be not <code>null</code>! - * @param value The value to compare the property with. - * @return <code>true</code> if the property is equal to the specified value, <code>false</code> otherwise. - */ - protected final boolean isProperty(String key, boolean value) { - assert key != null; - return (value ? Boolean.TRUE : Boolean.FALSE).equals(Boolean.valueOf(properties.getProperty(key, "false"))); //$NON-NLS-1$ - } - - /** - * Sets the specified string value for the specified property. If the specified - * value is <code>null</code>, the specified property will be removed. - * - * @param key The key of the property to set. Must be not <code>null</code>! - * @param value The string value to set or <code>null</code>. - */ - protected final void setProperty(String key, String value) { - assert key != null; - if (key != null) { - if (value != null) { - properties.setProperty(key, value); - } else { - properties.remove(key); - } - } - } - - /** - * Test if the specified property is equal to the specified value. If the specified - * value is <code>null</code>, this method returns <code>true</code> if the specified - * property key does not exist. The comparisation is case insensitive. - * - * @param key The key of the property to test. Must be not <code>null</code>! - * @param value The value to compare the property with or <code>null</code> - * @return <code>true</code> if the property is equal to the specified value - * or the specified value is <code>null</code> and the property does not exist, - * <code>false</code> otherwise. - */ - protected final boolean isProperty(String key, String value) { - assert key != null; - if (value != null) { - return value.equalsIgnoreCase(properties.getProperty(key)); - } - return !properties.containsKey(key); - } - - /** - * Returns the configured string value of the specified property. - * - * @param key The property key. Must be not <code>null</code>. - * @return The property value or <code>null</code> if the specified property does not exist. - */ - protected final String getProperty(String key) { - assert key != null; - return properties.getProperty(key, null); - } - - /** - * Return the fully qualified name of the unit test currently running. Used - * for pattern matching against enablement rules. Qualification is - * "OS_Name"."OS_Arch"."Testclass"."methodname"."connectiontype" where the - * connectiontype may be empty if not specified. - * - * @return the fully qualified name of the unit test currently running. - */ - protected String getTestNameForCheck() { - String testName = getName(); - String testClass = getClass().getName(); - String testPackage = getClass().getPackage().getName(); - String testClassSimpleName = testClass.substring(testPackage.length() + 1); - String checkName = testClassSimpleName + '.' + testName; - if (targetName != null) { - checkName = checkName + '.' + targetName; - } - if (clientName != null) { - checkName = clientName + '.' + checkName; - } - return checkName; - } - - /** - * Check whether this test is currently disabled. Uses Introspection and - * JUnit Test Name to check against user-specified Properties file. Note - * that by default, all tests are enabled. - * - * @return true if this test should run, false otherwise. - */ - protected boolean isTestDisabled() { - String testName = getName(); - String testClass = getClass().getName(); - String testPackage = getClass().getPackage().getName(); - String testClassSimpleName = testClass.substring(testPackage.length() + 1); - String checkName = testClassSimpleName + '.' + testName; - String checkString = checkName; - if (!RSETestsPlugin.isTestCaseEnabled(checkString)) { - System.out.println("--> disabled due to rule: " + checkString); - return true; - } - checkString = testClassSimpleName + ".*"; - if (!RSETestsPlugin.isTestCaseEnabled(checkString)) { - System.out.println("--> disabled due to rule: " + checkString); - return true; - } - checkString = "*." + testName; - if (!RSETestsPlugin.isTestCaseEnabled(checkString)) { - System.out.println("--> disabled due to rule: " + checkString); - return true; - } - if (targetName != null) { - checkString = "*." + targetName; - if (!RSETestsPlugin.isTestCaseEnabled(checkString)) { - System.out.println("--> disabled due to rule: " + checkString); - return true; - } - checkString = checkName + '.' + targetName; - if (!RSETestsPlugin.isTestCaseEnabled(checkString)) { - System.out.println("--> disabled due to rule: " + checkString); - return true; - } - if (clientName != null) { - checkString = getTestNameForCheck(); - if (!RSETestsPlugin.isTestCaseEnabled(checkString)) { - System.out.println("--> disabled due to rule: " + checkString); - return true; - } - } - } - if (clientName != null) { - checkString = clientName + ".*"; - if (!RSETestsPlugin.isTestCaseEnabled(checkString)) { - System.out.println("--> disabled due to rule: " + checkString); - return true; - } - checkString = clientName + '.' + checkName; - if (!RSETestsPlugin.isTestCaseEnabled(checkString)) { - System.out.println("--> disabled due to rule: " + checkString); - return true; - } - } - return false; - } - - // ***** Test case life cycle management and support methods ***** - - final static QualifiedName BACKGROUND_TEST_EXECUTION_FINISHED = new QualifiedName(RSETestsPlugin.getDefault().getBundle().getSymbolicName(), "background_test_execution_finished"); //$NON-NLS-1$ - - private final class RSEBackgroundTestExecutionJob extends Job { - private final TestResult result; - - /** - * Constructor. - * - * @param result The test result object the test is reporting failures to. Must be not <code>null</code>. - */ - public RSEBackgroundTestExecutionJob(TestResult result) { - super("RSE JUnit Test Case Execution Job"); //$NON-NLS-1$ - setUser(false); - setPriority(Job.INTERACTIVE); - setRule(ResourcesPlugin.getWorkspace().getRoot()); - - assert result != null; - this.result = result; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) - */ - protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask("Running test " + RSECoreTestCase.this.getName() + " ...", IProgressMonitor.UNKNOWN); //$NON-NLS-1$ //$NON-NLS-2$ - - // Execute the test now. - result.addListener(TEST_LISTENER); - invokeTestCaseRunImpl(result); - result.removeListener(TEST_LISTENER); - - monitor.done(); - - setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.TRUE); - - // The job never fails. The test result is the real result. - return Status.OK_STATUS; - } - } - - private final static class RSEBackgroundTestExecutionJobWaiter implements IInterruptCondition { - private final Job job; - - /** - * Constructor. - * - * @param job The job to wait for the execution to finish. Must be not <code>null</code>. - */ - public RSEBackgroundTestExecutionJobWaiter(Job job) { - assert job != null; - this.job = job; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition#isTrue() - */ - public boolean isTrue() { - // Interrupt the wait method if the job signaled that it has finished. - return ((Boolean)job.getProperty(BACKGROUND_TEST_EXECUTION_FINISHED)).booleanValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition#dispose() - */ - public void dispose() { /* nothing to dispose here */ } - } - - /** - * Internal accessor method to call the original <code>junit. - * framework.TestCase.run(TestResult) implementation. - * - * @param result The test result object the test is reporting failures to. Must be not <code>null</code>. - */ - final void invokeTestCaseRunImpl(TestResult result) { - super.run(result); - } - - /* (non-Javadoc) - * @see junit.framework.TestCase#run(junit.framework.TestResult) - */ - public final void run(TestResult result) { - if (isProperty(IRSECoreTestCaseProperties.PROP_FORCE_BACKGROUND_EXECUTION, false) - || !RSEWaitAndDispatchUtil.isDispatchThread()) { - // do not force test execution into background, just call super.run(result) - // from with the current thread. - result.addListener(TEST_LISTENER); - super.run(result); - result.removeListener(TEST_LISTENER); - } else { - // Create the background job - Job job = new RSEBackgroundTestExecutionJob(result); - // Initialize the BACKGROUND_EXECUTION_TEST_RESULT property - job.setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.FALSE); - // schedule the job to run immediatelly - job.schedule(); - - // wait till the job finished executing - RSEWaitAndDispatchUtil.waitAndDispatch(0, new RSEBackgroundTestExecutionJobWaiter(job)); - } - } - - /* (non-Javadoc) - * @see junit.framework.TestCase#runBare() - */ - public void runBare() throws Throwable { - // If PROP_PERFORMANCE_TIMING_INCLUDE_SETUP_TEARDOWN is set to true, - // print the timing information including the tests setUp and tearDown methods. - if (isProperty(IRSECoreTestCaseProperties.PROP_PERFORMANCE_TIMING_INCLUDE_SETUP_TEARDOWN, true)) { - // Print timing information here - long start = printTestStartInformation(getName()); - try { - super.runBare(); - } finally { - printTestEndInformation(getName(), start); - } - } else { - // Do no print timing information - super.runBare(); - } - } - - /* (non-Javadoc) - * @see junit.framework.TestCase#runTest() - */ - protected void runTest() throws Throwable { - // If PROP_PERFORMANCE_TIMING_INCLUDE_SETUP_TEARDOWN is set to false (default), - // print the timing information only the test method itself. - if (isProperty(IRSECoreTestCaseProperties.PROP_PERFORMANCE_TIMING_INCLUDE_SETUP_TEARDOWN, false)) { - // Print timing information here and run the test. - long start = printTestStartInformation(getName()); - try { - super.runTest(); - } finally { - printTestEndInformation(getName(), start); - } - } else { - // Do no print timing information, just run the test - super.runTest(); - } - } - - // Local date format presenting long date and time format. - private final DateFormat DATE_FORMAT = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.getDefault()); - - /** - * Print the start date and time of the specified test to stdout. - * - * @param name The name of the starting test. Must be not <code>null</code>! - * @return The start time of the test in milliseconds. - */ - protected long printTestStartInformation(String name) { - assert name != null; - long startTime = System.currentTimeMillis(); - if (name != null) { - System.out.println("\n=== " + name + " started at: " + DATE_FORMAT.format(new Date(startTime))); //$NON-NLS-1$ //$NON-NLS-2$ - } - return startTime; - } - - /** - * Print the end date and time as well as the delay of the specified test to stdout. - * - * @param name The name of the finished test. Must be not <code>null</code>! - * @param startTime The start time of the test in milliseconds. - */ - protected void printTestEndInformation(String name, long startTime) { - assert name != null; - long endTime = System.currentTimeMillis(); - if (name != null) { - long duration = endTime - startTime; - System.out.println("=== " + name + " finished at: " + DATE_FORMAT.format(new Date(endTime)) + " (duration: " + duration + " ms)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - } - - /** - * Wait until the SystemProfileManager has finished loading all "autoload" profiles, - * and the RSEUIPlugin InitRSEJob has finished filling it with the default connections. - * @throws InterruptedException when initialization is interrupted e.g. by shutting down Eclipse. - */ - protected void waitForRSEWorkspaceInit() throws InterruptedException { - //RSEUIPlugin is loaded automatically because RSETestsPlugins extends SystemBasePlugin, - //which is defined in org.eclipse.rse.ui, so we KNOW org.eclipse.rse.ui is started. - //TODO: At one point we want the tests to run headless, so then RSETestsPlugins should - //not extend SystemBasePlugin any more. - Job[] jobs = Job.getJobManager().find(null); - for(int i=0; i<jobs.length; i++) { - if ("Initialize RSE".equals(jobs[i].getName())) { //$NON-NLS-1$ - System.out.println("Waiting for InitRSEJob"); //$NON-NLS-1$ - jobs[i].join(); - break; - } - } - //The code below would never be necessary during normal initialization, - //Since the InitRSEJob takes care of loading the profiles already. - //We still wait here, in order to ensure that unit tests are really - //separate from each other. - final IRSEPersistenceManager pm = RSECorePlugin.getThePersistenceManager(); - while (!pm.isRestoreComplete() || pm.isBusy()) { - System.err.println("Waiting for Persistence Manager"); //$NON-NLS-1$ - Thread.sleep(100); - } - } - - /* (non-Javadoc) - * @see junit.framework.TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - waitForRSEWorkspaceInit(); - switchMaximizeSystemsView(); - } - - /** - * Flush the event queue in order to ensure that no left-over events influence later test cases. - * <p> - * Unhandled exceptions in the event loop event are caught as follows: - * In case multiple events from the event loop throw exceptions these are printed - * to stdout. The first exception found in the event loop is thrown to the caller. - * - * @throws Exception in case an unhandled event loop exception was found. - */ - protected void flushEventQueue() throws Exception { - Display display = Display.getCurrent(); - if (display!=null) { - //on the dispatch thread already - Exception eventLoopException = null; - while(!display.isDisposed()) { - //loop until event queue is flushed - try { - if (!display.readAndDispatch()) { - break; - } - } catch(Exception e) { - if (eventLoopException==null) { - eventLoopException = e; - } else { - System.out.println("Multiple unhandled event loop exceptions:"); - e.printStackTrace(); - } - } - } - if (eventLoopException!=null) { - throw eventLoopException; - } - } else { - //calling from background thread - final Exception[] ex = new Exception[1]; - display = Display.getDefault(); - display.syncExec(new Runnable() { - public void run() { - try { - flushEventQueue(); - } catch(Exception e) { - ex[0] = e; - } - } - }); - if (ex[0]!=null) throw ex[0]; - } - } - - /* (non-Javadoc) - * @see junit.framework.TestCase#tearDown() - */ - protected void tearDown() throws Exception { - restoreMaximizeSystemsView(); - //if running on main thread: wait until all asynchronous events are fired, - //in order to ensure that individual test cases do not influence each other - //See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=219086 - flushEventQueue(); - super.tearDown(); - } - - // ***** View and perspective management and support methods ***** - - /** - * Bring the RSE SystemsView to front, and toggle its "maximized" state based on what - * the {@link IRSECoreTestCaseProperties#PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW} property - * requires for the given test case. - * In case a Workbench Intro View is hiding every else because this is the first - * product launch, it is hidden. - */ - protected void switchMaximizeSystemsView() { - final String perspectiveId = getProperty(IRSECoreTestCaseProperties.PROP_SWITCH_TO_PERSPECTIVE); - assertNotNull("Invalid null-value for test case perspective id!", perspectiveId); //$NON-NLS-1$ - - // all view management must happen in the UI thread! - PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { - public void run() { - // in case the test case is launched within a new workspace, the eclipse intro - // view is hiding everything else. Find the intro page and hide it. - hideView("org.eclipse.ui.internal.introview", perspectiveId); //$NON-NLS-1$ - - // toggle the Remote Systems View zoom state. - setProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, false); - IViewPart part = showView(IRSEViews.RSE_REMOTE_SYSTEMS_VIEW_ID, perspectiveId); - assertNotNull("RSE Remote System View is not available!", part); //$NON-NLS-1$ - // Unfortunately, for the zooming, we needs the view reference and not the view part :-( - IViewReference reference = findView(IRSEViews.RSE_REMOTE_SYSTEMS_VIEW_ID, perspectiveId); - assertNotNull("Failed to lookup view reference for RSE Remote Systems View!", reference); //$NON-NLS-1$ - if (reference.getPage().getPartState(reference) != IWorkbenchPage.STATE_MAXIMIZED - && isProperty(IRSECoreTestCaseProperties.PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW, true)) { - reference.getPage().toggleZoom(reference); - setProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, true); - } else if (reference.getPage().getPartState(reference) == IWorkbenchPage.STATE_MAXIMIZED - && isProperty(IRSECoreTestCaseProperties.PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW, false)) { - reference.getPage().toggleZoom(reference); - setProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, true); - } - } - }); - - // Give the UI a chance to repaint if the view zoom state changed - if (isProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, true)) { - System.err.println("Waiting for UI to repaint"); //$NON-NLS-1$ - RSEWaitAndDispatchUtil.waitAndDispatch(1000); - } - } - - /** - * Restore the RSE SystemsView to its previous state, in case the view state - * has been changed by {@link #switchMaximizeSystemsView()}. - */ - protected void restoreMaximizeSystemsView() { - // restore the original view zoom state - if (isProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, true)) { - final String perspectiveId = getProperty(IRSECoreTestCaseProperties.PROP_SWITCH_TO_PERSPECTIVE); - assertNotNull("Invalid null-value for test case perspective id!", perspectiveId); //$NON-NLS-1$ - - // all view management must happen in the UI thread! - PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { - public void run() { - IViewReference reference = findView(IRSEViews.RSE_REMOTE_SYSTEMS_VIEW_ID, perspectiveId); - assertNotNull("Failed to lookup view reference for RSE Remote Systems View!", reference); //$NON-NLS-1$ - if (reference.getPage().getPartState(reference) == IWorkbenchPage.STATE_MAXIMIZED - && isProperty(IRSECoreTestCaseProperties.PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW, true)) { - reference.getPage().toggleZoom(reference); - } else if (reference.getPage().getPartState(reference) != IWorkbenchPage.STATE_MAXIMIZED - && isProperty(IRSECoreTestCaseProperties.PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW, false)) { - reference.getPage().toggleZoom(reference); - } - setProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, false); - } - }); - } - } - - /** - * Finds the view reference for the view identified by the specified id. - * - * @param viewId The unique view id. Must be not <code>null</code>. - * @param perspectiveId The unique perspective id within the view should be searched. Must be not <code>null</code>. - * @return The view reference instance to the view or <code>null</code> if not available. - */ - public final IViewReference findView(String viewId, String perspectiveId) { - assert viewId != null && perspectiveId != null; - if (viewId == null || perspectiveId == null) return null; - - // First of all, we have to lookup the currently active workbench - // of the currently active workbench window. - IWorkbench workbench = PlatformUI.getWorkbench(); - assertNotNull("Failed to query current workbench instance!", workbench); //$NON-NLS-1$ - // and the corresponding currently active workbench window. - IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - assertNotNull("Failed to query currently active workbench window!", window); //$NON-NLS-1$ - - // Now we have to switch to the specified perspecitve - try { - workbench.showPerspective(perspectiveId, window); - } catch (WorkbenchException e) { - SystemBasePlugin.logError("Failed to switch to requested perspective (id = " + perspectiveId + ")!", e); //$NON-NLS-1$ //$NON-NLS-2$ - } - - // From the active workbench window, we need the active workbench page - IWorkbenchPage page = window.getActivePage(); - assertNotNull("Failed to query currently active workbench page!", page); //$NON-NLS-1$ - - return page.findViewReference(viewId); - } - - /** - * Shows and activate the view identified by the specified id. - * - * @param viewId The unique view id. Must be not <code>null</code>. - * @param perspectiveId The unique perspective id within the view should be activated. Must be not <code>null</code>. - * @return The view part instance to the view or <code>null</code> if it cannot be shown. - */ - public final IViewPart showView(String viewId, String perspectiveId) { - assert viewId != null && perspectiveId != null; - if (viewId == null || perspectiveId == null) return null; - - // First of all, we have to lookup the currently active workbench - // of the currently active workbench window. - IWorkbench workbench = PlatformUI.getWorkbench(); - assertNotNull("Failed to query current workbench instance!", workbench); //$NON-NLS-1$ - // and the corresponding currently active workbench window. - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - assertNotNull("Failed to query currently active workbench window!", window); //$NON-NLS-1$ - - // Now we have to switch to the specified perspecitve - try { - workbench.showPerspective(perspectiveId, window); - } catch (WorkbenchException e) { - SystemBasePlugin.logError("Failed to switch to requested perspective (id = " + perspectiveId + ")!", e); //$NON-NLS-1$ //$NON-NLS-2$ - } - - // From the active workbench window, we need the active workbench page - IWorkbenchPage page = window.getActivePage(); - assertNotNull("Failed to query currently active workbench page!", page); //$NON-NLS-1$ - - IViewPart part = null; - try { - part = page.showView(viewId); - } catch (PartInitException e) { - SystemBasePlugin.logError("Failed to show view (id = " + viewId + ")!", e); //$NON-NLS-1$ //$NON-NLS-2$ - } - - return part; - } - - /** - * Hides the view identified by the specified id. - * - * @param viewId The unique view id. Must be not <code>null</code>. - * @param perspectiveId The unique perspective id the view should be hidden from. Must be not <code>null</code>. - */ - public final void hideView(String viewId, String perspectiveId) { - assert viewId != null && perspectiveId != null; - if (viewId == null || perspectiveId == null) return; - - IViewReference viewReference = findView(viewId, perspectiveId); - if (viewReference != null) { - // at this point we can safely asume that we can access the active page directly - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().hideView(viewReference); - // give the UI a chance to execute the hideView and repaint - RSEWaitAndDispatchUtil.waitAndDispatch(1000); - } - } - - // ***** Test data management and support methods ***** - - /** - * Returns the absolute test data location path calculated out of the known - * test data location root (<i>org.eclipse.rse.tests plugin location + sub - * directory 'test.data'</i>), the specified relative path (<i>relative to the - * test data location root</i>) and the current execution host operating system - * string (<i>if requested</i>). The method will test the resulting location - * to be: <br> - * <ul> - * <li>an directory and</li> - * <li>is readable.</li> - * </ul><br> - * If the calculated test data location does not pass these conditions, the - * method will return <code>null</code>. - * - * @param relativePath A path relative to the test data location root path. Must be not <code>null</code! - * @param appendHostOS <code>True</code> if to append the current execution host operating system string, <code>false</code> otherwise. - * - * @return The root path to the test data location or <code>null</code> if the test data location does cannot be read or is not a directory. - */ - protected final IPath getTestDataLocation(String relativePath, boolean appendHostOS) { - assert relativePath != null; - IPath root = null; - - if (relativePath != null) { - Bundle bundle = RSETestsPlugin.getDefault().getBundle(); - if (bundle != null) { - // build up the complete relative path - IPath relative = new Path ("test.data").append(relativePath); //$NON-NLS-1$ - if (appendHostOS) relative = relative.append(Platform.getOS()); - - URL url = FileLocator.find(bundle, relative, null); - if (url != null) { - try { - // Resolve the URL to an absolute path - root = new Path(FileLocator.resolve(url).getFile()); - // test the resulting path element to be accessible - if (!root.toFile().isDirectory() || !root.toFile().canRead()) { - root = null; - } - } catch (IOException e) { /* ignored on purpose */ } - } - } - } - - return root; - } - - // ***** Test failures log collector management and support methods ***** - - final TestListener TEST_LISTENER = new RSETestFailureListener(); - - /** - * Listens to the test executions and collect the test log files - * through the known list of test log collector delegates in a test - * had an error or failed. - */ - class RSETestFailureListener implements TestListener { - - /* (non-Javadoc) - * @see junit.framework.TestListener#startTest(junit.framework.Test) - */ - public void startTest(Test test) { - // nothing to do on start test - } - - /* (non-Javadoc) - * @see junit.framework.TestListener#addError(junit.framework.Test, java.lang.Throwable) - */ - public synchronized void addError(Test test, Throwable error) { - if (test != null && error != null) { - // Log the error to the error log. - IStatus status = new Status(IStatus.ERROR, - RSETestsPlugin.getDefault().getBundle().getSymbolicName(), - 1, - "RSE JUnit test case '" + test + "' failed with error. Possible cause: " + error.getLocalizedMessage(), //$NON-NLS-1$ //$NON-NLS-2$ - error - ); - RSETestsPlugin.getDefault().getLog().log(status); - - // Collect the log files if at least one test log collector is known - collectTestLogs(test); - } - } - - /* (non-Javadoc) - * @see junit.framework.TestListener#addFailure(junit.framework.Test, junit.framework.AssertionFailedError) - */ - public synchronized void addFailure(Test test, AssertionFailedError failure) { - if (test != null && failure != null) { - // Log the failure to the error log. - IStatus status = new Status(IStatus.ERROR, - RSETestsPlugin.getDefault().getBundle().getSymbolicName(), - 1, - "RSE JUnit test case '" + test + "' failed. Failure: " + failure.getLocalizedMessage(), //$NON-NLS-1$ //$NON-NLS-2$ - failure - ); - RSETestsPlugin.getDefault().getLog().log(status); - - // Collect the log files if at least one test log collector is known - collectTestLogs(test); - } - } - - /* (non-Javadoc) - * @see junit.framework.TestListener#endTest(junit.framework.Test) - */ - public void endTest(Test test) { - // nothing to do on end test - } - } - - /** - * Collect the test logs for the failed test. - * - * @param test The failed test. Must be not <code>null</code>. - */ - protected final synchronized void collectTestLogs(Test test) { - if (test != null) { - // get a snapshot of the currently known test log collector delegates - IRSETestLogCollectorDelegate[] delegates = RSETestsPlugin.getDefault().getTestLogCollectorDelegates(); - if (delegates.length > 0) { - // Write the logs to the test plugins state location. Check if older archives with the same - // name already exist and delete them. - IPath stateLocation = RSETestsPlugin.getDefault().getStateLocation(); - if (stateLocation != null && stateLocation.toFile().isDirectory()) { - // Build up the archives name - String archiveName = "RSEUnittestFailureLogs_" + test + ".zip"; //$NON-NLS-1$ //$NON-NLS-2$ - IPath archivePath = stateLocation.append(archiveName); - // Delete the target file if it exist. - if (archivePath.toFile().exists()) archivePath.toFile().delete(); - - // Now the file should not exist anymore --> open the new ZIP archive - ZipOutputStream stream = null; - try { - if (archivePath.toFile().createNewFile()) { - stream = new ZipOutputStream(new FileOutputStream(archivePath.toFile())); - stream.setLevel(9); - - // cache the names of the entries added to the ZIP stream. - // They needs to be unique! - Set nameCache = new HashSet(); - - // call each test log collector delegate for the absolute file names - // and add each of the returned files to the ZIP archive. - for (int i = 0; i < delegates.length; i++) { - IRSETestLogCollectorDelegate delegate = delegates[i]; - // get the list of log files to collect from the delegate - IPath[] locations = delegate.getAbsoluteLogFileLocations(); - if (locations != null && locations.length > 0) { - for (int j = 0; j < locations.length; j++) { - IPath location = locations[j]; - // The location is expected to be absolute, the file - // must be a file and it must be readable. - if (location != null && location.isAbsolute() - && location.toFile().isFile() && location.toFile().canRead()) { - File file = location.toFile(); - String entryName = file.getName(); - if (nameCache.contains(entryName)) { - // unify the name by prepending the directory elements in - // front of the name till it is unique. - IPath unifier = location.removeLastSegments(1); - entryName = unifier.lastSegment() + "_" + entryName; //$NON-NLS-1$ - while (nameCache.contains(entryName) && !unifier.isEmpty()) { - unifier = location.removeLastSegments(1); - entryName = unifier.lastSegment() + "_" + entryName; //$NON-NLS-1$ - } - - // if the name is still not unique, append a count to it - long count = 0; - // force to make a copy of the current name - String base = new String(entryName.getBytes()); - while (nameCache.contains(entryName)) { - entryName = base + " (" + count + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - count++; - } - } else { - nameCache.add(entryName); - } - - ZipEntry zipEntry = new ZipEntry(entryName); - zipEntry.setTime(file.lastModified()); - stream.putNextEntry(zipEntry); - - // Read the file bytewise and write it bytewise to the ZIP - BufferedInputStream fileStream = null; - try { - fileStream = new BufferedInputStream(new FileInputStream(file)); - int character = fileStream.read(); - while (character >= 0) { - stream.write(character); - character = fileStream.read(); - } - } catch (IOException e) { - if (Platform.inDebugMode()) e.printStackTrace(); - } finally { - // Explicitly catch the possible IOException of the close() call here. - // This keep the loop going, otherwise we would drop out of all. - try { if (fileStream != null) fileStream.close(); } catch (IOException e) { if (Platform.inDebugMode()) e.printStackTrace(); } - stream.closeEntry(); - } - } - } - } - - // If done with the current test log collector delegate, signal the delegate to dispose himself. - // This gives the delegate the chance to remove any possibly created temporary file. - delegate.dispose(); - } - } - } catch(IOException e) { - /* ignored on purpose */ - } finally { - // always close the stream if open - try { if (stream != null) stream.close(); } catch (IOException e) { if (Platform.inDebugMode()) e.printStackTrace(); } - } - } - } - } - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/RSEWaitAndDispatchUtil.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/RSEWaitAndDispatchUtil.java deleted file mode 100644 index b9445e747..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/RSEWaitAndDispatchUtil.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.core; - -import org.eclipse.swt.widgets.Display; - -/** - * RSE unit test framework helper class providing common functionality - * to hold the current thread from execution time out and/or condition - * based. - * <p> - * <b>Note:</b> The class cannot be instantiated as all provided methods - * are declared static! - */ -public final class RSEWaitAndDispatchUtil { - - /** - * Private constructor. - */ - private RSEWaitAndDispatchUtil() { - // nothing to do. The class cannot be instantiated. - } - - /** - * Checks if the current thread is a dispatch (UI) thread or not. - * - * @return <code>True</code> if the current thread is a dispatch thread, <code>false</code> otherwise. - */ - public static boolean isDispatchThread() { - return Display.findDisplay(Thread.currentThread()) != null; - } - - /** - * Blocks the calling thread from execution till the specified - * time out has exceeded. If the calling thread is an display thread, - * the display event dispatching will be kept going during this time. - * The method will return immediately if any time out less or equal - * to 0 is specified. - * - * @param timeout The time to wait till the method return in milliseconds. Must be larger than 0. - */ - public static void waitAndDispatch(long timeout) { - assert timeout > 0; - if (timeout > 0) { - long start = System.currentTimeMillis(); - final Display display = Display.findDisplay(Thread.currentThread()); - if (display != null) { - // ok, we are running within a display thread --> keep the - // display event dispatching running. - long current = System.currentTimeMillis(); - while ((current - start) < timeout && !display.isDisposed()) { - //See EventLoopProgressMonitor.runEventLoop(): - //Usually, we should embed the display.readAndDispatch() inside a - //try...catch construct in order to continue running the loop even - //if an exception occurs, since that exception is not necessarlily - //related to the test code. - //Here, however, we deliberately let exception fall through in the - //hope that seeing it in the test helps finding the issue that causes - //the unhandled event loop exception. - if (!display.readAndDispatch()) display.sleep(); - current = System.currentTimeMillis(); - } - } else { - // we are not running within a display thread --> we can - // just block the thread here - try { Thread.sleep(timeout); } catch (InterruptedException e) { /* ignored on purpose */ } - } - } - } - - /** - * Public interface used to interrupt waiting for a condition to - * come true and/or a timeout occurs. - */ - public interface IInterruptCondition { - /** - * Test if the interrupt condition is <code>true</code>. - * - * @return <code>true</code> if the condition is fulfilled and the wait method should return, <code>false</code> otherwise. - */ - public boolean isTrue(); - - /** - * Dispose the interrupt condition. Cleanup whatever necessary. - * This method will be called only once just before the wait - * method returns. - */ - public void dispose(); - } - - /** - * Blocks the calling thread from execution till the specified - * time out has exceeded or the specified interrupt condition is <code>true</code>. - * If the calling thread is an display thread, the display event dispatching will - * be kept going during this time. The method will return immediately if any time - * out less than 0 is specified or the interrupt condition is <code>true</code> from - * the beginning. If a time out of 0 is specified, the method will be wait indefinite - * amount of time till the interrupt condition ever becomes <code>true</code>. - * - * @param timeout The time to wait till the method return in milliseconds. Must be larger or equals than 0. - * @param condition The interrupt condition to test. Must be not <code>null</code>. - * @return <code>True</code> if the method returned because of the timeout, <code>false</code> if the - * method returned because of the condition became true. - */ - public static boolean waitAndDispatch(long timeout, IInterruptCondition condition) { - assert timeout >= 0 && condition != null; - - boolean isTimedOut= false; - if (timeout >= 0 && condition != null) { - long start = System.currentTimeMillis(); - final Display display = Display.findDisplay(Thread.currentThread()); - if (display != null) { - // ok, we are running within a display thread --> keep the - // display event dispatching running. - long current = System.currentTimeMillis(); - while (timeout == 0 || (current - start) < timeout && !display.isDisposed()) { - if (condition.isTrue()) break; - if (!display.readAndDispatch()) display.sleep(); - current = System.currentTimeMillis(); - } - isTimedOut = (current - start) >= timeout && timeout > 0; - } else { - // ok, we are not running within a display thread --> we can - // just block the thread here - long current = System.currentTimeMillis(); - while (timeout == 0 || (current - start) < timeout) { - if (condition.isTrue()) break; - try { Thread.sleep(50); } catch (InterruptedException e) { /* ignored on purpose */ } - current = System.currentTimeMillis(); - } - isTimedOut = (current - start) >= timeout && timeout > 0; - } - } - - // Signal the interrupt condition that we are done here - // and it can cleanup whatever necessary. - condition.dispose(); - - return isTimedOut; - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/IRSEConnectionManager.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/IRSEConnectionManager.java deleted file mode 100644 index 98b5a21d3..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/IRSEConnectionManager.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.core.connection; - -import java.util.Properties; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystem; - -/** - * Interfaces declares public access and factory methods to deal - * with RSE connections and artefacts. - */ -public interface IRSEConnectionManager { - - /** - * Loads the connection properties from the specified file. The - * file must exist and must be a valid formated properties file. - * <p> - * Note: The loaded properties will be underlayed by a set of default - * properties. The default properties will be loaded from the - * file <code><bundle_location>/src/org/eclipse/rse/tests/internal/connectionDefault.properties</code>. - * <p> - * @param path The properties file location. Must be not <code>null</code>. - * @param allowDefaults Specify <code>true</code> to allow to underlay the connection properties with default, - * <code>false</code> otherwise. - * - * @return The corresponding <code>IRSEConnectionProperties</code> object or <code>null</code> - * if the loading of the properties fails. - * - * @see java.util.Properties - * @see org.eclipse.rse.tests.core.connection.IRSEConnectionProperties - */ - public IRSEConnectionProperties loadConnectionProperties(IPath path, boolean allowDefaults); - - /** - * Loads the connection properties using the given set of potential - * incomplete properties and the default properties. - * - * @param properties The connection properties. Must be not <code>null</code> - * @param allowDefaults Specify <code>true</code> to allow to underlay the connection properties with default, - * <code>false</code> otherwise. - * - * @return The corresponding <code>IRSEConnectionProperties</code> object or <code>null</code> - * if the loading of the properties fails. - * - * @see java.util.Properties - * @see org.eclipse.rse.tests.core.connection.IRSEConnectionProperties - */ - public IRSEConnectionProperties loadConnectionProperties(Properties properties, boolean allowDefaults); - - /** - * Removes the connection given by the specified name/label from the specified - * system profile. The method will do nothing if either the system profile or - * the connection does not exist. - * - * @param profileName The system profile to remove the connection from. Must be not <code>null</code>. - * @param name The name of the connection to remove. Must be not <code>null</code>. - */ - public void removeConnection(String profileName, String name); - - /** - * Lookup the connection described by the given connection properties. If - * the described connection does not exist, the connection (and all required - * RSE artifacts) will be created. - * - * @param properties The connection properties. Must be not <code>null</code>. - * @return The corresponding <code>IHost</code> connection object. - */ - public IHost findOrCreateConnection(IRSEConnectionProperties properties); - - /** - * Get the file subsystem, matching the specified configuration id, for the specified connection. - * - * @param connection The corresponding <code>IHost</code> connection object. Must be not <code>null</code>. - * @param desiredConfigurationId The subsystem configuration id of the desired subsystem. Must be not <code>null</code>. - * - * @return The file subsystem object if found or <code>null</code>. - * - * @throws Exception If the file subsystem lookup fails. - */ - public FileServiceSubSystem getFileSubSystem(IHost connection, String desiredConfigurationId) throws Exception; - - /** - * Get the shell subsystem for the specified connection. - * - * @param connection The corresponding <code>IHost</code> connection object. Must be not <code>null</code>. - * @return The shell subsystem object if found or <code>null</code>. - * - * @throws Exception If the shell subsystem lookup fails. - */ - public IShellServiceSubSystem getShellSubSystem(IHost connection) throws Exception; - - - /** - * Get the testsubsystem for the specified connection. - * - * @param connection The corresponding <code>IHost</code> connection object. Must be not <code>null</code>. - * @return The testsubsystem object if found or <code>null</code>. - * - * @throws Exception If the testsubsystem lookup fails. - */ - public ITestSubSystem getTestSubSystem(IHost connection) throws Exception; -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/IRSEConnectionProperties.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/IRSEConnectionProperties.java deleted file mode 100644 index 6e449bbf8..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/IRSEConnectionProperties.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - Support REXEC launch type for dstore - *******************************************************************************/ -package org.eclipse.rse.tests.core.connection; - -/** - * Interface declares public access and management methods to deal - * with the RSE connection specific properties. - */ -public interface IRSEConnectionProperties { - - public final String ATTR_NAME = "name"; //$NON-NLS-1$ - public final String ATTR_PROFILE_NAME = "profile_name"; //$NON-NLS-1$ - public final String ATTR_SYSTEM_TYPE_ID = "system_type_id"; //$NON-NLS-1$ - public final String ATTR_ADDRESS = "address"; //$NON-NLS-1$ - public final String ATTR_USERID = "userid"; //$NON-NLS-1$ - public final String ATTR_PASSWORD = "password"; //$NON-NLS-1$ - public final String ATTR_DAEMON_PORT = "daemon_port"; //$NON-NLS-1$ - public final String ATTR_REXEC_PORT = "rexec_port"; //$NON-NLS-1$ - public final String ATTR_SERVER_LAUNCH_TYPE = "launch_type"; //$NON-NLS-1$ - public final String ATTR_SERVER_PATH = "dstore_server_path"; //$NON-NLS-1$ - public final String ATTR_SERVER_SCRIPT = "dstore_server_script"; //$NON-NLS-1$ - - /** - * Returns the associated property stored under the specified key. - * - * @param key The property key. Must be not <code>null</code>. - * @return The properties value or <code>null</code> if not set. - */ - public String getProperty(String key); - - /** - * Set the property, given by the specified key, to the specified - * property value. If the specified value is <code>null</code>, the - * property will be removed. - * - * @param key The property key. Must be not <code>null</code>. - * @param value The property value or <code>null</code> - */ - public void setProperty(String key, String value); -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java deleted file mode 100644 index f576e9fb3..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Don Yantzi (IBM) - initial contribution. - * David Dykstal (IBM) - initial contribution. - * Uwe Stieber (Wind River) - refactoring and cleanup. - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Xuan Chen (IBM) - [198859] Update the API doc for getRemoteSystemConnection. - * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems - *******************************************************************************/ -package org.eclipse.rse.tests.core.connection; - -import java.util.Properties; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.tests.core.RSECoreTestCase; -import org.eclipse.rse.tests.internal.RSEConnectionManager; -import org.eclipse.rse.ui.ISystemPreferencesConstants; -import org.eclipse.rse.ui.RSEUIPlugin; - -/** - * Abstract superclass for JUnit PDE test cases that require an IHost. - * This superclass creates a single RSE IHost that can - * be reused by multiple testcases run during the same PDE invocation. - */ -public class RSEBaseConnectionTestCase extends RSECoreTestCase { - private final IRSEConnectionManager connectionManager = new RSEConnectionManager(); - private final IRSEConnectionProperties localSystemConnectionProperties; - - /** - * Constructor. - */ - public RSEBaseConnectionTestCase() { - this(null); - } - - /** - * Constructor. - * - * @param name The test name. - */ - public RSEBaseConnectionTestCase(String name) { - super(name); - - // Pre-create the local system connection properties - Properties properties = new Properties(); - properties.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID, IRSESystemType.SYSTEMTYPE_LOCAL_ID); - properties.setProperty(IRSEConnectionProperties.ATTR_ADDRESS, "localhost"); //$NON-NLS-1$ - properties.setProperty(IRSEConnectionProperties.ATTR_NAME, "Local"); //$NON-NLS-1$ - localSystemConnectionProperties = getConnectionManager().loadConnectionProperties(properties, false); - } - - /** - * Returns the associated RSE connection manager instance. - * - * @return The connection manager instance. Should be never <code>null</code>. - */ - protected IRSEConnectionManager getConnectionManager() { - return connectionManager; - } - - /** - * Lookup and return the local system type connection. This connection - * should be usually available on all systems. - * - * @return The local system type connection or <code>null</code> if the lookup fails. - */ - protected IHost getLocalSystemConnection() { - setTargetName("local"); - if (isTestDisabled()) - return null; - assertNotNull("Local system connection properties are not available!", localSystemConnectionProperties); //$NON-NLS-1$ - - Exception exception = null; - String cause = null; - - IHost connection = null; - try { - connection = getConnectionManager().findOrCreateConnection(localSystemConnectionProperties); - } catch (Exception e) { - exception = e; - cause = exception.getLocalizedMessage(); - } - assertNull("Failed to find and create local system connection! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertNotNull("Failed to find and create local system connection! Cause unknown!", connection); //$NON-NLS-1$ - - return connection; - } - - protected IHost getSSHHost() - { - setTargetName("ssh"); - if (isTestDisabled()) - return null; - return getHost("sshConnection.properties"); - } - - protected IHost getFTPHost() - { - setTargetName("ftp"); - if (isTestDisabled()) - return null; - return getHost("ftpConnection.properties"); - } - - protected IHost getLinuxHost() - { - setTargetName("linux"); - if (isTestDisabled()) - return null; - return getHost("linuxConnection.properties"); - } - - protected IHost getWindowsHost() - { - setTargetName("windows"); - if (isTestDisabled()) - return null; - return getHost("windowsConnection.properties"); - } - - protected IHost getHost(String propertiesFileName) { - IHost host; - - // Calculate the location of the test connection properties - IPath location = getTestDataLocation("", false); //$NON-NLS-1$ - assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$ - location = location.append(propertiesFileName); - assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$ - assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$ - assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$ - - // Load the properties from the calculated location without backing up defaults - IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false); - assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$ - - // Lookup and create the connection now if necessary - host = getConnectionManager().findOrCreateConnection(properties); - assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), host); //$NON-NLS-1$ - - // For connections with dstore, need to disable SSL alerts - // since the UI messagebox on connect would make the test hang - ISubSystem[] ss = host.getSubSystems(); - for (int i = 0; i < ss.length; i++) { - String id = ss[i].getSubSystemConfiguration().getId(); - if (id.indexOf("dstore.") >= 0) { - IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore(); - ////Ensure that the SSL acknowledge dialog does not show up. - ////We no longer need to setDefault first in order to set the value of a preference. - ////Since this is now in connectorservice.dstore/Activator, and it's sure to be active here - // store.setDefault(ISystemPreferencesConstants.ALERT_SSL,ISystemPreferencesConstants.DEFAULT_ALERT_SSL); - // store.setDefault(ISystemPreferencesConstants.ALERT_NONSSL, ISystemPreferencesConstants.DEFAULT_ALERT_NON_SSL); - store.setValue(ISystemPreferencesConstants.ALERT_SSL, false); - store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, false); - break; - } - } - - return host; - } - - /** - * Lookup/create and return the remote system connection according to the list of system parameters. - * @param systemTypeID The type id string of the remote system. - * @param systemAddress The address of the remote system. - * @param systemName The connection name. - * @param userID The user id used to logon to the remote system. - * @param password The password of the user id to logon to the remote system. - * - * @return The remote system connection or <code>null</code> if the lookup/creation fails. - */ - protected IHost getRemoteSystemConnection(String systemTypeID, String systemAddress, String systemName, String userID, String password) { - - Exception exception = null; - String cause = null; - // Pre-create the local system connection properties - Properties properties = new Properties(); - properties.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID, systemTypeID); - properties.setProperty(IRSEConnectionProperties.ATTR_ADDRESS, systemAddress); - properties.setProperty(IRSEConnectionProperties.ATTR_NAME, systemName); - properties.setProperty(IRSEConnectionProperties.ATTR_USERID, userID); - if (password != null) - properties.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, password); - - IRSEConnectionProperties remoteSystemConnectionProperties; - remoteSystemConnectionProperties = getConnectionManager().loadConnectionProperties(properties, false); - - IHost connection = null; - try { - connection = getConnectionManager().findOrCreateConnection(remoteSystemConnectionProperties); - } catch (Exception e) { - exception = e; - cause = exception.getLocalizedMessage(); - } - assertNull("Failed to find and create remote system connection! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertNotNull("Failed to find and create remote system connection! Cause unknown!", connection); //$NON-NLS-1$ - - return connection; - } - - protected IProgressMonitor getDefaultProgressMonitor() { - return new NullProgressMonitor(); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java deleted file mode 100644 index 2b0d6fd39..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java +++ /dev/null @@ -1,283 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Don Yantzi (IBM) - initial contribution. - * David Dykstal (IBM) - initial contribution. - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API - * David McKnight (IBM) - [186363] get rid of obsolete calls to SubSystem.connect() - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - ********************************************************************************/ -package org.eclipse.rse.tests.core.connection; - -import java.util.Properties; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.events.ISystemResourceChangeEvents; -import org.eclipse.rse.core.events.SystemResourceChangeEvent; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.ui.ISystemPreferencesConstants; -import org.eclipse.rse.ui.RSEUIPlugin; - -/** - * Basic connection tests. - */ -public class RSEConnectionTestCase extends RSEBaseConnectionTestCase { - - public RSEConnectionTestCase(String name) { - super(name); - } - - /** - * Check whether connections are case sensitive - */ - public void testConnectionCaseInSensitive() throws Exception { - // -test-author-:MartinOberhuber - if (isTestDisabled()) - return; - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - ISystemProfile prof = RSECorePlugin.getTheSystemProfileManager().getDefaultPrivateSystemProfile(); - ISystemProfile testprof = RSECorePlugin.getTheSystemProfileManager().cloneSystemProfile(prof, "testConnectionCaseInSensitive"); - IHost h1 = sr.createLocalHost(testprof, "TestConn", "mober"); - assertNotNull(h1); - assertEquals(h1.getAliasName(), "TestConn"); - - // Case variant of connection is found in profile - IHost h2 = sr.getHost(testprof, "testCONN"); - assertNotNull(h2); - assertEquals(h1, h2); - - sr.deleteSystemProfile(testprof); - } - - /** - * Creating/disposing elements in the systemView can lead - * to "Widget is disposed" exception when Refresh is called - * rarely so there is much to refresh. This might be due to - * the elementComparer only comparing by absolute name. - */ - public void testBug255023() throws Exception { - // -test-author-:MartinOberhuber - if (isTestDisabled()) - return; - Job j = new Job("testBug255023") { - - protected IStatus run(IProgressMonitor monitor) { - try { - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - ISystemProfile prof = sr.createSystemProfile("Foo", true); - IRSESystemType st = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID); - IHost h1 = sr.createHost("Foo", st, "vxsim0", "localhost", "vxsim0"); - IHost h2 = sr.createHost("Foo", st, "vxsim1", "localhost", "vxsim1"); - IHost h3 = sr.createHost("Foo", st, "vxsim2", "localhost", "vxsim2"); - sr.fireEvent(new SystemResourceChangeEvent(sr, ISystemResourceChangeEvents.EVENT_REFRESH, null)); - // flushEventQueue(); - Thread.sleep(10000); - sr.deleteHost(h1); - sr.deleteHost(h2); - sr.deleteHost(h3); - // // Firing a refresh event here, after deleting the hosts - // // but before adding the new one, makes the bug - // disappear. - // // Perhaps a correct fix would be that our content - // provider - // // refreshes the view right away by means of a listener, - // // instead of relying on forced manual refresh only. - // sr.fireEvent(new SystemResourceChangeEvent(sr, - // ISystemResourceChangeEvents.EVENT_REFRESH, null)); - IHost h4 = sr.createHost("Foo", st, "vxsim1", "localhost", "vxsim1"); - sr.fireEvent(new SystemResourceChangeEvent(sr, ISystemResourceChangeEvents.EVENT_REFRESH, null)); - // flushEventQueue(); // will throw exception in main Thread! - Thread.sleep(10000); - sr.deleteSystemProfile(prof); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - return Status.OK_STATUS; - } - }; - j.schedule(); - while (j.getState() != Job.NONE) { - flushEventQueue(); - } - } - - /** - * Test creation of connections. - */ - public void testConnectionCreation() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - - Properties properties = new Properties(); - properties.setProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME, "TestProfile"); //$NON-NLS-1$ - properties.setProperty(IRSEConnectionProperties.ATTR_NAME, "TestHost1"); //$NON-NLS-1$ - properties.setProperty(IRSEConnectionProperties.ATTR_ADDRESS, "localhost"); //$NON-NLS-1$ - properties.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID, IRSESystemType.SYSTEMTYPE_UNIX_ID); - properties.setProperty(IRSEConnectionProperties.ATTR_USERID, "userid"); //$NON-NLS-1$ - properties.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, "password"); //$NON-NLS-1$ - - IRSEConnectionProperties props = getConnectionManager().loadConnectionProperties(properties, false); - IHost connection = getConnectionManager().findOrCreateConnection(props); - assertNotNull("Failed to create connection " + props.getProperty(IRSEConnectionProperties.ATTR_NAME), connection); //$NON-NLS-1$ - - props.setProperty(IRSEConnectionProperties.ATTR_NAME, "TestHost2"); //$NON-NLS-1$ - connection = getConnectionManager().findOrCreateConnection(props); - assertNotNull("Failed to create connection " + props.getProperty(IRSEConnectionProperties.ATTR_NAME), connection); //$NON-NLS-1$ - - props.setProperty(IRSEConnectionProperties.ATTR_NAME, "TestHost3"); //$NON-NLS-1$ - connection = getConnectionManager().findOrCreateConnection(props); - assertNotNull("Failed to create connection " + props.getProperty(IRSEConnectionProperties.ATTR_NAME), connection); //$NON-NLS-1$ - - props.setProperty(IRSEConnectionProperties.ATTR_NAME, "TestHost4"); //$NON-NLS-1$ - connection = getConnectionManager().findOrCreateConnection(props); - assertNotNull("Failed to create connection " + props.getProperty(IRSEConnectionProperties.ATTR_NAME), connection); //$NON-NLS-1$ - - props.setProperty(IRSEConnectionProperties.ATTR_NAME, "TestHost5"); //$NON-NLS-1$ - connection = getConnectionManager().findOrCreateConnection(props); - assertNotNull("Failed to create connection " + props.getProperty(IRSEConnectionProperties.ATTR_NAME), connection); //$NON-NLS-1$ - - props.setProperty(IRSEConnectionProperties.ATTR_NAME, "TestHost6"); //$NON-NLS-1$ - connection = getConnectionManager().findOrCreateConnection(props); - assertNotNull("Failed to create connection " + props.getProperty(IRSEConnectionProperties.ATTR_NAME), connection); //$NON-NLS-1$ - - props.setProperty(IRSEConnectionProperties.ATTR_NAME, "vxsim_128.11.75.12/4_Cores"); //$NON-NLS-1$ - connection = getConnectionManager().findOrCreateConnection(props); - assertNotNull("Failed to create connection " + props.getProperty(IRSEConnectionProperties.ATTR_NAME), connection); //$NON-NLS-1$ - - } - - /** - * Test removal of connections - */ - public void testConnectionRemoval() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - - String profileName = "TestProfile"; //$NON-NLS-1$ - - getConnectionManager().removeConnection(profileName, "TestHost1"); //$NON-NLS-1$ - getConnectionManager().removeConnection(profileName, "TestHost2"); //$NON-NLS-1$ - getConnectionManager().removeConnection(profileName, "TestHost3"); //$NON-NLS-1$ - getConnectionManager().removeConnection(profileName, "TestHost4"); //$NON-NLS-1$ - getConnectionManager().removeConnection(profileName, "TestHost5"); //$NON-NLS-1$ - getConnectionManager().removeConnection(profileName, "TestHost6"); //$NON-NLS-1$ - getConnectionManager().removeConnection(profileName, "vxsim_128.11.75.12/4_Cores"); //$NON-NLS-1$ - } - - /** - * Test the connect and disconnect methods - */ - public void testConnect() { - //-test-author-:DavidDykstal - IHost connection = getLocalSystemConnection(); - if (isTestDisabled()) - return; - - Exception exception = null; - String cause = null; - - ISubSystem subsystem = null; - try { - subsystem = getConnectionManager().getFileSubSystem(connection, "local.files"); //$NON-NLS-1$ - } catch(Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } - assertNull("Failed to get local.files subsystem! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertNotNull("No local.files subystem", subsystem); //$NON-NLS-1$ - - RSEUIPlugin.getDefault().getPreferenceStore().setValue(ISystemPreferencesConstants.ALERT_SSL, false); - RSEUIPlugin.getDefault().getPreferenceStore().setValue(ISystemPreferencesConstants.ALERT_NONSSL, false); - - exception = null; - cause = null; - - try { - subsystem.connect(false, null); - } catch(Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } - assertNull("Failed to connect local.files subsystem! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertTrue("local.files subsystem is not connected!", subsystem.isConnected()); //$NON-NLS-1$ - - exception = null; - cause = null; - - try { - subsystem.disconnect(); - } catch(Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } - assertNull("Failed to discconnect local.files subsystem! Possible cause: " + cause, exception); //$NON-NLS-1$ - // The local.files subsystem should be not disconnectable! - assertTrue("local.files subsystem is not connected but is expected to!", subsystem.isConnected()); //$NON-NLS-1$ - } - - /** - * Test resolving a filter string. - */ - public void testResolveFilterString() { - //-test-author-:DavidDykstal - IHost connection = getLocalSystemConnection(); - if (isTestDisabled()) - return; - - Exception exception = null; - String cause = null; - - ISubSystem subsystem = null; - try { - subsystem = getConnectionManager().getFileSubSystem(connection, "local.files"); //$NON-NLS-1$ - } catch(Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } - assertNull("Failed to get local.files subsystem! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertNotNull("No local.files subystem", subsystem); //$NON-NLS-1$ - - exception = null; - cause = null; - - try { - subsystem.connect(false, null); - } catch(Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } - assertNull("Failed to connect local.files subsystem! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertTrue("local.files subsystem is not connected!", subsystem.isConnected()); //$NON-NLS-1$ - - exception = null; - cause = null; - - Object[] objects = null; - try { - objects = subsystem.resolveFilterString("/bin/*", null); //$NON-NLS-1$ - } catch(Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } finally { - try { subsystem.disconnect(); } catch (Exception e) { /* ignored */ } - } - assertNull("Failed to resolve filter string for local.files subsystem! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertNotNull("Unexpected return value null for resolveFilterString!", objects); //$NON-NLS-1$ - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestSuite.java deleted file mode 100644 index 285d287c6..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestSuite.java +++ /dev/null @@ -1,57 +0,0 @@ -/* ******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial contribution. - * *******************************************************************************/ -package org.eclipse.rse.tests.core.connection; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -/** - * Main class bundling all RSE connection test cases. - */ -public class RSEConnectionTestSuite extends DelegatingTestSuiteHolder { - - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE Connection Test Suite"); //$NON-NLS-1$ - // add the single test suites to the overall one here. - suite.addTestSuite(RSEConnectionTestCase.class); - - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)RSEConnectionTestSuite.suite(); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/passwords/PasswordsTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/passwords/PasswordsTest.java deleted file mode 100644 index 8f5ff871a..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/passwords/PasswordsTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2008 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - [210474] Deny save password function missing - ********************************************************************************/ - -package org.eclipse.rse.tests.core.passwords; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.PasswordPersistenceManager; -import org.eclipse.rse.core.RSEPreferencesManager; -import org.eclipse.rse.core.model.SystemSignonInformation; -import org.eclipse.rse.internal.core.RSECoreRegistry; -import org.eclipse.rse.tests.core.RSECoreTestCase; - -/** - * Tests for {@link PasswordPersistenceManager}. - * Test various aspects of mnemonic generation and assignment. - */ -public class PasswordsTest extends RSECoreTestCase { - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testAddRemove() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - IRSESystemType systemType = RSECoreRegistry.getInstance().getSystemType(IRSESystemType.SYSTEMTYPE_UNIX_ID); - IRSESystemType defaultSystemType = PasswordPersistenceManager.DEFAULT_SYSTEM_TYPE; - String hostAddress = "somesystem.mycompany.com"; - boolean deny = RSEPreferencesManager.getDenyPasswordSave(systemType, hostAddress); - assertFalse("the initial value of this preference should be false", deny); - - String password = "password"; - String userId = "me"; - SystemSignonInformation info = new SystemSignonInformation(hostAddress, userId, password, systemType); - PasswordPersistenceManager ppm = PasswordPersistenceManager.getInstance(); - - // save a password - int result = ppm.add(info, true, true); - assertEquals("result of add was not what was expected", PasswordPersistenceManager.RC_OK, result); - SystemSignonInformation returnedInfo = ppm.find(systemType, hostAddress, userId); - assertEquals("passwords are not equal", password, returnedInfo.getPassword()); - assertEquals("system type not what was expected", systemType, returnedInfo.getSystemType()); - - // remove the password for the system type - ppm.remove(systemType, hostAddress, userId); // removes only the entry for the system type - returnedInfo = ppm.find(systemType, hostAddress, userId, true); - assertEquals("passwords are not equal", password, returnedInfo.getPassword()); - assertEquals("system type not what was expected", defaultSystemType, returnedInfo.getSystemType()); - returnedInfo = ppm.find(systemType, hostAddress, userId, false); - assertNull("signon info was found but should not be", returnedInfo); - - // remove the password for the default system type - ppm.remove(defaultSystemType, hostAddress, userId); - returnedInfo = ppm.find(systemType, hostAddress, userId, true); - assertNull("signon info was found but should not be", returnedInfo); - returnedInfo = ppm.find(systemType, hostAddress, userId, false); - assertNull("signon info was found but should not be", returnedInfo); - - // save a password just for the system type - result = ppm.add(info, true, false); - assertEquals("result of add was not what was expected", PasswordPersistenceManager.RC_OK, result); - returnedInfo = ppm.find(systemType, hostAddress, userId); - assertEquals("passwords are not equal", password, returnedInfo.getPassword()); - assertEquals("system type not what was expected", systemType, returnedInfo.getSystemType()); - returnedInfo = ppm.find(defaultSystemType, hostAddress, userId); - assertNull("signon info was found but should not be", returnedInfo); - - // remove the password - ppm.remove(systemType, hostAddress, userId); - returnedInfo = ppm.find(systemType, hostAddress, userId, true); - assertNull("signon info was found but should not be", returnedInfo); - returnedInfo = ppm.find(systemType, hostAddress, userId, false); - assertNull("signon info was found but should not be", returnedInfo); - } - - public void testSaveDenial() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - IRSESystemType systemType = RSECoreRegistry.getInstance().getSystemType(IRSESystemType.SYSTEMTYPE_UNIX_ID); - String hostAddress = "somesystem.mycompany.com"; - boolean deny = RSEPreferencesManager.getDenyPasswordSave(systemType, hostAddress); - assertFalse("the initial value of this preference should be false", deny); - - String password = "password"; - String userId = "me"; - SystemSignonInformation info = new SystemSignonInformation(hostAddress, userId, password, systemType); - PasswordPersistenceManager ppm = PasswordPersistenceManager.getInstance(); - - // save a password - int result = ppm.add(info, true, true); - assertEquals("result of add was not what was expected", PasswordPersistenceManager.RC_OK, result); - SystemSignonInformation returnedInfo = ppm.find(systemType, hostAddress, userId); - assertEquals("passwords are not equal", password, returnedInfo.getPassword()); - assertEquals("system type not what was expected", systemType, returnedInfo.getSystemType()); - - // change the preference for this system type, should erase all the passwords, including the default system type - RSEPreferencesManager.setDenyPasswordSave(systemType, hostAddress, true); - returnedInfo = ppm.find(systemType, hostAddress, userId); - assertNull("signon info was found but should not be", returnedInfo); - returnedInfo = ppm.find(systemType, hostAddress, userId, true); - assertNull("signon info was found but should not be", returnedInfo); - returnedInfo = ppm.find(systemType, hostAddress, userId, false); - assertNull("signon info was found but should not be", returnedInfo); - - // try to save one - result = ppm.add(info, true, true); - assertEquals("result of add was not what was expected", PasswordPersistenceManager.RC_DENIED, result); - - // should still not be there - returnedInfo = ppm.find(systemType, hostAddress, userId); - assertNull("signon info was found but should not be", returnedInfo); - returnedInfo = ppm.find(systemType, hostAddress, userId, true); - assertNull("signon info was found but should not be", returnedInfo); - returnedInfo = ppm.find(systemType, hostAddress, userId, false); - assertNull("signon info was found but should not be", returnedInfo); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/passwords/PasswordsTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/passwords/PasswordsTestSuite.java deleted file mode 100644 index 99eadf4b0..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/passwords/PasswordsTestSuite.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation, and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - [210474] Deny save password function missing - *******************************************************************************/ -package org.eclipse.rse.tests.core.passwords; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -public class PasswordsTestSuite extends DelegatingTestSuiteHolder { - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE Passwords Test Suite"); //$NON-NLS-1$ - suite.addTestSuite(PasswordsTest.class); - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)PasswordsTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/RSERegistriesTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/RSERegistriesTestSuite.java deleted file mode 100644 index d4fdf6087..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/RSERegistriesTestSuite.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation. - *******************************************************************************/ -package org.eclipse.rse.tests.core.registries; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -public class RSERegistriesTestSuite extends DelegatingTestSuiteHolder { - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE Registries Test Suite"); //$NON-NLS-1$ - // add the single test suites to the overall one here. - suite.addTestSuite(SubSystemConfigurationProxyTestCase.class); - - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)RSERegistriesTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemConfigurationProxyTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemConfigurationProxyTestCase.java deleted file mode 100644 index 63a246326..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemConfigurationProxyTestCase.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - *******************************************************************************/ -package org.eclipse.rse.tests.core.registries; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; -import org.eclipse.rse.tests.RSETestsPlugin; -import org.eclipse.rse.tests.core.RSECoreTestCase; - -/** - * Tests the subsystem configuration proxy functionality. - */ -public class SubSystemConfigurationProxyTestCase extends RSECoreTestCase { - - private void assertProxyApplicable(ISubSystemConfigurationProxy proxy, IRSESystemType systemType, boolean isApplicable) { - if (proxy.appliesToSystemType(systemType) != isApplicable) { - StringBuffer buf = new StringBuffer(120); - buf.append("Proxy \""); //$NON-NLS-1$ - buf.append(proxy.getId()); - buf.append("\" is expected "); //$NON-NLS-1$ - if (!isApplicable) - buf.append("not "); //$NON-NLS-1$ - buf.append("to be applicable to systemType \""); //$NON-NLS-1$ - buf.append(systemType.getId()); - buf.append("\", but returned "); //$NON-NLS-1$ - if (isApplicable) - buf.append("not "); //$NON-NLS-1$ - buf.append("to be!"); //$NON-NLS-1$ - assertTrue(buf.toString(), false); - } - } - - public void testSubSystemConfigurationProxy() { - //-test-author-:UweStieber - if (isTestDisabled()) - return; - ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry(); - assertNotNull("Failed to fetch RSE system registry instance!", systemRegistry); //$NON-NLS-1$ - - // get all subsystem configuration proxies and pick out the ones from our - // tests plugin. - ISubSystemConfigurationProxy[] proxies = systemRegistry.getSubSystemConfigurationProxies(); - for (int i = 0; i < proxies.length; i++) { - ISubSystemConfigurationProxy proxy = proxies[i]; - if (proxy.getDeclaringBundle().equals(RSETestsPlugin.getDefault().getBundle())) { - // Thats one of the subsystem configurations declared in our test subsystem - assertNotNull("Unexpected retrun value null for proxy.toString()!", proxy.toString()); //$NON-NLS-1$ - assertEquals("Proxy object changed hash code between two calls!", proxy.hashCode(), proxy.hashCode()); //$NON-NLS-1$ - assertFalse("Unexpected return value true for proxy.equals(null)!", proxy.equals(null)); //$NON-NLS-1$ - assertTrue("Unexpected return value false for proxy.equals(proxy)!", proxy.equals(proxy)); //$NON-NLS-1$ - - // a few specific value we test only for one well known test subsystem - if ("org.eclipse.rse.tests.subsystems.TestSubSystem".equals(proxy.getId())) { //$NON-NLS-1$ - assertEquals("Unexpected return value for proxy.getDescription()!", "Test Subsystem", proxy.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Unexpected return value for proxy.getVendor()!", "Eclipse.org", proxy.getVendor()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Unexpected return value for proxy.getName()!", "Tests", proxy.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Unexpected return value for proxy.getDeclaredSystemTypeIds()!", "org.eclipse.rse.systemtype.local;org.eclipse.rse.systemtype.windows", proxy.getDeclaredSystemTypeIds()); //$NON-NLS-1$ //$NON-NLS-2$ - assertFalse("Unexpected return value true for proxy.supportsAllSystemTypes()!", proxy.supportsAllSystemTypes()); //$NON-NLS-1$ - assertEquals("Unexpected return value for proxy.getPriority()!", 50000, proxy.getPriority()); //$NON-NLS-1$ - assertEquals("Unexpected return value for proxy.getCategory()!", "users", proxy.getCategory()); //$NON-NLS-1$ //$NON-NLS-2$ - assertNotNull("Unexpected return value null for proxy.getSubSystemConfiguration()!", proxy.getSubSystemConfiguration()); //$NON-NLS-1$ - - // walk through all known system types. Only "Local" and "Windows" should match! - IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes(); - assertNotNull("Failed to fetch list of registered system types!", systemTypes); //$NON-NLS-1$ - for (int j = 0; j < systemTypes.length; j++) { - IRSESystemType systemType = systemTypes[j]; - assertNotNull("Invalid null value in list of registered system types!", systemType); //$NON-NLS-1$ - if (systemType.getId().equals(IRSESystemType.SYSTEMTYPE_LOCAL_ID) || systemType.getId().equals(IRSESystemType.SYSTEMTYPE_WINDOWS_ID)) { - assertProxyApplicable(proxy, systemType, true); - } else { - assertProxyApplicable(proxy, systemType, false); - } - } - } - - if ("org.eclipse.rse.tests.subsystems.TestSubSystem2".equals(proxy.getId())) { //$NON-NLS-1$ - assertEquals("Unexpected return value for proxy.getDescription()!", "Test Subsystem 2", proxy.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Unexpected return value for proxy.getVendor()!", "Eclipse.org", proxy.getVendor()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Unexpected return value for proxy.getName()!", "Tests2", proxy.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Unexpected return value for proxy.getDeclaredSystemTypeIds()!", "org.eclipse.rse.tests.*", proxy.getDeclaredSystemTypeIds()); //$NON-NLS-1$ //$NON-NLS-2$ - assertFalse("Unexpected return value true for proxy.supportsAllSystemTypes()!", proxy.supportsAllSystemTypes()); //$NON-NLS-1$ - assertEquals("Unexpected return value for proxy.getPriority()!", 100000, proxy.getPriority()); //$NON-NLS-1$ - assertEquals("Unexpected return value for proxy.getCategory()!", "users", proxy.getCategory()); //$NON-NLS-1$ //$NON-NLS-2$ - assertNotNull("Unexpected return value null for proxy.getSubSystemConfiguration()!", proxy.getSubSystemConfiguration()); //$NON-NLS-1$ - - // walk through all known system types. All system types declared by the tests plugin are expected to match - IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes(); - assertNotNull("Failed to fetch list of registered system types!", systemTypes); //$NON-NLS-1$ - for (int j = 0; j < systemTypes.length; j++) { - IRSESystemType systemType = systemTypes[j]; - assertNotNull("Invalid null value in list of registered system types!", systemType); //$NON-NLS-1$ - if (systemType.getId().startsWith("org.eclipse.rse.tests.")) { //$NON-NLS-1$ - assertProxyApplicable(proxy, systemType, true); - } else { - assertProxyApplicable(proxy, systemType, false); - } - } - } - - if ("org.eclipse.rse.tests.subsystems.TestSubSystem3".equals(proxy.getId())) { //$NON-NLS-1$ - assertEquals("Unexpected return value for proxy.getDescription()!", "Test Subsystem 3", proxy.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Unexpected return value for proxy.getVendor()!", "Eclipse.org", proxy.getVendor()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Unexpected return value for proxy.getName()!", "Tests3", proxy.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Unexpected return value for proxy.getDeclaredSystemTypeIds()!", "org.eclipse.rse.systemtype.*n?x", proxy.getDeclaredSystemTypeIds()); //$NON-NLS-1$ //$NON-NLS-2$ - assertFalse("Unexpected return value true for proxy.supportsAllSystemTypes()!", proxy.supportsAllSystemTypes()); //$NON-NLS-1$ - assertEquals("Unexpected return value for proxy.getPriority()!", 2000, proxy.getPriority()); //$NON-NLS-1$ - assertEquals("Unexpected return value for proxy.getCategory()!", "users", proxy.getCategory()); //$NON-NLS-1$ //$NON-NLS-2$ - assertNotNull("Unexpected return value null for proxy.getSubSystemConfiguration()!", proxy.getSubSystemConfiguration()); //$NON-NLS-1$ - - // walk through all known system types. Only "Unix" and "Linux" should match! - IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes(); - assertNotNull("Failed to fetch list of registered system types!", systemTypes); //$NON-NLS-1$ - for (int j = 0; j < systemTypes.length; j++) { - IRSESystemType systemType = systemTypes[j]; - assertNotNull("Invalid null value in list of registered system types!", systemType); //$NON-NLS-1$ - if ("Unix".equalsIgnoreCase(systemType.getName()) || "Linux".equalsIgnoreCase(systemType.getName())) { //$NON-NLS-1$ //$NON-NLS-2$ - assertProxyApplicable(proxy, systemType, true); - } else { - assertProxyApplicable(proxy, systemType, false); - } - } - } - } - } - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemInterfacesTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemInterfacesTest.java deleted file mode 100644 index 19d258c57..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemInterfacesTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial implementation - *******************************************************************************/ -package org.eclipse.rse.tests.core.registries; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemProfileManager; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcessSubSystem; -import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem; -import org.eclipse.rse.tests.core.RSECoreTestCase; - -/** - * Tests the subsystem interfaces. - */ -public class SubSystemInterfacesTest extends RSECoreTestCase { - - public void testSubSystemFinding() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - try { - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - assertNotNull("system registry not found", registry); //$NON-NLS-1$ - ISystemProfileManager profileManager = registry.getSystemProfileManager(); - // create an empty profile (profile1) - ISystemProfile profile = profileManager.createSystemProfile("profile1", true); - // populate profile1 with a connection (host1) - IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_UNIX_ID); - IHost host = registry.createHost(profile.getName(), systemType, "host1", "localhost", "host1", true); - // find all of its subsystems one way - ISubSystem[] subsystems = registry.getSubSystems(host); - int n = subsystems.length; - // find all of its subsystems another way - subsystems = registry.getSubsystems(host, ISubSystem.class); - assertEquals(n, subsystems.length); - // find its file subsystem - subsystems = registry.getSubsystems(host, IRemoteFileSubSystem.class); - assertEquals(1, subsystems.length); - // find its process subsystem - subsystems = registry.getSubsystems(host, IRemoteProcessSubSystem.class); - assertEquals(1, subsystems.length); - // find its shell subsystem - subsystems = registry.getSubsystems(host, IRemoteCmdSubSystem.class); - assertEquals(1, subsystems.length); - // remove the profile - registry.deleteSystemProfile(profile); - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/BadInitializer.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/BadInitializer.java deleted file mode 100644 index 9e6a7f458..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/BadInitializer.java +++ /dev/null @@ -1,47 +0,0 @@ -/********************************************************************************* - * Copyright (c) 2008 IBM Corporation. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - [197167] initial contribution. - *********************************************************************************/ - -package org.eclipse.rse.tests.initialization; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.rse.core.IRSEModelInitializer; - -/** - * An initializer that returns a warning status - */ -public class BadInitializer implements IRSEModelInitializer { - - private static BadInitializer instance = null; - private boolean wasRun = false; - - public static BadInitializer getInstance() { - return instance; - } - - public BadInitializer() { - instance = this; - } - - public boolean wasRun() { - return wasRun; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSEModelInitializer#run(org.eclipse.core.runtime.IProgressMonitor) - */ - public IStatus run(IProgressMonitor monitor) { - IStatus result = new Status(IStatus.WARNING, "org.eclipse.rse.tests", "testing warnings generated during RSE initialization"); - wasRun = true; - return result; - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/GoodInitializer.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/GoodInitializer.java deleted file mode 100644 index 8edbcd6e7..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/GoodInitializer.java +++ /dev/null @@ -1,46 +0,0 @@ -/********************************************************************************* - * Copyright (c) 2008 IBM Corporation. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - [197167] initial contribution. - *********************************************************************************/ - -package org.eclipse.rse.tests.initialization; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.rse.core.IRSEModelInitializer; - -/** - * A plain vanilla initializer that does its thing without exceptions. - */ -public class GoodInitializer implements IRSEModelInitializer { - - private static GoodInitializer instance = null; - private boolean wasRun = false; - - public static GoodInitializer getInstance() { - return instance; - } - - public GoodInitializer() { - instance = this; - } - - public boolean wasRun() { - return wasRun; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSEModelInitializer#run(org.eclipse.core.runtime.IProgressMonitor) - */ - public IStatus run(IProgressMonitor monitor) { - wasRun = true; - return Status.OK_STATUS; - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitListener.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitListener.java deleted file mode 100644 index e75106676..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitListener.java +++ /dev/null @@ -1,36 +0,0 @@ -/********************************************************************************* - * Copyright (c) 2008 IBM Corporation. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - [197167] initial contribution. - *********************************************************************************/ - -package org.eclipse.rse.tests.initialization; - -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.rse.core.IRSEInitListener; - -/** - * A listener for initialization - */ -public class InitListener implements IRSEInitListener { - - Set phases = new HashSet(); - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSEInitListener#phaseComplete(int) - */ - public void phaseComplete(int phase) { - phases.add(new Integer(phase)); - } - - public boolean sawPhase(int phase) { - return phases.contains(new Integer(phase)); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitializationTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitializationTest.java deleted file mode 100644 index e3fe516e1..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitializationTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - [197167] initial contribution. - * David Dykstal (IBM) = [226958] add status values to waitForInitCompletion(phase) - *******************************************************************************/ - -package org.eclipse.rse.tests.initialization; - -import junit.framework.TestCase; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.rse.core.IRSEInitListener; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.tests.RSETestsPlugin; - -/** - * Should be run on a clean workspace. - */ -public class InitializationTest extends TestCase { - - public InitializationTest(String name) { - super(name); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - RSECorePlugin.addInitListener(new IRSEInitListener() { - public void phaseComplete(int phase) { - System.out.println("I see phase " + phase); - } - }); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testInitialization() { - //-test-author-:DavidDykstal - if (!RSETestsPlugin.isTestCaseEnabled("InitializationTest.testInitialization"))return; //$NON-NLS-1$ - try { - IStatus status = null; - status = RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_MODEL); - assertEquals(Status.OK_STATUS, status); - status = RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_INITIALIZER); - assertEquals(IStatus.WARNING, status.getSeverity()); // because of BadInitializer - status = RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_ALL); - assertEquals(IStatus.WARNING, status.getSeverity()); // because of BadInitializer - status = RSECorePlugin.waitForInitCompletion(); - assertEquals(IStatus.WARNING, status.getSeverity()); // because of BadInitializer - } catch (InterruptedException e) { - fail("interrupted"); - } catch (RuntimeException e) { - throw e; - } - System.out.println("Init job should be done"); - assertTrue("not indicating complete", RSECorePlugin.isInitComplete(RSECorePlugin.INIT_ALL)); - GoodInitializer goodInitializer = GoodInitializer.getInstance(); - BadInitializer badInitializer = BadInitializer.getInstance(); - UglyInitializer uglyInitializer = UglyInitializer.getInstance(); - ListenerInitializer listenerInitializer = ListenerInitializer.getInstance(); - assertTrue("good initializer not run", goodInitializer.wasRun()); - assertTrue("bad initializer not run", badInitializer.wasRun()); - assertTrue("ugly initializer not run", uglyInitializer.wasRun()); - assertTrue("listener initializer not run", listenerInitializer.wasRun()); - InitListener listener = listenerInitializer.getListener(); - assertFalse("listener saw phase INIT_MODEL", listener.sawPhase(RSECorePlugin.INIT_MODEL)); // shouldn't see this since it occurs before the listener is added - assertTrue("listener missed phase INIT_ALL", listener.sawPhase(RSECorePlugin.INIT_ALL)); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitializationTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitializationTestSuite.java deleted file mode 100644 index 4641bd4c1..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitializationTestSuite.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation, and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - [197167] initial contribution - *******************************************************************************/ -package org.eclipse.rse.tests.initialization; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class InitializationTestSuite extends TestSuite { - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all tests into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE Initialization Test Suite"); //$NON-NLS-1$ - suite.addTest(new InitializationTest("testInitialization")); - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)InitializationTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/ListenerInitializer.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/ListenerInitializer.java deleted file mode 100644 index 0881d5256..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/ListenerInitializer.java +++ /dev/null @@ -1,53 +0,0 @@ -/********************************************************************************* - * Copyright (c) 2008 IBM Corporation. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - [197167] initial contribution. - *********************************************************************************/ - -package org.eclipse.rse.tests.initialization; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.rse.core.IRSEModelInitializer; -import org.eclipse.rse.core.RSECorePlugin; - -/** - * An initializer that adds a listener to the initialization job. - */ -public class ListenerInitializer implements IRSEModelInitializer { - - private static ListenerInitializer instance = null; - private boolean wasRun = false; - private InitListener listener = new InitListener(); - - public static ListenerInitializer getInstance() { - return instance; - } - - public ListenerInitializer() { - instance = this; - } - - public boolean wasRun() { - return wasRun; - } - - public InitListener getListener() { - return listener; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSEModelInitializer#run(org.eclipse.core.runtime.IProgressMonitor) - */ - public IStatus run(IProgressMonitor monitor) { - RSECorePlugin.addInitListener(listener); - wasRun = true; - return Status.OK_STATUS; - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/UglyInitializer.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/UglyInitializer.java deleted file mode 100644 index ccaa6f844..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/UglyInitializer.java +++ /dev/null @@ -1,69 +0,0 @@ -/********************************************************************************* - * Copyright (c) 2008 IBM Corporation. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - [197167] initial contribution. - *********************************************************************************/ - -package org.eclipse.rse.tests.initialization; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.IRSEModelInitializer; - -/** - * An initializer that does asynchronous work. - */ -public class UglyInitializer implements IRSEModelInitializer { - - private static UglyInitializer instance = null; - volatile boolean wasRun = false; - - public static UglyInitializer getInstance() { - return instance; - } - - public UglyInitializer() { - instance = this; - } - - public boolean wasRun() { - return wasRun; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSEModelInitializer#run(org.eclipse.core.runtime.IProgressMonitor) - */ - public IStatus run(IProgressMonitor monitor) { - Job job1 = new Job("test initializer job 1") { - protected IStatus run(IProgressMonitor monitor) { - try { - Thread.sleep(3000); // sleep for a bit - } catch (InterruptedException e) { - // eat the exception - } - return Status.OK_STATUS; - } - }; - Job job2 = new Job("test initializer job 2") { - protected IStatus run(IProgressMonitor monitor) { - try { - Thread.sleep(3000); // sleep for a bit - } catch (InterruptedException e) { - // eat the exception - } - return Status.OK_STATUS; - } - }; - job1.schedule(1000); - job2.schedule(2000); - wasRun = true; - return Status.OK_STATUS; - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEConnectionManager.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEConnectionManager.java deleted file mode 100644 index 82f336470..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEConnectionManager.java +++ /dev/null @@ -1,345 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Don Yantzi (IBM) - initial contribution. - * David Dykstal (IBM) - initial contribution. - * Uwe Stieber (Wind River) - refactoring and cleanup. - * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - * David Dykstal (IBM) - [217556] remove service subsystem types - * Martin Oberhuber (Wind River) - [219086] flush event queue to shield tests from each other - * David Dykstal (IBM) - [210474] Deny save password function missing - * Martin Oberhuber (Wind River) - Support REXEC launch type for dstore - *******************************************************************************/ -package org.eclipse.rse.tests.internal; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.text.MessageFormat; -import java.util.Enumeration; -import java.util.Properties; - -import junit.framework.Assert; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.IRSEUserIdConstants; -import org.eclipse.rse.core.PasswordPersistenceManager; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.events.ISystemResourceChangeEvents; -import org.eclipse.rse.core.events.SystemResourceChangeEvent; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.SystemSignonInformation; -import org.eclipse.rse.core.subsystems.IRemoteServerLauncher; -import org.eclipse.rse.core.subsystems.IServerLauncherProperties; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.core.subsystems.ServerLaunchType; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; -import org.eclipse.rse.tests.RSETestsPlugin; -import org.eclipse.rse.tests.core.connection.IRSEConnectionManager; -import org.eclipse.rse.tests.core.connection.IRSEConnectionProperties; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystem; -import org.eclipse.swt.widgets.Display; -import org.osgi.framework.Bundle; - -/** - * RSE connection factory implementation. - */ -public class RSEConnectionManager implements IRSEConnectionManager { - private IPath connectionDefaultsLocation = null; - - /** - * Constructor. - */ - public RSEConnectionManager() { - // locate the connectionDefault.properties file. - Bundle bundle = RSETestsPlugin.getDefault().getBundle(); - if (bundle != null) { - IPath relative = new Path ("test.data/connectionDefault.properties"); //$NON-NLS-1$ - URL url = FileLocator.find(bundle, relative, null); - if (url != null) { - try { - // Resolve the URL to an absolute path - connectionDefaultsLocation = new Path(FileLocator.resolve(url).getFile()); - } catch (IOException e) { /* ignored on purpose */ } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.connection.IRSEConnectionManager#loadConnectionProperties(org.eclipse.core.runtime.IPath, boolean) - */ - public IRSEConnectionProperties loadConnectionProperties(IPath path, boolean allowDefaults) { - assert path != null; - - Properties defaults = null; - if (allowDefaults && connectionDefaultsLocation != null - && connectionDefaultsLocation.toFile().isFile() - && connectionDefaultsLocation.toFile().canRead()) { - InputStream stream = null; - try { - defaults = new Properties(); - stream = new FileInputStream(connectionDefaultsLocation.toFile()); - defaults.load(stream); - } catch (IOException e) { - // There are no defaults if anything goes wrong reading them - defaults = null; - } finally { - try { if (stream != null) stream.close(); } catch (IOException e) { /* ignored */ } - } - } - - - Properties properties = null; - if (path.toFile().isFile() && path.toFile().canRead()) { - InputStream stream = null; - try { - stream = new FileInputStream(path.toFile()); - properties = defaults != null ? new Properties(defaults) : new Properties(); - properties.load(stream); - } catch (IOException e) { - // if anything goes wrong reading the properties - // we do not return any. - properties = null; - } finally { - try { if (stream != null) stream.close(); } catch (IOException e) { /* ignored */ } - } - } - - return properties != null ? new RSEConnectionProperties(properties) : (IRSEConnectionProperties)null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.connection.IRSEConnectionManager#loadConnectionProperties(java.util.Properties, boolean) - */ - public IRSEConnectionProperties loadConnectionProperties(Properties properties, boolean allowDefaults) { - assert properties != null; - - Properties defaults = null; - if (allowDefaults && connectionDefaultsLocation != null - && connectionDefaultsLocation.toFile().isFile() - && connectionDefaultsLocation.toFile().canRead()) { - InputStream stream = null; - try { - defaults = new Properties(); - stream = new FileInputStream(connectionDefaultsLocation.toFile()); - defaults.load(stream); - } catch (IOException e) { - // There are no defaults if anything goes wrong reading them - defaults = null; - } finally { - try { if (stream != null) stream.close(); } catch (IOException e) { /* ignored */ } - } - } - - // Unfortunately, we cannot use the given properties directly (as - // we cannot associate the defaults). We must copy everything from - // the given properties object. - Properties resultProperties = null; - if (defaults != null) { - resultProperties = new Properties(defaults); - Enumeration names = properties.propertyNames(); - while (names.hasMoreElements()) { - String name = (String)names.nextElement(); - if (name != null && properties.getProperty(name) != null) { - resultProperties.setProperty(name, properties.getProperty(name)); - } - } - } else { - resultProperties = properties; - } - - return resultProperties != null ? new RSEConnectionProperties(resultProperties) : (IRSEConnectionProperties)null; - } - - /** - * Delete a host given its name and the name of its profile. If the host is not found then - * do nothing. - * @param profileName the name of the profile containing the host - * @param name the name of the host to delete - */ - public void removeConnection(String profileName, String name) { - assert profileName != null && name != null; - - ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry(); - Assert.assertNotNull("FAILED(findOrCreateConnection): RSE system registry unavailable!", systemRegistry); //$NON-NLS-1$ - - ISystemProfile profile = systemRegistry.getSystemProfile(profileName); - if (profile != null) { - IHost connection = systemRegistry.getHost(profile, name); - if (connection != null) { - systemRegistry.deleteHost(connection); - systemRegistry.fireEvent(new SystemResourceChangeEvent(connection, ISystemResourceChangeEvents.EVENT_DELETE, systemRegistry)); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.connection.IRSEConnectionManager#findOrCreateConnection(org.eclipse.rse.tests.core.connection.IRSEConnectionProperties) - */ - public IHost findOrCreateConnection(IRSEConnectionProperties properties) { - assert properties != null; - - IHost connection = null; - - ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry(); - Assert.assertNotNull("FAILED(findOrCreateConnection): RSE system registry unavailable!", systemRegistry); //$NON-NLS-1$ - - Exception exception = null; - String cause = null; - - // First lookup and create the profile - String profileName = properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME); - //Assert.assertNotSame("FAILED(findOrCreateConnection): Invalid system profile name!", "unknown", profileName); //$NON-NLS-1$ //$NON-NLS-2$ - ISystemProfile profile = profileName == null ? systemRegistry.getSystemProfileManager().getDefaultPrivateSystemProfile() : systemRegistry.getSystemProfile(profileName); - if (profile == null) { - try { - profile = systemRegistry.createSystemProfile(profileName, true); - } catch(Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } - Assert.assertNull("FAILED(findOrCreateConnection): Failed to create system profile '" + profileName + "'! Possible cause: " + cause, exception); //$NON-NLS-1$ //$NON-NLS-2$ - } - profileName = profile.getName(); - Assert.assertNotNull("FAILED(findOrCreateConnection): Failed to find and/or create system profile '" + profileName + "'!", profile); //$NON-NLS-1$ //$NON-NLS-2$ - - String name = properties.getProperty(IRSEConnectionProperties.ATTR_NAME); - Assert.assertFalse("FAILED(findOrCreateConnection): Invalid host name!", "unknown".equals(name)); //$NON-NLS-1$ //$NON-NLS-2$ - connection = systemRegistry.getHost(profile, name); - if (connection == null) { - String userId = properties.getProperty(IRSEConnectionProperties.ATTR_USERID); - Assert.assertFalse("FAILED(findOrCreateConnection): Invalid user id name!", "unknown".equals(userId)); //$NON-NLS-1$ //$NON-NLS-2$ - String password = properties.getProperty(IRSEConnectionProperties.ATTR_PASSWORD); - Assert.assertFalse("FAILED(findOrCreateConnection): Invalid user password name!", "unknown".equals(password)); //$NON-NLS-1$ //$NON-NLS-2$ - String address = properties.getProperty(IRSEConnectionProperties.ATTR_ADDRESS); - Assert.assertFalse("FAILED(findOrCreateConnection): Invalid remote system ip address or dns name!", "unknown".equals(address)); //$NON-NLS-1$ //$NON-NLS-2$ - String systemTypeId = properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID); - Assert.assertFalse("FAILED(findOrCreateConnection): Invalid system type!", "unknown".equals(systemTypeId)); //$NON-NLS-1$ //$NON-NLS-2$ - IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(systemTypeId); - String daemonPort = properties.getProperty(IRSEConnectionProperties.ATTR_DAEMON_PORT); - Assert.assertFalse("FAILED(findOrCreateConnection): Invalid port!", "unknown".equals(daemonPort)); //$NON-NLS-1$ //$NON-NLS-2$ - String rexecPort = properties.getProperty(IRSEConnectionProperties.ATTR_REXEC_PORT); - String serverLaunchType = properties.getProperty(IRSEConnectionProperties.ATTR_SERVER_LAUNCH_TYPE); - String serverPath = properties.getProperty(IRSEConnectionProperties.ATTR_SERVER_PATH); - String serverScript = properties.getProperty(IRSEConnectionProperties.ATTR_SERVER_SCRIPT); - - exception = null; - cause = null; - - try { - connection = systemRegistry.createHost(profileName, systemType, name, address, null, userId, IRSEUserIdConstants.USERID_LOCATION_HOST, null); - } catch (Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } - Assert.assertNull("FAILED(findOrCreateConnection): Failed to create connection IHost object! Possible cause: " + cause, exception); //$NON-NLS-1$ - - if (userId != null && password != null) { - SystemSignonInformation info = new SystemSignonInformation(address, userId, password, systemType); - PasswordPersistenceManager.getInstance().add(info, true, false); - } - - IServerLauncherProperties connProperties = connection.getConnectorServices()[0].getRemoteServerLauncherProperties(); - if (connProperties instanceof IRemoteServerLauncher) { - IRemoteServerLauncher launcher = (IRemoteServerLauncher) connProperties; - if (daemonPort != null) { - int daemonPortNum = Integer.parseInt(daemonPort); - launcher.setDaemonPort(daemonPortNum); - } - if (serverLaunchType != null) { - launcher.setServerLaunchType(ServerLaunchType.get(serverLaunchType)); - } - if (rexecPort != null) { - int rexecPortNum = Integer.parseInt(rexecPort); - launcher.setRexecPort(rexecPortNum); - } - if (serverPath != null) { - launcher.setServerPath(serverPath); - } - if (serverScript != null) { - launcher.setServerScript(serverScript); - } - } - } - Assert.assertNotNull("FAILED(findOrCreateConnection): Failed to find and/or create connection IHost object!", connection); //$NON-NLS-1$ - final Display display = Display.getCurrent(); - if (display!=null) { - while(!display.isDisposed() && display.readAndDispatch()) { - //running on main thread: wait until all async events are fired - } - } - - return connection; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.connection.IRSEConnectionManager#getFileSubSystem(org.eclipse.rse.core.model.IHost, java.lang.String) - */ - public FileServiceSubSystem getFileSubSystem(IHost connection, String desiredConfigurationId) throws Exception { - assert connection != null && desiredConfigurationId != null; - FileServiceSubSystem subsystem = (FileServiceSubSystem)RemoteFileUtility.getFileSubSystem(connection); - ISubSystemConfiguration config = subsystem.getSubSystemConfiguration(); - String activeId = config.getId(); - if (!activeId.equals(desiredConfigurationId)) { - if (subsystem.isConnected()) { - throw new RuntimeException(MessageFormat.format("The subsystem is connected as {0}. Disconnect before changing.", new Object[] { activeId })); //$NON-NLS-1$ - } - - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - ISubSystemConfiguration desiredConfiguration = registry.getSubSystemConfiguration(desiredConfigurationId); - if (subsystem.canSwitchTo(desiredConfiguration)) { - subsystem.switchServiceFactory(desiredConfiguration); - } - } - return subsystem; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.connection.IRSEConnectionManager#getShellSubSystem(org.eclipse.rse.core.model.IHost) - */ - public IShellServiceSubSystem getShellSubSystem(IHost connection) throws Exception { - assert connection != null; - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - ISubSystem[] subSystems = registry.getSubSystems(connection); - for (int i = 0; i < subSystems.length; i++) { - ISubSystem subSystem = subSystems[i]; - if (subSystem instanceof IShellServiceSubSystem) { - return (IShellServiceSubSystem)subSystem; - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.connection.IRSEConnectionManager#getTestSubSystem(org.eclipse.rse.core.model.IHost) - */ - public ITestSubSystem getTestSubSystem(IHost connection) throws Exception { - assert connection != null; - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - ISubSystem[] subSystems = registry.getSubSystems(connection); - for (int i = 0; i < subSystems.length; i++) { - ISubSystem subSystem = subSystems[i]; - if (subSystem instanceof ITestSubSystem) { - return (ITestSubSystem)subSystem; - } - } - return null; - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEConnectionProperties.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEConnectionProperties.java deleted file mode 100644 index 761e3869d..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEConnectionProperties.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.internal; - -import java.util.Properties; - -import org.eclipse.rse.tests.core.connection.IRSEConnectionProperties; - -/** - * RSE connection properties implementation. - */ -public class RSEConnectionProperties implements IRSEConnectionProperties { - private final Properties properties; - - /** - * Constructor. - * - * @param properties The string based properties container. Must be not <code>null</code>. - */ - public RSEConnectionProperties(Properties properties) { - super(); - - assert properties != null; - this.properties = properties; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.connection.IRSEConnectionProperties#getProperty(java.lang.String) - */ - public String getProperty(String key) { - assert key != null; - String value = properties.getProperty(key, null); - return value != null ? value.trim() : null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.connection.IRSEConnectionProperties#setProperty(java.lang.String, java.lang.String) - */ - public void setProperty(String key, String value) { - assert key != null; - if (value != null) { - properties.setProperty(key, value); - } else { - properties.remove(key); - } - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEDefaultTestLogCollectorDelegate.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEDefaultTestLogCollectorDelegate.java deleted file mode 100644 index f741f05da..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEDefaultTestLogCollectorDelegate.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.internal; - -import java.io.BufferedOutputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.text.DateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Properties; - -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.tests.core.IRSETestLogCollectorDelegate; - -/** - * Default implementation of a test log collector delegate. Collects the - * main log files like the Eclipse platforms .log and other default information. - */ -public class RSEDefaultTestLogCollectorDelegate implements IRSETestLogCollectorDelegate { - private final List locationsToDispose = new ArrayList(); - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.IRSETestLogCollectorDelegate#dispose() - */ - public synchronized void dispose() { - if (!locationsToDispose.isEmpty()) { - Iterator iterator = locationsToDispose.iterator(); - while (iterator.hasNext()) { - Object element = iterator.next(); - if (element instanceof IPath) { - IPath path = (IPath)element; - if (path.toFile().exists()) path.toFile().delete(); - } - } - } - locationsToDispose.clear(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.IRSETestLogCollectorDelegate#getAbsoluteLogFileLocations() - */ - public synchronized IPath[] getAbsoluteLogFileLocations() { - List locations = new ArrayList(); - locationsToDispose.clear(); - - internalCollectEclipsePlatformLog(locations); - internalCollectJavaSystemProperties(locations); - - return (IPath[])locations.toArray(new IPath[locations.size()]); - } - - /** - * Lookup the Eclipse platform log (System property osgi.logfile or - * <workspace_root>/.metadata/.log). - * - * @param locations The list of collected log file locations to add the found location to. Must be not <code>null</code>. - */ - private void internalCollectEclipsePlatformLog(final List locations) { - assert locations != null; - - // Try the OSGi framework system property first. - String osgi_logfile = System.getProperty("osgi.logfile", null); //$NON-NLS-1$ - IPath osgi_logfile_path = osgi_logfile != null ? new Path(osgi_logfile) : null; - if (osgi_logfile_path == null || !osgi_logfile_path.toFile().canRead()) { - // If we cannot get the log file via OSGi, fallback to the well known Eclipse - // platform log location. - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IPath platformLog = root.getLocation().append(".metadata").append(".log"); //$NON-NLS-1$ //$NON-NLS-2$ - if (platformLog.toFile().canRead()) locations.add(platformLog); - } else { - // Directly use the log file path as given from the OSGi framework - locations.add(osgi_logfile_path); - } - } - - /** - * Dumps the current values of all set Java system properties into - * a temporary file. - * - * @param locations The list of collected log file locations to add the temp file location to. Must be not <code>null</code>. - */ - private void internalCollectJavaSystemProperties(final List locations) { - // Dump the Java system properties into a temporary file. - String tmpdir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ - if (tmpdir != null) { - IPath tmpdirPath = new Path(tmpdir); - if (tmpdirPath.toFile().canWrite() && tmpdirPath.toFile().isDirectory()) { - tmpdirPath = tmpdirPath.append("java_system_properties.txt"); //$NON-NLS-1$ - if (tmpdirPath.toFile().exists()) tmpdirPath.toFile().delete(); - - BufferedOutputStream stream = null; - try { - if (tmpdirPath.toFile().createNewFile()) { - // remember that we created a temporaryvfile (which will be deleted within the dispose() method). - locationsToDispose.add(tmpdirPath); - - StringBuffer buffer = new StringBuffer(); - buffer.append("#\n"); //$NON-NLS-1$ - buffer.append("# Generated at " + DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.getDefault()).format(new Date(System.currentTimeMillis())) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ - buffer.append("#\n\n"); //$NON-NLS-1$ - - Properties properties = System.getProperties(); - - // For a better overview within the resulting file, we sort - // the property keys first. - Enumeration names = properties.propertyNames(); - List propertyKeys = new ArrayList(); - while (names.hasMoreElements()) { - propertyKeys.add(names.nextElement()); - } - Collections.sort(propertyKeys); - - Iterator iterator = propertyKeys.iterator(); - while (iterator.hasNext()) { - String propertyKey = (String)iterator.next(); - String propertyValue = properties.getProperty(propertyKey, ""); //$NON-NLS-1$ - buffer.append(propertyKey + "=" + propertyValue + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - stream = new BufferedOutputStream(new FileOutputStream(tmpdirPath.toFile())); - stream.write(buffer.toString().getBytes()); - - // If we reach this point, we can add the temporary created file - // to the returned locations. - locations.add(tmpdirPath); - } - } catch (IOException e) { - if (Platform.inDebugMode()) e.printStackTrace(); - } finally { - try { if (stream != null) stream.close(); } catch (IOException e) { if (Platform.inDebugMode()) e.printStackTrace(); } - } - } - } - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestCase.java deleted file mode 100644 index 1e90715b3..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestCase.java +++ /dev/null @@ -1,222 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - *******************************************************************************/ -package org.eclipse.rse.tests.internal; - -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.tests.core.IRSECoreTestCaseProperties; -import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil; -import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition; -import org.eclipse.rse.tests.core.connection.IRSEConnectionProperties; -import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; -import org.eclipse.ui.PlatformUI; - -/** - * Tests the very core RSE test framework functionality. - */ -public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase { - - /** - * Test the properties managment and support methods of the - * <code>RSECoreTestCase</code> implementation. - */ - public void testCoreTestPropertiesHandling() { - //-test-author-:UweStieber - if (isTestDisabled()) - return; - - // test for our defaults - assertTrue("Unexpected default for property PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW!", isProperty(IRSECoreTestCaseProperties.PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW, false)); //$NON-NLS-1$ - assertEquals("Unexpected default for property PROP_SWITCH_TO_PERSPECTIVE!", "org.eclipse.rse.ui.view.SystemPerspective", getProperty(IRSECoreTestCaseProperties.PROP_SWITCH_TO_PERSPECTIVE)); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Unexpected default for property PROP_FORCE_BACKGROUND_EXECUTION!", isProperty(IRSECoreTestCaseProperties.PROP_FORCE_BACKGROUND_EXECUTION, false)); //$NON-NLS-1$ - assertTrue("Unexpected default for property PROP_PERFORMANCE_TIMING_INCLUDE_SETUP_TEARDOWN!", isProperty(IRSECoreTestCaseProperties.PROP_PERFORMANCE_TIMING_INCLUDE_SETUP_TEARDOWN, false)); //$NON-NLS-1$ - - // test the specific methods with simulated data - setProperty("testBooleanProperty", true); //$NON-NLS-1$ - assertTrue("Unexpected stored value for testBooleanProperty!", isProperty("testBooleanProperty", true)); //$NON-NLS-1$ //$NON-NLS-2$ - setProperty("testBooleanProperty", false); //$NON-NLS-1$ - assertTrue("Unexpected stored value for testBooleanProperty!", isProperty("testBooleanProperty", false)); //$NON-NLS-1$ //$NON-NLS-2$ - setProperty("testBooleanProperty", null); //$NON-NLS-1$ - assertNull("testBooleanProperty not removed!", getProperty("testBooleanProperty")); //$NON-NLS-1$ //$NON-NLS-2$ - - setProperty("testStringProperty", "stringPropertyValue"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Unexpected stored value for testStringProperty!", isProperty("testStringProperty", "stringPropertyValue")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - setProperty("testStringProperty", "0123456789"); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Unexpected stored value for testStringProperty!", isProperty("testStringProperty", "0123456789")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - setProperty("testStringProperty", null); //$NON-NLS-1$ - assertNull("testStringProperty not removed!", getProperty("testStringProperty")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Test waiter interrupt condition implementation. - */ - private static class TestWaiter implements IInterruptCondition { - private final List params; - public TestWaiter(List params) { - assert params != null; - this.params = params; - } - public boolean isTrue() { return params.size() > 0; } - public void dispose() { params.clear(); } - } - - private static class TestJob extends Job { - final List params; - public TestJob(List params) { - super("Test Job"); //$NON-NLS-1$ - assert params != null; - this.params = params; - } - - protected IStatus run(IProgressMonitor monitor) { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - params.add(Boolean.TRUE); - } - }); - return Status.OK_STATUS; - } - } - - /** - * Test the <code>RSEWaitAndDispatchUtil</code> wait methods. - */ - public void testWaitAndDispatch() { - //-test-author-:UweStieber - if (isTestDisabled()) - return; - - // the simple wait and dispatch is time out based - long start = System.currentTimeMillis(); - RSEWaitAndDispatchUtil.waitAndDispatch(2500); - long end = System.currentTimeMillis(); - assertTrue("Failed to wait a given timeout!", (end - start) >= 2500); //$NON-NLS-1$ - - // the more complex wait and dispatch method has to stop - // on a given condition. - final List params = new ArrayList(); - - // the trick here is to make the condition true only if a - // runnable passed through the display thread. That should - // give us the asurance that the display event dispatching - // is kept running. - Job job = new TestJob(params); - job.setUser(false); - job.setSystem(true); - job.setPriority(Job.SHORT); - job.setRule(ResourcesPlugin.getWorkspace().getRoot()); - job.schedule(3000); - - boolean timeout = RSEWaitAndDispatchUtil.waitAndDispatch(10000, new TestWaiter(params)); - assertFalse("Interrupt condition failed to stop wait method!", timeout); //$NON-NLS-1$ - assertEquals("Interrupt condition failed to dispose!", 0, params.size()); //$NON-NLS-1$ - } - - /** - * Test accessing the test data location. - */ - public void testTestDataLocationManagement() { - //-test-author-:UweStieber - if (isTestDisabled()) - return; - - // get the pure test data location root path. - IPath root = getTestDataLocation("", false); //$NON-NLS-1$ - assertNotNull("Failed to query test data location root!", root); //$NON-NLS-1$ - assertTrue("Test data root location " + root.toOSString() + " is not a directory!", root.toFile().isDirectory()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Test data root location " + root.toOSString() + " cannot be read!", root.toFile().canRead()); //$NON-NLS-1$ //$NON-NLS-2$ - - // get a test data location path under the root - String relative = "unittest_" + System.currentTimeMillis(); //$NON-NLS-1$ - // as the directories should not exist yet, a call to getTestDataLocation must return null - IPath path = getTestDataLocation(relative, false); - assertNull("Test data location exist but should not!", path); //$NON-NLS-1$ - - // go and create the path now (including the OS) - String os = Platform.getOS(); - assertNotNull("Failed to query current execution host operating system string!", os); //$NON-NLS-1$ - path = root.append(relative + "/" + os); //$NON-NLS-1$ - assertTrue("Failed to create test data location directories. Permission problem?", path.toFile().mkdirs()); //$NON-NLS-1$ - - // Now, the re-query must be successful. - IPath path2 = getTestDataLocation(relative, false); - assertNotNull("Test data location " + root.append(relative).toOSString() + " seems not to exist!", path2); //$NON-NLS-1$ //$NON-NLS-2$ - path2 = getTestDataLocation(relative, true); - assertNotNull("Test data location " + path.toOSString() + " seems not to exist!", path2); //$NON-NLS-1$ //$NON-NLS-2$ - - // Delete the created pathes again - assertTrue("Failed to delete test data location " + path.toOSString() + "!", path.toFile().delete()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Failed to delete test data location " + root.append(relative).toOSString() + "!", root.append(relative).toFile().delete()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Test RSE connection manager and related functionality. - */ - public void testConnectionManager() { - //-test-author-:UweStieber - if (isTestDisabled()) - return; - - // get the pure test data location root path. - IPath location = getTestDataLocation("testConnectionManager", false); //$NON-NLS-1$ - assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$ - location = location.append("connection.properties"); //$NON-NLS-1$ - assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$ - assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$ - assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$ - - // load the test connection properties from the data file. - IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, true); - assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$ - assertEquals("Property name does not match!", "test_windows", properties.getProperty(IRSEConnectionProperties.ATTR_NAME)); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Property profile name does not match!", "junit_test_profile", properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME)); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Property system type does not match!", IRSESystemType.SYSTEMTYPE_WINDOWS_ID, properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$ - assertEquals("Property remote system address does not match!", "128.0.0.1", properties.getProperty(IRSEConnectionProperties.ATTR_ADDRESS)); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Property user id does not match!", "test_user", properties.getProperty(IRSEConnectionProperties.ATTR_USERID)); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Property password does not match!", "test_passwd", properties.getProperty(IRSEConnectionProperties.ATTR_PASSWORD)); //$NON-NLS-1$ //$NON-NLS-2$ - - // test the loading with partial connection information (with defauls) - Properties props = new Properties(); - props.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID, IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID); - props.setProperty(IRSEConnectionProperties.ATTR_USERID, "local_user"); //$NON-NLS-1$ - props.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, "local_passwd"); //$NON-NLS-1$ - properties = getConnectionManager().loadConnectionProperties(props, true); - assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$ - assertEquals("Property name does not match!", "Local", properties.getProperty(IRSEConnectionProperties.ATTR_NAME)); //$NON-NLS-1$ //$NON-NLS-2$ - assertNull("Property profile name does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME)); //$NON-NLS-1$ - assertEquals("Property system type does not match!", IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID, properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$ - assertEquals("Property remote system address does not match!", "localhost", properties.getProperty(IRSEConnectionProperties.ATTR_ADDRESS)); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Property user id does not match!", "local_user", properties.getProperty(IRSEConnectionProperties.ATTR_USERID)); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Property password does not match!", "local_passwd", properties.getProperty(IRSEConnectionProperties.ATTR_PASSWORD)); //$NON-NLS-1$ //$NON-NLS-2$ - - // test the loading with partial connection information (without defauls) - properties = getConnectionManager().loadConnectionProperties(props, false); - assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$ - assertNull("Property name does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_NAME)); //$NON-NLS-1$ - assertNull("Property profile name does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME)); //$NON-NLS-1$ - assertEquals("Property system type does not match!", IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID, properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$ - assertNull("Property remote system address does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_ADDRESS)); //$NON-NLS-1$ - assertEquals("Property user id does not match!", "local_user", properties.getProperty(IRSEConnectionProperties.ATTR_USERID)); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Property password does not match!", "local_passwd", properties.getProperty(IRSEConnectionProperties.ATTR_PASSWORD)); //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestSuite.java deleted file mode 100644 index 5b3c0dd1c..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestSuite.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.internal; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -/** - * Main class bundling all internal test case asuring the consistent - * functionality of the test framework itself. - */ -public class RSEInternalFrameworkTestSuite extends DelegatingTestSuiteHolder { - - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE Internal Framework Test Suite"); //$NON-NLS-1$ - // add the single test suites to the overall one here. - suite.addTestSuite(RSETestsPluginTestCase.class); - suite.addTestSuite(RSEInternalFrameworkTestCase.class); - - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)RSEInternalFrameworkTestSuite.suite(); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSETestsPluginTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSETestsPluginTestCase.java deleted file mode 100644 index b3c44217f..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSETestsPluginTestCase.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - *******************************************************************************/ - -package org.eclipse.rse.tests.internal; - -import java.util.ResourceBundle; - -import org.eclipse.rse.tests.RSETestsPlugin; -import org.eclipse.rse.tests.core.RSECoreTestCase; - -/** - * Test cases testing the functionality of the <code>RSETestsPlugin</code> class. - */ -public class RSETestsPluginTestCase extends RSECoreTestCase { - - /** - * Test the association of the resource bundle to the plugin and related - * resource bundle functionality. - */ - public void testPluginResourceBundle() { - //-test-author-:UweStieber - if (isTestDisabled()) - return; - - ResourceBundle bundle = RSETestsPlugin.getDefault().getResourceBundle(); - assertNotNull("No resource bundle associated with RSETestsPlugin!", bundle); //$NON-NLS-1$ - - // our own test id must be true here, otherwise we wouldn't had - // reached this point anyway. - assertTrue("Unexpected return value false!", RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.testPluginResourceBundle")); //$NON-NLS-1$ //$NON-NLS-2$ - - // a test id not listed within the resources file must be always true - assertTrue("Unexpected return value false!", RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.testNeverAddThisToTheResourceBundle")); //$NON-NLS-1$ //$NON-NLS-2$ - - // this test id should be never enabled - assertFalse("Unexpected return value true!", RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.dontRemove.testNeverEnabledThis")); //$NON-NLS-1$ //$NON-NLS-2$ - - // Test the different getResourceString methods. - String expected = "testResolveString"; //$NON-NLS-1$ - assertEquals("Unexpected return value!", expected, RSETestsPlugin.getResourceString("RSETestsPluginTestCase.dontRemove.testResolveString")); //$NON-NLS-1$ //$NON-NLS-2$ - - expected = "testResolveString, param=value"; //$NON-NLS-1$ - assertEquals("Unexpected return value!", expected, RSETestsPlugin.getResourceString("RSETestsPluginTestCase.dontRemove.testResolveStringOneParameter", "value")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - expected = "testResolveString, param=value1, param=value2"; //$NON-NLS-1$ - assertEquals("Unexpected return value!", expected, RSETestsPlugin.getResourceString("RSETestsPluginTestCase.dontRemove.testResolveStringMultiParameter", new Object[] { "value1", "value2" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystem.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystem.java deleted file mode 100644 index fc9957e0d..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystem.java +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation - * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes - * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading - * David McKnight (IBM) - [272882] [api] Handle exceptions in IService.initService() - *******************************************************************************/ -package org.eclipse.rse.tests.internal.testsubsystem; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.SubSystem; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; -import org.eclipse.rse.tests.testsubsystem.TestSubSystemContainerNode; -import org.eclipse.rse.tests.testsubsystem.TestSubSystemNode; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystem; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNode; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNodeContainer; - -/** - * Simple test subsystem with branches and leaves. Further children can be added - * or removed via context menu actions. - */ -public class TestSubSystem extends SubSystem implements ITestSubSystem { - - private ArrayList fChildren = new ArrayList(); - - /** - * Constructor. - * - * @param host the host to connect - * @param connectorService connector service to use - */ - public TestSubSystem(IHost host, IConnectorService connectorService) { - super(host, connectorService); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.SubSystem#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor) - */ - public void initializeSubSystem(IProgressMonitor monitor) throws SystemMessageException { - super.initializeSubSystem(monitor); - TestSubSystemContainerNode parent0 = new TestSubSystemContainerNode("0"); //$NON-NLS-1$ - TestSubSystemContainerNode child0 = new TestSubSystemContainerNode("0:0"); //$NON-NLS-1$ - parent0.addChildNode(child0); - parent0.addChildNode(new TestSubSystemContainerNode("0:1")); //$NON-NLS-1$ - parent0.addChildNode(new TestSubSystemContainerNode("0:2")); //$NON-NLS-1$ - parent0.addChildNode(new TestSubSystemNode("0:3;")); //$NON-NLS-1$ - parent0.addChildNode(new TestSubSystemContainerNode("0:4")); //$NON-NLS-1$ - child0.addChildNode(new TestSubSystemNode("0:0:0;")); //$NON-NLS-1$ - addChildNode(parent0); - addChildNode(new TestSubSystemContainerNode("1")); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.SubSystem#uninitializeSubSystem(org.eclipse.core.runtime.IProgressMonitor) - */ - public void uninitializeSubSystem(IProgressMonitor monitor) { - fChildren.clear(); - super.uninitializeSubSystem(monitor); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.SubSystem#getObjectWithAbsoluteName(java.lang.String) - */ - public Object getObjectWithAbsoluteName(String key, IProgressMonitor monitor) throws Exception { - ITestSubSystemNode[] childs = getChildNodes(); - for (int i = 0; i < childs.length; i++) { - if (childs[i].getName().equalsIgnoreCase(key)) { - return childs[i]; - } - } - return super.getObjectWithAbsoluteName(key, monitor); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(org.eclipse.core.runtime.IProgressMonitor, java.lang.String) - */ - protected Object[] internalResolveFilterString(String filterString, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - ArrayList filteredChilds = new ArrayList(); - ITestSubSystemNode[] childs = getChildNodes(); - for (int i = 0; i < childs.length; i++) { - if (childs[i].getName().matches(filterString)) { - filteredChilds.add(childs[i]); - } - } - - return filteredChilds.toArray(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(org.eclipse.core.runtime.IProgressMonitor, java.lang.Object, java.lang.String) - */ - protected Object[] internalResolveFilterString(Object parent, String filterString, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - ArrayList filteredChilds = new ArrayList(); - if (parent instanceof ITestSubSystemNodeContainer) { - ITestSubSystemNodeContainer container = (ITestSubSystemNodeContainer)parent; - ITestSubSystemNode[] childs = container.getChildNodes(); - for (int i = 0; i < childs.length; i++) { - if (childs[i].getName().matches(filterString)) { - filteredChilds.add(childs[i]); - } - } - } - - return filteredChilds.toArray(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#addChildNode(org.eclipse.rse.tests.testsubsystem.ITestSubSystemNode) - */ - public boolean addChildNode(ITestSubSystemNode node) { - if (node != null && !fChildren.contains(node)) { - node.setSubSystem(this); - fChildren.add(node); - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#removeChildNode(org.eclipse.rse.tests.testsubsystem.ITestSubSystemNode) - */ - public boolean removeChildNode(ITestSubSystemNode node) { - if (node != null && fChildren.contains(node)) { - if (node instanceof ITestSubSystemNodeContainer) { - ((ITestSubSystemNodeContainer)node).removeAllChildNodes(); - } - fChildren.remove(node); - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#removeAllChildNodes() - */ - public boolean removeAllChildNodes() { - if (!fChildren.isEmpty()) { - ITestSubSystemNode[] childs = getChildNodes(); - for (int i = 0; i < childs.length; i++) { - if (childs[i] instanceof ITestSubSystemNodeContainer) { - ((ITestSubSystemNodeContainer)childs[i]).removeAllChildNodes(); - } - } - fChildren.clear(); - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#hasChildNodes() - */ - public boolean hasChildNodes() { - return !fChildren.isEmpty(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#getChildNodeCount() - */ - public int getChildNodeCount() { - return fChildren.size(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#getChildNodes() - */ - public ITestSubSystemNode[] getChildNodes() { - return (ITestSubSystemNode[])fChildren.toArray(new ITestSubSystemNode[fChildren.size()]); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemAdapter.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemAdapter.java deleted file mode 100644 index 99299a9fb..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemAdapter.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin - *******************************************************************************/ -package org.eclipse.rse.tests.internal.testsubsystem; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.rse.internal.ui.view.SystemPerspectiveHelpers; -import org.eclipse.rse.internal.ui.view.SystemView; -import org.eclipse.rse.internal.ui.view.SystemViewSubSystemAdapter; -import org.eclipse.rse.tests.testsubsystem.TestSubSystemAddAction; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemAddTarget; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNode; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNodeContainer; -import org.eclipse.rse.ui.SystemMenuManager; -import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; -import org.eclipse.swt.widgets.Shell; - -/** - * Adapter for subsystem node. - */ -public class TestSubSystemAdapter extends SystemViewSubSystemAdapter - implements ISystemRemoteElementAdapter, ITestSubSystemAddTarget { - - /** - * Constructor. - */ - public TestSubSystemAdapter() { - super(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.internal.testsubsystem.actions.ITestSubSystemAddTarget#canAdd(java.lang.Object) - */ - public boolean canAdd(Object element) { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.internal.testsubsystem.actions.ITestSubSystemAddTarget#doAdd(org.eclipse.swt.widgets.Shell, java.lang.Object, java.lang.Object, org.eclipse.core.runtime.IProgressMonitor) - */ - public boolean doAdd(Shell shell, Object container, Object element, IProgressMonitor monitor) { - boolean added = false; - if (container instanceof ITestSubSystemNodeContainer && element instanceof ITestSubSystemNode) { - added = ((ITestSubSystemNodeContainer)container).addChildNode(((ITestSubSystemNode)element)); - if (added) { - SystemView view = SystemPerspectiveHelpers.findRSEView(); - if (view != null) { - view.expandSelected(); - view.refresh(container, true); - } - } - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.internal.testsubsystem.actions.ITestSubSystemAddTarget#showAdd(java.lang.Object) - */ - public boolean showAdd(Object element) { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object) - */ - public String getAbsoluteParentName(Object element) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(org.eclipse.swt.widgets.Shell, java.lang.Object) - */ - public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(org.eclipse.swt.widgets.Shell, java.lang.Object) - */ - public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubType(java.lang.Object) - */ - public String getRemoteSubType(Object element) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteType(java.lang.Object) - */ - public String getRemoteType(Object element) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteTypeCategory(java.lang.Object) - */ - public String getRemoteTypeCategory(Object element) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getSubSystemConfigurationId(java.lang.Object) - */ - public String getSubSystemConfigurationId(Object element) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object) - */ - public boolean refreshRemoteObject(Object oldElement, Object newElement) { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object) - */ - public boolean supportsUserDefinedActions(Object object) { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String) - */ - public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup) { - if (selection.size() == 1 && isTestSubSystemNodeContainer(selection.getFirstElement())) { - if (canAdd(selection.getFirstElement())) { - menu.add(menuGroup, new TestSubSystemAddAction("Add branch", true, getShell())); //$NON-NLS-1$ - menu.add(menuGroup, new TestSubSystemAddAction("Add leaf", false, getShell())); //$NON-NLS-1$ - } - } - } - - /* - * Returns true if the element is a node container. - */ - private boolean isTestSubSystemNodeContainer(Object element) { - return element instanceof ITestSubSystemNodeContainer; - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemAdapterFactory.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemAdapterFactory.java deleted file mode 100644 index 7375ea6fa..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemAdapterFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.internal.testsubsystem; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystem; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemConfiguration; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNode; -import org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory; -import org.eclipse.rse.ui.view.ISystemViewElementAdapter; -import org.eclipse.ui.views.properties.IPropertySource; - -/** - * Adapter factory for subsystem adapters. - */ -public class TestSubSystemAdapterFactory extends AbstractSystemRemoteAdapterFactory - implements IAdapterFactory { - - private TestSubSystemAdapter subSystemAdapter = new TestSubSystemAdapter(); - private TestSubSystemNodeAdapter subSystemNodeAdapter = new TestSubSystemNodeAdapter(); - private TestSubSystemConfigurationAdapter SubSystemConfigAdapter = new TestSubSystemConfigurationAdapter(); - - /** - * Constructor. - */ - public TestSubSystemAdapterFactory() { - super(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ - public Object getAdapter(Object adaptableObject, Class adapterType) { - Object adapter = null; - if (adaptableObject instanceof ITestSubSystem) { - adapter = subSystemAdapter; - } - if (adaptableObject instanceof ITestSubSystemNode) { - adapter = subSystemNodeAdapter; - } - if (adaptableObject instanceof ITestSubSystemConfiguration) { - adapter = SubSystemConfigAdapter; - } - - if (adapter != null && adapter instanceof ISystemViewElementAdapter && adapterType == IPropertySource.class) { - ((ISystemViewElementAdapter)adapter).setPropertySourceInput(adaptableObject); - } - - return adapter; - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConfiguration.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConfiguration.java deleted file mode 100644 index 1ae19461b..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConfiguration.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.internal.testsubsystem; - -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.SubSystemConfiguration; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystem; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemConfiguration; - -public class TestSubSystemConfiguration extends SubSystemConfiguration implements ITestSubSystemConfiguration { - - /** - * Constructor. - */ - public TestSubSystemConfiguration() { - super(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(org.eclipse.rse.core.model.IHost) - */ - public ISubSystem createSubSystemInternal(IHost conn) { - return new TestSubSystem(conn, getConnectorService(conn)); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.ISubSystemConfiguration#getConnectorService(org.eclipse.rse.core.model.IHost) - */ - public IConnectorService getConnectorService(IHost host) { - return TestSubSystemConnectorServiceManager.getInstance().getConnectorService(host, ITestSubSystem.class); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createDefaultFilterPool(org.eclipse.rse.core.filters.ISystemFilterPoolManager) - */ - protected ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr) { - ISystemFilterPool defaultPool = null; - try { - defaultPool = mgr.createSystemFilterPool(getDefaultFilterPoolName(mgr.getName(), getId()), true); // true=>is deletable by user - - String[] strings = new String[] { ".*" }; //$NON-NLS-1$ - - ISystemFilter filter = mgr.createSystemFilter(defaultPool, "All", strings); //$NON-NLS-1$ - filter.setType("all"); //$NON-NLS-1$ - } - catch (Exception exc) { - // ignore exception - } - return defaultPool; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#getTranslatedFilterTypeProperty(org.eclipse.rse.core.filters.ISystemFilter) - */ - public String getTranslatedFilterTypeProperty(ISystemFilter selectedFilter) { - String type = selectedFilter.getType(); - if (type.equals("all")) //$NON-NLS-1$ - return "testSubSystemFilter.all"; //$NON-NLS-1$ - return "testSubSystemFilter"; //$NON-NLS-1$ - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConfigurationAdapter.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConfigurationAdapter.java deleted file mode 100644 index 29754a15f..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConfigurationAdapter.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.internal.testsubsystem; - -import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter; - -/** - * Adapter for subsytsem configuration. - */ -public class TestSubSystemConfigurationAdapter extends SubSystemConfigurationAdapter { - - /** - * Constructor. - */ - public TestSubSystemConfigurationAdapter() { - super(); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConnectorService.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConnectorService.java deleted file mode 100644 index 2fbfc0d44..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConnectorService.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies - *******************************************************************************/ -package org.eclipse.rse.tests.internal.testsubsystem; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.BasicConnectorService; - -public class TestSubSystemConnectorService extends BasicConnectorService { - - private boolean connected = false; - - /** - * Constructor. - * - * @param host The RSE connection object. - */ - public TestSubSystemConnectorService(IHost host) { - super("TestSubSystemConnectorService", //$NON-NLS-1$ - "The connector Service for the TestSubSystem", //$NON-NLS-1$ - host, 0); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IConnectorService#isConnected() - */ - public boolean isConnected() { - return connected; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#internalConnect(org.eclipse.core.runtime.IProgressMonitor) - */ - protected void internalConnect(IProgressMonitor monitor) throws Exception { - connected = true; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#internalDisconnect(org.eclipse.core.runtime.IProgressMonitor) - */ - protected void internalDisconnect(IProgressMonitor monitor) throws Exception { - connected = false; - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConnectorServiceManager.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConnectorServiceManager.java deleted file mode 100644 index 7da0ad156..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemConnectorServiceManager.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.internal.testsubsystem; - -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystem; - -/** - * Test subsystem connector service manager. Singleton! - */ -public class TestSubSystemConnectorServiceManager extends AbstractConnectorServiceManager { - - private static TestSubSystemConnectorServiceManager inst; - - /** - * Private Constructor. - */ - private TestSubSystemConnectorServiceManager() { - super(); - } - - /** - * Returns the test subsystem connector service manager instance. - * - * @return The singleton instance. - */ - public static TestSubSystemConnectorServiceManager getInstance() { - if (inst == null) - inst = new TestSubSystemConnectorServiceManager(); - return inst; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#createConnectorService(org.eclipse.rse.core.model.IHost) - */ - public IConnectorService createConnectorService(IHost host) { - return new TestSubSystemConnectorService(host); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#sharesSystem(org.eclipse.rse.core.subsystems.ISubSystem) - */ - public boolean sharesSystem(ISubSystem otherSubSystem) { - return (otherSubSystem instanceof ITestSubSystem); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager#getSubSystemCommonInterface(org.eclipse.rse.core.subsystems.ISubSystem) - */ - public Class getSubSystemCommonInterface(ISubSystem subsystem) { - return ITestSubSystem.class; - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemNodeAdapter.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemNodeAdapter.java deleted file mode 100644 index f7ef5e586..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/testsubsystem/TestSubSystemNodeAdapter.java +++ /dev/null @@ -1,334 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation - * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API - * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread - *******************************************************************************/ -package org.eclipse.rse.tests.internal.testsubsystem; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.rse.internal.ui.view.SystemPerspectiveHelpers; -import org.eclipse.rse.internal.ui.view.SystemView; -import org.eclipse.rse.tests.RSETestsPlugin; -import org.eclipse.rse.tests.testsubsystem.TestSubSystemAddAction; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemAddTarget; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNode; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNodeContainer; -import org.eclipse.rse.ui.SystemMenuManager; -import org.eclipse.rse.ui.view.AbstractSystemViewAdapter; -import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.views.properties.IPropertyDescriptor; - -/** - * Adapter for all nodes and container nodes. - */ -public class TestSubSystemNodeAdapter extends AbstractSystemViewAdapter - implements ISystemRemoteElementAdapter, ITestSubSystemAddTarget { - - /** - * Constructor. - */ - public TestSubSystemNodeAdapter() { - super(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addActions(org.eclipse.rse.ui.SystemMenuManager, org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String) - */ - public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup) { - if (selection.size() == 1 && isTestSubSystemNodeContainer(selection.getFirstElement())) { - if (canAdd(selection.getFirstElement())) { - menu.add(menuGroup, new TestSubSystemAddAction("Add branch", true, getShell())); //$NON-NLS-1$ - menu.add(menuGroup, new TestSubSystemAddAction("Add leaf", false, getShell())); //$NON-NLS-1$ - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getImageDescriptor(java.lang.Object) - */ - public ImageDescriptor getImageDescriptor(Object element) { - if (isTestSubSystemNodeContainer(element)) { - return RSETestsPlugin.getDefault().getImageDescriptor("ICON_ID_BRANCH"); //$NON-NLS-1$ - } - else if (isTestSubSystemNode(element)) { - return RSETestsPlugin.getDefault().getImageDescriptor("ICON_ID_LEAF"); //$NON-NLS-1$ - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getText(java.lang.Object) - */ - public String getText(Object element) { - if (isTestSubSystemNode(element)) { - return ((ITestSubSystemNode)element).getName(); - } - return null; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object) - */ - public String getAbsoluteName(Object element) { - assert isTestSubSystemNode(element); - ITestSubSystemNode node = (ITestSubSystemNode) element; - String absName = node.getName(); - node = node.getParent(); - while (node != null) { - absName = node.getName() + "/" + absName; //$NON-NLS-1$ - node = node.getParent(); - } - return absName; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getType(java.lang.Object) - */ - public String getType(Object element) { - if (isTestSubSystemNodeContainer(element)) - return "testSubSystemContainerNode"; //$NON-NLS-1$ - else if (isTestSubSystemNode(element)) - return "testSubSystemNode"; //$NON-NLS-1$ - else - return "unknown"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getParent(java.lang.Object) - */ - public Object getParent(Object element) { - if (isTestSubSystemNode(element)) - return ((ITestSubSystemNode)element).getParent(); - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(java.lang.Object) - */ - public boolean hasChildren(IAdaptable element) { - if (isTestSubSystemNodeContainer(element)) - return ((ITestSubSystemNodeContainer)element).hasChildNodes(); - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(java.lang.Object) - */ - public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) { - if (isTestSubSystemNodeContainer(element)) - return ((ITestSubSystemNodeContainer)element).getChildNodes(); - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors() - */ - protected IPropertyDescriptor[] internalGetPropertyDescriptors() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyValue(java.lang.Object) - */ - protected Object internalGetPropertyValue(Object key) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object) - */ - public String getAbsoluteParentName(Object element) { - if (isTestSubSystemNode(element)) - if (((ITestSubSystemNode)element).getParent() != null) - return ((ITestSubSystemNode)element).getParent().getName(); - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getSubSystemConfigurationId(java.lang.Object) - */ - public String getSubSystemConfigurationId(Object element) { - return "testSubSystemConfigurationId"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteTypeCategory(java.lang.Object) - */ - public String getRemoteTypeCategory(Object element) { - return "testCategory"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteType(java.lang.Object) - */ - public String getRemoteType(Object element) { - return "testType"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubType(java.lang.Object) - */ - public String getRemoteSubType(Object element) { - return "testSubType"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object) - */ - public boolean refreshRemoteObject(Object oldElement, Object newElement) { - ITestSubSystemNode oldNode = (ITestSubSystemNode) oldElement; - ITestSubSystemNode newNode = (ITestSubSystemNode) newElement; - newNode.setName(oldNode.getName()); - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(org.eclipse.swt.widgets.Shell, java.lang.Object) - */ - public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception { - if (isTestSubSystemNode(element)) - return ((ITestSubSystemNode)element).getParent(); - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(org.eclipse.swt.widgets.Shell, java.lang.Object) - */ - public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception { - return null; - - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object) - */ - public boolean supportsUserDefinedActions(Object object) { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#canDelete(java.lang.Object) - */ - public boolean canDelete(Object element) { - return isTestSubSystemNode(element); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showDelete(java.lang.Object) - */ - public boolean showDelete(Object element) { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#doDelete(org.eclipse.swt.widgets.Shell, java.lang.Object, org.eclipse.core.runtime.IProgressMonitor) - */ - public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception { - if (isTestSubSystemNode(element)) { - ITestSubSystemNodeContainer parent = (ITestSubSystemNodeContainer)((ITestSubSystemNode)element).getParent(); - if (parent == null) { - parent = (ITestSubSystemNodeContainer)((ITestSubSystemNode)element).getSubSystem(); - } - if (parent != null && isTestSubSystemNodeContainer(parent)) - return parent.removeChildNode(((ITestSubSystemNode)element)); - } - return false; - } - - /* - * Returns true if the element is a node. - */ - private boolean isTestSubSystemNode(Object element) { - return element instanceof ITestSubSystemNode; - } - - /* - * Returns true if the element is a node container. - */ - private boolean isTestSubSystemNodeContainer(Object element) { - return element instanceof ITestSubSystemNodeContainer; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.internal.testsubsystem.actions.ITestSubSystemAddTarget#canAdd(java.lang.Object) - */ - public boolean canAdd(Object element) { - return isTestSubSystemNodeContainer(element); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.internal.testsubsystem.actions.ITestSubSystemAddTarget#doAdd(org.eclipse.swt.widgets.Shell, java.lang.Object, java.lang.Object, org.eclipse.core.runtime.IProgressMonitor) - */ - public boolean doAdd(Shell shell, Object container, Object element, IProgressMonitor monitor) { - boolean added = false; - if (isTestSubSystemNodeContainer(container) && isTestSubSystemNode(element)) { - added = ((ITestSubSystemNodeContainer)container).addChildNode(((ITestSubSystemNode)element)); - if (added) { - SystemView view = SystemPerspectiveHelpers.findRSEView(); - if (view != null) { - view.expandSelected(); - view.refresh(container); - } - } - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.internal.testsubsystem.actions.ITestSubSystemAddTarget#showAdd(java.lang.Object) - */ - public boolean showAdd(Object element) { - return isTestSubSystemNodeContainer(element); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#canRename(java.lang.Object) - */ - public boolean canRename(Object element) { - return isTestSubSystemNode(element); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#doRename(org.eclipse.swt.widgets.Shell, java.lang.Object, java.lang.String, IProgressMonitor) - */ - public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception { - if (name != null && isTestSubSystemNode(element)) { - String oldName = ((ITestSubSystemNode)element).getName(); - if (oldName == null || !oldName.equals(name)) { - ((ITestSubSystemNode)element).setName(name); - return true; - } - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRename(java.lang.Object) - */ - public boolean showRename(Object element) { - return isTestSubSystemNode(element); - } - - /** - * This is a local RSE artifact so returning false - * - * @param element the object to check - * @return false since this is not remote - */ - public boolean isRemote(Object element) { - return false; - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/ExportImportTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/ExportImportTest.java deleted file mode 100644 index e76a56d7c..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/ExportImportTest.java +++ /dev/null @@ -1,201 +0,0 @@ -/********************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial contribution. - * David Dykstal (IBM) - [189274] provide import and export operations for profiles - * David Dykstal (IBM) - [232126] add test for filter type persistence - * Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases - *********************************************************************************/ - -package org.eclipse.rse.tests.persistence; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemProfileManager; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.internal.persistence.RSEEnvelope; -import org.eclipse.rse.persistence.IRSEPersistenceManager; -import org.eclipse.rse.persistence.IRSEPersistenceProvider; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.tests.core.RSECoreTestCase; - -/** - * - */ -public class ExportImportTest extends RSECoreTestCase { - - ISystemProfile sourceProfile = null; - ISystemRegistry registry = null; - IRSEPersistenceManager manager = null; - ISubSystemConfiguration configuration = null; - - public ExportImportTest(String name) { - super(name); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - // get the registry and persistence provider - manager = RSECorePlugin.getThePersistenceManager(); - registry = RSECorePlugin.getTheSystemRegistry(); - // create the first profile and populate it - ISystemProfileManager profileManager = registry.getSystemProfileManager(); - sourceProfile = profileManager.createSystemProfile("profile1", true); - // populate profile1 with a connection (host1) - IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_UNIX_ID); - IHost host1 = registry.createHost(sourceProfile.getName(), systemType, "host1", "localhost", "host1", true); - // find its file subsystem - ISubSystem[] subsystems = registry.getSubsystems(host1, IRemoteFileSubSystem.class); - ISubSystem host1FileSubsystem = subsystems[0]; - // create a connection-private filter (hostFilter1) - String[] filterStrings = new String[] { "*.txt" }; - ISystemFilterPool host1FilterPool = host1FileSubsystem.getUniqueOwningSystemFilterPool(true); - ISystemFilter hostFilter1 = host1FilterPool.createSystemFilter("hostFilter1", filterStrings); - hostFilter1.setType("hostFilter1Type"); - // create a connection-private filter (hostFilter2) - filterStrings = new String[] { "*.c" }; - host1FilterPool.createSystemFilter("hostFilter2", filterStrings); - // create a shared filter pool - configuration = host1FileSubsystem.getSubSystemConfiguration(); - ISystemFilterPoolManager filterPoolManager = configuration.getFilterPoolManager(sourceProfile, true); - ISystemFilterPool sharedFilterPool = filterPoolManager.createSystemFilterPool("sharedFilterPool", true); - // create a shared filter (sharedFilter) - filterStrings = new String[] { "*.java", "*.txt", "*.c" }; - ISystemFilter sharedFilter = sharedFilterPool.createSystemFilter("sharedFilter", filterStrings); - sharedFilter.setType("sharedFilterType"); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Export a single filter pool and import it into an empty profile. - */ - public void testFilterPool1() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - try { - // find the provider - IRSEPersistenceProvider persistenceProvider = manager.getPersistenceProvider("org.eclipse.rse.persistence.PropertyFileProvider"); - // find a shared filter pool - ISystemFilterPoolManager fpm = configuration.getFilterPoolManager(sourceProfile); - ISystemFilterPool fp = fpm.getSystemFilterPool("sharedFilterPool"); - // export the filter pool - RSEEnvelope envelope = new RSEEnvelope(); - envelope.add(fp); - IProgressMonitor monitor = new NullProgressMonitor(); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - envelope.put(out, persistenceProvider, monitor); - // create an empty profile - ISystemProfile targetProfile = registry.createSystemProfile("profileFilterPool1", true); - // import into the profile - ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); - monitor = new NullProgressMonitor(); - envelope.get(in, monitor); - envelope.mergeWith(targetProfile); - // verify the contents - assertEquals(0, registry.getHostCount(targetProfile)); - fpm = configuration.getFilterPoolManager(targetProfile); - assertNotNull(fpm); - ISystemFilterPool[] pools = fpm.getSystemFilterPools(); - assertEquals(1, pools.length); - fp = pools[0]; - assertNotNull(fp); - assertEquals("sharedFilterPool", fp.getName()); - ISystemFilter[] filters = fp.getFilters(); - assertEquals(1, filters.length); - ISystemFilter filter = filters[0]; - assertEquals("sharedFilter", filter.getName()); - assertEquals("sharedFilterType", filter.getType()); - String[] strings = filter.getFilterStrings(); - assertEquals(3, strings.length); - assertEquals("*.java", strings[0]); - assertEquals("*.txt", strings[1]); - assertEquals("*.c", strings[2]); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * Export a single host and import it into an empty profile. - */ - public void testHost1() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - try { - // find the provider - IRSEPersistenceProvider persistenceProvider = manager.getPersistenceProvider("org.eclipse.rse.persistence.PropertyFileProvider"); - // create an empty profile - ISystemProfile targetProfile = registry.createSystemProfile("profile2", true); - // export a host to a stream this export all connection private pools as well. - IHost host1 = registry.getHost(sourceProfile, "host1"); - RSEEnvelope envelope = new RSEEnvelope(); - envelope.add(host1); - IProgressMonitor monitor = new NullProgressMonitor(); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - envelope.put(out, persistenceProvider, monitor); - // import from the newly created stream - ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); - monitor = new NullProgressMonitor(); - envelope.get(in, monitor); - envelope.mergeWith(targetProfile); - // verify the contents - IHost[] hosts = targetProfile.getHosts(); - assertEquals(1, hosts.length); - IHost host = hosts[0]; - assertEquals("host1", host.getAliasName()); - ISubSystem[] subsystems = registry.getSubsystems(host, IRemoteFileSubSystem.class); - assertEquals(1, subsystems.length); - ISubSystem subsystem = subsystems[0]; - ISystemFilterPool fp = subsystem.getUniqueOwningSystemFilterPool(false); - assertNotNull(fp); - ISystemFilter[] filters = fp.getFilters(); - assertEquals(2, filters.length); - ISystemFilter filter = filters[0]; - assertEquals("hostFilter1", filter.getName()); - String[] strings = filter.getFilterStrings(); - assertEquals(1, strings.length); - assertEquals("*.txt", strings[0]); - filter = filters[1]; - assertEquals("hostFilter2", filter.getName()); - strings = filter.getFilterStrings(); - assertEquals(1, strings.length); - assertEquals("*.c", strings[0]); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public void testPropertySet() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/MigrationTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/MigrationTest.java deleted file mode 100644 index 853f62af4..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/MigrationTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/********************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial contribution. - * Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases - *********************************************************************************/ - -package org.eclipse.rse.tests.persistence; - -import org.eclipse.rse.tests.core.RSECoreTestCase; - -/** - * - */ -public class MigrationTest extends RSECoreTestCase { - - public MigrationTest(String name) { - super(name); - } - - public void testProfileMigration() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - // create a new profile - // set its persistence manager to PM1 - // populate the profile - // migrate profile to PM2 - // test for migration - // ensure that the old profile has been locked - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTest.java deleted file mode 100644 index 6e69611f6..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTest.java +++ /dev/null @@ -1,270 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation. - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - * David McKnight (IBM) - [217715] [api] RSE property sets should support nested property sets - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - * David Dykstal (IBM) [219069] test is failing - * David Dykstal (IBM) - [232126] test found to be failing when testing filter type persistence - *******************************************************************************/ - -package org.eclipse.rse.tests.persistence; - -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.jobs.IJobManager; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IPropertySet; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.PropertySet; -import org.eclipse.rse.persistence.IRSEPersistenceManager; -import org.eclipse.rse.tests.core.RSECoreTestCase; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemPreferencesManager; - -/** - * Tests for {@link SystemPreferencesManager}. - * Since these are persistence tests they will play with the creation and deletion of - * profiles, hosts, filters, and other model objects. You should run this only in a - * clean workspace. - */ -public class PersistenceTest extends RSECoreTestCase { - - public PersistenceTest(String name) { - super(name); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testPersistenceManagerStartup() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - IRSEPersistenceManager m = RSECorePlugin.getThePersistenceManager(); - for (int i = 0; i < 5; i++) { - if (m.isRestoreComplete()) break; - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - assertTrue("Restore not complete", m.isRestoreComplete()); - } - - public void testProfilePersistence() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - /* - * Set up this particular test. - */ - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - int n = registry.getSystemProfileManager().getSystemProfiles().length; - - /* - * Create a new profile in this profile manager. This will be the second - * profile created. Creating a profile causes a commit. - */ - try { - ISystemProfile bogus = registry.getSystemProfile("bogus"); - if (bogus == null) { - registry.createSystemProfile("bogus", true); //$NON-NLS-1$ - n += 1; - } - } catch (Exception e) { - throw new RuntimeException(e); - } - -// reload(); // reload not yet working - - /* - * There should be one more profile - */ - ISystemProfile[] profiles = registry.getSystemProfileManager().getSystemProfiles(); - assertEquals(n, profiles.length); - - /* - * One should be default private profile - */ - boolean found = false; - for (int i = 0; i < profiles.length && !found; i++) { - ISystemProfile p = profiles[i]; - found = p.isDefaultPrivate(); - } - assertTrue("Default private profile not found", found); - - /* - * One should be the test profile - */ - found = false; - for (int i = 0; i < profiles.length && !found; i++) { - ISystemProfile p = profiles[i]; - found = p.getName().equals("bogus"); - } - assertTrue("bogus profile not found", found); - - /* - * Get the test profile and check its properties. - */ - ISystemProfile bogus = registry.getSystemProfile("bogus"); - assertNotNull(bogus); - assertFalse(bogus.isDefaultPrivate()); - assertTrue(bogus.isActive()); - IPropertySet[] pSets = bogus.getPropertySets(); - assertNotNull(pSets); - assertEquals(0, pSets.length); - - /* - * Add a property set to the profile. - */ - IPropertySet bogusProperties = new PropertySet("bogus_properties"); - bogusProperties.addProperty("bp1", "1"); - bogusProperties.addProperty("bp2", "2"); - bogus.addPropertySet(bogusProperties); - - // nested property set - IPropertySet bogusNestedProperties = new PropertySet("bogus_nested_properties"); - bogusNestedProperties.addProperty("bnpa", "a"); - bogusNestedProperties.addProperty("bnpb", "b"); - bogusProperties.addPropertySet(bogusNestedProperties); - - bogus.commit(); - - /* - * Refresh the profile manager. - */ -// reload(); // reload not yet working - - /* - * Check to see if everything is still OK and that the properties are restored. - */ - bogus = registry.getSystemProfile("bogus"); - assertNotNull(bogus); - assertFalse(bogus.isDefaultPrivate()); - assertTrue(bogus.isActive()); - pSets = bogus.getPropertySets(); - assertNotNull(pSets); - assertEquals(1, pSets.length); - bogusProperties = bogus.getPropertySet("bogus_properties"); - assertNotNull(bogusProperties); - assertEquals("1", bogusProperties.getProperty("bp1").getValue()); - assertEquals("2", bogusProperties.getProperty("bp2").getValue()); - - bogusNestedProperties = bogusProperties.getPropertySet("bogus_nested_properties"); - assertNotNull(bogusNestedProperties); - assertEquals("a", bogusNestedProperties.getProperty("bnpa").getValue()); - assertEquals("b", bogusNestedProperties.getProperty("bnpb").getValue()); - - try { - registry.deleteSystemProfile(bogus); - } catch (Exception e) { - throw new RuntimeException(e); - } - -// reload(); // reload not yet working - - } - - public void testHostPersistence() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - /* - * Set up this particular test. - */ - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - - /* - * Create a new profile in this profile manager. This will be the third - * profile created. Creating a profile causes a commit. - */ - try { - registry.createSystemProfile("bogus", true); //$NON-NLS-1$ - } catch (Exception e) { - throw new RuntimeException(e); - } - ISystemProfile profile = registry.getSystemProfile("bogus"); - assertNotNull(profile); - - try { - IRSESystemType linuxType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LINUX_ID); - registry.createHost("bogus", linuxType, "myhost", "myhost.mynet.mycompany.net", null); - } catch (Exception e) { - throw new RuntimeException(e); - } - IHost host = registry.getHost(profile, "myhost"); - assertNotNull(host); - host.setDescription("description"); - IPropertySet props = new PropertySet("host_props"); - props.addProperty("bp1", "1"); - props.addProperty("bp2", "2"); - host.addPropertySet(props); - host.commit(); - -// reload(); // reload not yet working - - /* - * Get the test profile and check its properties. - */ - profile = registry.getSystemProfile("bogus"); - assertNotNull(profile); - host = registry.getHost(profile, "myhost"); - assertNotNull(host); - props = host.getPropertySet("host_props"); - assertNotNull(props); - assertEquals("1", props.getProperty("bp1").getValue()); - assertEquals("2", props.getProperty("bp2").getValue()); - - } - - private void reload() { - /* - * Set up this particular test. The persistence manager acts as the family for all - * Jobs that are created for reading and writing the persistent form of the model. - */ - IRSEPersistenceManager persistenceManager = RSECorePlugin.getThePersistenceManager(); - - /* - * Pause while the background job completes the save of the profile. - */ - IJobManager jobManager = Job.getJobManager(); - try { - jobManager.join(persistenceManager, null); - } catch (OperationCanceledException e) { - throw new RuntimeException(e); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - - /* - * restore the profile manager - */ - RSEUIPlugin.getDefault().restart(); - - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTestSuite.java deleted file mode 100644 index d1a4054bc..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTestSuite.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation - * David Dykstal (IBM) - [189274] provide import and export operations for profiles - *******************************************************************************/ -package org.eclipse.rse.tests.persistence; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -public class PersistenceTestSuite extends DelegatingTestSuiteHolder { - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all tests into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE Persistence Test Suite"); //$NON-NLS-1$ -// suite.addTestSuite(PersistenceTest.class); // use this when running all tests - suite.addTest(new PersistenceTest("testPersistenceManagerStartup")); - suite.addTest(new PersistenceTest("testProfilePersistence")); - suite.addTest(new PersistenceTest("testHostPersistence")); - suite.addTest(new ExportImportTest("testHost1")); - suite.addTest(new ExportImportTest("testFilterPool1")); - suite.addTest(new ExportImportTest("testPropertySet")); - suite.addTest(new MigrationTest("testProfileMigration")); - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)PersistenceTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java deleted file mode 100644 index fba940067..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation. - * David McKnight (IBM) - initial API and implementation. - * Kushal Munir (IBM) - initial API and implementation. - * David Dykstal (IBM) - moved SystemPreferencesManager to a new package - * - created and used RSEPreferencesManager - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - *******************************************************************************/ - -package org.eclipse.rse.tests.preferences; - -import org.eclipse.rse.core.IRSECoreRegistry; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.RSEPreferencesManager; -import org.eclipse.rse.tests.core.RSECoreTestCase; -import org.eclipse.rse.ui.SystemPreferencesManager; - -/** - * Tests for {@link SystemPreferencesManager}. - */ -public class PreferencesTest extends RSECoreTestCase { - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testActiveProfiles() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - RSEPreferencesManager.addActiveProfile("bogus01"); //$NON-NLS-1$ - RSEPreferencesManager.addActiveProfile("bogus02"); //$NON-NLS-1$ - String[] profiles = RSEPreferencesManager.getActiveProfiles(); - assertTrue(profiles.length >= 2); - assertEquals("bogus02", profiles[RSEPreferencesManager.getActiveProfilePosition("bogus02")]); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("bogus01", profiles[RSEPreferencesManager.getActiveProfilePosition("bogus01")]); //$NON-NLS-1$ //$NON-NLS-2$ - RSEPreferencesManager.renameActiveProfile("bogus02", "bogus99"); //$NON-NLS-1$ //$NON-NLS-2$ - profiles = RSEPreferencesManager.getActiveProfiles(); - assertEquals("bogus99", profiles[RSEPreferencesManager.getActiveProfilePosition("bogus99")]); //$NON-NLS-1$ //$NON-NLS-2$ - RSEPreferencesManager.deleteActiveProfile("bogus01"); //$NON-NLS-1$ - RSEPreferencesManager.deleteActiveProfile("bogus99"); //$NON-NLS-1$ - assertEquals(-1, RSEPreferencesManager.getActiveProfilePosition("bogus02")); //$NON-NLS-1$ - assertEquals(-1, RSEPreferencesManager.getActiveProfilePosition("bogus01")); //$NON-NLS-1$ - assertEquals(-1, RSEPreferencesManager.getActiveProfilePosition("bogus99")); //$NON-NLS-1$ - } - - public void testUserIds() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - RSEPreferencesManager.setUserId("a.b.c", "bogusUser"); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("bogusUser", RSEPreferencesManager.getUserId("a.b.c")); //$NON-NLS-1$ //$NON-NLS-2$ - RSEPreferencesManager.clearUserId("a.b.c"); //$NON-NLS-1$ - assertNull(RSEPreferencesManager.getUserId("a.b.c")); //$NON-NLS-1$ - } - - public void testDefaultUserIds() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - IRSECoreRegistry registry = RSECorePlugin.getTheCoreRegistry(); - //TODO should we test deprecated methods as well? Probably yes... - IRSESystemType systemTypeDeprecated = registry.getSystemType("Local"); //$NON-NLS-1$ - IRSESystemType systemType = registry.getSystemTypeById("org.eclipse.rse.systemtype.local"); //$NON-NLS-1$ - assertEquals(systemType, systemTypeDeprecated); - String oldValue = RSEPreferencesManager.getDefaultUserId(systemType); - RSEPreferencesManager.setDefaultUserId(systemType, "bogus1"); //$NON-NLS-1$ - assertEquals("bogus1", RSEPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$ - IRSESystemType localType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LOCAL_ID); - RSEPreferencesManager.setDefaultUserId(localType, "bogus2"); //$NON-NLS-1$ - assertEquals("bogus2", RSEPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$ - RSEPreferencesManager.setDefaultUserId(systemType, oldValue); - assertEquals(oldValue, RSEPreferencesManager.getDefaultUserId(systemType)); - } - - public void testShowLocalConnection() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - assertTrue(SystemPreferencesManager.getShowLocalConnection()); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/RSEPreferencesTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/RSEPreferencesTestSuite.java deleted file mode 100644 index 2a41632f2..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/RSEPreferencesTestSuite.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Martin Oberhuber (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.preferences; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -public class RSEPreferencesTestSuite extends DelegatingTestSuiteHolder { - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE Preferences Test Suite"); //$NON-NLS-1$ - // add the single test suites to the overall one here. - suite.addTestSuite(PreferencesTest.class); - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)RSEPreferencesTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/profiles/ProfileTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/profiles/ProfileTest.java deleted file mode 100644 index ab4c0c375..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/profiles/ProfileTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial implementation. - *******************************************************************************/ - -package org.eclipse.rse.tests.profiles; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemProfileManager; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.tests.core.RSECoreTestCase; -import org.eclipse.rse.ui.SystemPreferencesManager; - -/** - * Tests for {@link SystemPreferencesManager}. - * Since these are persistence tests they will play with the creation and deletion of - * profiles, hosts, filters, and other model objects. You should run this only in a - * clean workspace. - */ -public class ProfileTest extends RSECoreTestCase { - - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - ISystemProfileManager manager = registry.getSystemProfileManager(); - ISystemProfile defaultProfile = manager.getDefaultPrivateSystemProfile(); - - public ProfileTest(String name) { - super(name); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testDefaultProfileMarking() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - assertNotNull("default profile is null", defaultProfile); - assertTrue("default profile is not active - 1", defaultProfile.isActive()); - assertTrue("default profile is not marked as default", defaultProfile.isDefaultPrivate()); - } - - public void testDefaultProfileActivation() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - registry.setSystemProfileActive(defaultProfile, true); - assertTrue("default profile is not active - 2", defaultProfile.isActive()); - registry.setSystemProfileActive(defaultProfile, false); // this should be ignored - assertTrue("default profile is not active - 3", defaultProfile.isActive()); - } - - public void testDefaultProfileRename() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - try { - ISystemProfile profile = registry.getSystemProfile("bogus"); - assertNull(profile); - String oldName = defaultProfile.getName(); - registry.renameSystemProfile(defaultProfile, "bogus"); - assertEquals("bogus", defaultProfile.getName()); - assertSame(defaultProfile, manager.getDefaultPrivateSystemProfile()); - profile = registry.getSystemProfile("bogus"); - assertSame(profile, manager.getDefaultPrivateSystemProfile()); - registry.renameSystemProfile(defaultProfile, oldName); - assertEquals(oldName, defaultProfile.getName()); - assertSame(defaultProfile, manager.getDefaultPrivateSystemProfile()); - profile = registry.getSystemProfile(oldName); - assertSame(profile, manager.getDefaultPrivateSystemProfile()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public void testProfileActivation() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - try { - ISystemProfile profile = registry.getSystemProfile("bogus"); - assertNull(profile); - profile = registry.createSystemProfile("bogus", true); - assertNotNull(profile); - assertTrue("profile is not active, but should be", profile.isActive()); - registry.setSystemProfileActive(profile, false); - assertFalse("profile is active, but should not be", profile.isActive()); - registry.setSystemProfileActive(profile, true); - assertTrue("profile is not active, but should be", profile.isActive()); - registry.deleteSystemProfile(profile); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public void testDefaultProfileDeletion() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - try { - registry.deleteSystemProfile(defaultProfile); // this should be ignored - List profiles = Arrays.asList(manager.getSystemProfiles()); - assertTrue("default profile was deleted", profiles.contains(defaultProfile)); - assertTrue("default profile is not registered with manager", manager.getDefaultPrivateSystemProfile() == defaultProfile); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public void testProfileDeletion() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - try { - ISystemProfile profile = registry.getSystemProfile("bogus"); - assertNull(profile); - profile = registry.createSystemProfile("bogus", true); - assertNotNull(profile); - registry.deleteSystemProfile(profile); - List profiles = Arrays.asList(manager.getSystemProfiles()); - assertFalse("profile was not deleted", profiles.contains(profile)); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/profiles/ProfileTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/profiles/ProfileTestSuite.java deleted file mode 100644 index b325b55b8..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/profiles/ProfileTestSuite.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.profiles; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -public class ProfileTestSuite extends DelegatingTestSuiteHolder { - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all tests into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE Profile Test Suite"); //$NON-NLS-1$ - suite.addTest(new ProfileTest("testDefaultProfileMarking")); - suite.addTest(new ProfileTest("testDefaultProfileActivation")); - suite.addTest(new ProfileTest("testDefaultProfileDeletion")); - suite.addTest(new ProfileTest("testDefaultProfileRename")); - suite.addTest(new ProfileTest("testProfileActivation")); - suite.addTest(new ProfileTest("testProfileDeletion")); - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)ProfileTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/CreateFileTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/CreateFileTestCase.java deleted file mode 100644 index 4a35cf48e..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/CreateFileTestCase.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: Kevin Doyle. - * - * Contributors: - * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - * Martin Oberhuber (Wind River) - [195402] Add constructor with test name - ********************************************************************************/ - -package org.eclipse.rse.tests.subsystems.files; - -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.SystemStartHere; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - -public class CreateFileTestCase extends FileServiceBaseTest { - - private IHost host; - //TODO: See if additional characters in the name should work. - // Also make sure if there are that they can be entered in the New - // File Dialog. This string can be so using this for base test. - private String fileName = "a !@#${a}'%^&()_ =[]~+-'`;,.txt"; //$NON-NLS-1$ - private IRemoteFile tempDirectory = null; - - /** - * Constructor with specific test name. - * @param name test to execute - */ - public CreateFileTestCase(String name) { - super(name); - } - - private IRemoteFileSubSystem getRemoteFileSubSystem(IHost host) { - IRemoteFileSubSystem fss = null; - ISystemRegistry sr = SystemStartHere.getSystemRegistry(); - ISubSystem[] ss = sr.getServiceSubSystems(host, IFileService.class); - for (int i=0; i<ss.length; i++) { - if (ss[i] instanceof FileServiceSubSystem) { - fss = (IRemoteFileSubSystem)ss[i]; - return fss; - } - } - return null; - } - - public void testCreateFileFTP() throws Exception { - //-test-author-:KevinDoyle - host = getFTPHost(); - if (isTestDisabled()) - return; - createFileAndAssertProperties(); - } - - public void testCreateFileLinux() throws Exception { - //-test-author-:KevinDoyle - host = getLinuxHost(); - if (isTestDisabled()) - return; - createFileAndAssertProperties(); - } - - public void testCreateFileSSH() throws Exception { - //-test-author-:KevinDoyle - host = getSSHHost(); - if (isTestDisabled()) - return; - createFileAndAssertProperties(); - } - - public void testCreateFileWindows() throws Exception { - //-test-author-:KevinDoyle - host = getWindowsHost(); - if (isTestDisabled()) - return; - createFileAndAssertProperties(); - } - - public void createFileAndAssertProperties() throws Exception { - String SYSTEM_TYPE = host.getSystemType().getLabel(); - FileServiceSubSystem inputFss = (FileServiceSubSystem) getRemoteFileSubSystem(host); - - // Need to create a temporary directory for the new file to be created in. - // this is to ensure we don't overwrite any previous files. - inputFss.connect(new NullProgressMonitor(), false); - IRemoteFile homeDirectory = inputFss.getRemoteFileObject(".", new NullProgressMonitor()); - String baseFolderName = "rsetest"; - String homeFolderName = homeDirectory.getAbsolutePath(); - String testFolderName = FileServiceHelper.getRandomLocation(inputFss, homeFolderName, baseFolderName, new NullProgressMonitor()); - tempDirectory = createFileOrFolder(inputFss, homeFolderName, testFolderName, true); - - tempDirPath = tempDirectory.getAbsolutePath(); - IHostFile hostfile = inputFss.getFileService().createFile(tempDirPath, fileName, new NullProgressMonitor()); - assertTrue(SYSTEM_TYPE + ": hostfile doesn't exist.", hostfile.exists()); - assertTrue(SYSTEM_TYPE + ": hostfile canRead returns false", hostfile.canRead()); - assertTrue(SYSTEM_TYPE + ": hostfile canWrite returns false", hostfile.canWrite()); - assertEquals(SYSTEM_TYPE + ": filename does not match.", fileName, hostfile.getName()); - assertEquals(SYSTEM_TYPE + ": path's to file do not match.", tempDirPath, hostfile.getParentPath()); - // Make sure the file is empty - assertEquals(SYSTEM_TYPE + ": file size's do not match.", 0, hostfile.getSize()); - long modDate = hostfile.getModifiedDate(); - assertTrue(SYSTEM_TYPE + ": modification date is not greater than 0.", modDate > 0); - - // perform cleanup, so EFS uses the right file service next time - cleanup(); - } - - public void cleanup() throws Exception { - if (host != null) { - if (tempDirectory != null) { - IRemoteFileSubSystem fss = getRemoteFileSubSystem(host); - fss.delete(tempDirectory, new NullProgressMonitor()); - fss.disconnect(); - tempDirectory = null; - } - getConnectionManager().removeConnection(host.getSystemProfile().getName(), host.getName()); - host = null; - } - } - - public void tearDown() throws Exception { - cleanup(); - super.tearDown(); - } -} - diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FTPFileSubsystemTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FTPFileSubsystemTestCase.java deleted file mode 100644 index 4dcf1c80c..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FTPFileSubsystemTestCase.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation. - * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - * David McKnight (IBM) - [186363] get rid of obsolete calls to SubSystem.connect() - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.files; - -import java.io.IOException; - -import org.apache.commons.net.ftp.FTPClient; -import org.apache.commons.net.ftp.FTPFile; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IPropertySet; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.PropertySet; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.internal.services.files.ftp.FTPService; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.subsystems.files.ftp.FTPFileSubSystemConfiguration; -import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil; -import org.eclipse.rse.tests.core.connection.IRSEConnectionProperties; -import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; -import org.eclipse.rse.ui.RSEUIPlugin; - -/** - * Test cases for FTP based remote host access. - */ -public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase { - private ISubSystem subSystem; - private IHost connection; - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - if (subSystem != null && subSystem.isConnected()) { - subSystem.disconnect(true); - } - if (connection != null) { - getConnectionManager().removeConnection(connection.getSystemProfileName(), connection.getName()); - } - - subSystem = null; - connection = null; - - super.tearDown(); - } - - /** - * Test the FTP read access to a real remote FTP host. - */ - public void testFTPReadAccessToRemoteHost() { - //-test-author-:UweStieber - if (isTestDisabled()) - return; - - ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry(); - assertNotNull("Failed to get RSE system registry instance!", systemRegistry); //$NON-NLS-1$ - - // Calculate the location of the test connection properties - IPath location = getTestDataLocation("testFTPReadAccessToRemoteHost", false); //$NON-NLS-1$ - assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$ - location = location.append("connection.properties"); //$NON-NLS-1$ - assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$ - assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$ - assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$ - - // Load the properties from the calculated location without backing up defaults - IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false); - assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$ - - // Lookup and create the connection now if necessary - connection = getConnectionManager().findOrCreateConnection(properties); - assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), connection); //$NON-NLS-1$ - // expand the connection in the UI - RSEUIPlugin.getTheSystemRegistryUI().expandHost(connection); - - Exception exception = null; - String cause = null; - - subSystem = null; - try { - subSystem = getConnectionManager().getFileSubSystem(connection, "ftp.files"); //$NON-NLS-1$ - } catch(Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } - assertNull("Failed to get ftp.files subsystem! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertNotNull("No ftp.files subystem", subSystem); //$NON-NLS-1$ - - ISubSystemConfiguration configuration = subSystem.getSubSystemConfiguration(); - assertNotNull("Failed to get ftp.files subsystem configuration instance!", configuration); //$NON-NLS-1$ - - // The ftp.files subsystem supports filtering, therefor ISubSystem.getChildren() is expected - // to return a non null value. - assertTrue("Unexpected return value false for ftp.files subsystem configuration supportFilters()!", configuration.supportsFilters()); //$NON-NLS-1$ - assertNotNull("Unexpected return value null for ftp.files subsystem getChildren()!", subSystem.getChildren()); //$NON-NLS-1$ - - // get access to the services - assertTrue("ftp.files subsystem configuration instance is not of expected type FileServiceSubSystemConfiguration!", configuration instanceof FTPFileSubSystemConfiguration); //$NON-NLS-1$ - FTPFileSubSystemConfiguration ftpConfiguration = (FTPFileSubSystemConfiguration)configuration; - IFileService service = ftpConfiguration.getFileService(connection); - assertNotNull("Failed to get IFileService instance from ftp.files subsystem configuration!", service); //$NON-NLS-1$ - assertTrue("IFileService instance is not of expected type FTPService!", service instanceof FTPService); //$NON-NLS-1$ - final FTPService ftpService = (FTPService)service; - - // configure the service to use passive ftp - IPropertySet set = new PropertySet("testFTPReadAccessToRemoteHost"); //$NON-NLS-1$ - set.addProperty("passive", "true"); //$NON-NLS-1$ //$NON-NLS-2$ - ftpService.setPropertySet(set); - - // we expect that the subsystem is not connected yet - assertFalse("ftp.files subsystem is unexpectedly connected!", subSystem.isConnected()); //$NON-NLS-1$ - try { - subSystem.connect(false, null); - } catch(Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } - assertNull("Failed to connect ftp.files subsystem to host " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME) + "! Possible cause: " + cause, exception); //$NON-NLS-1$ //$NON-NLS-2$ - - // Wait hard-coded 10 seconds to get around asynchronous connection problems. - RSEWaitAndDispatchUtil.waitAndDispatch(10000); - - // if we could not connect in 10 sec. we give up here. The server might be not reachable - // or exceeded the max number of connection or ... or ... or ... Just do not fail in this case. - if (!subSystem.isConnected() || !ftpService.isConnected()) return; - - // expand the subsystem - RSEUIPlugin.getTheSystemRegistryUI().expandSubSystem(subSystem); - - // now we have the service reference and can start reading things from the server - IHostFile[] roots = ftpService.getRoots(new NullProgressMonitor()); - assertNotNull("Failed to get root nodes from ftp.files service!", roots); //$NON-NLS-1$ - - FTPClient ftpClient = ftpService.getFTPClient(); - assertNotNull("Failed to get FTPClient instance!", ftpClient); //$NON-NLS-1$ - - exception = null; - cause = null; - - FTPFile[] files = null; - try { - files = ftpClient.listFiles(); - } catch (IOException e) { - exception = e; - cause = e.getLocalizedMessage(); - } - assertNull("Failed to list the files from ftp server " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME) + "! Possible cause: " + cause, exception); //$NON-NLS-1$ //$NON-NLS-2$ - assertNotNull("Unexpected return value null for FTPClient.listFiles()!", files); //$NON-NLS-1$ - - if (ftpService.isConnected()) ftpService.disconnect(); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FTPWindowsFileSubSystemConfiguration.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FTPWindowsFileSubSystemConfiguration.java deleted file mode 100644 index 903b5cc9c..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FTPWindowsFileSubSystemConfiguration.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Martin Oberhuber (Wind River) - initial API and implementation - *******************************************************************************/ - -package org.eclipse.rse.tests.subsystems.files; - -import org.eclipse.rse.subsystems.files.ftp.FTPFileSubSystemConfiguration; - -public class FTPWindowsFileSubSystemConfiguration extends FTPFileSubSystemConfiguration { - - public FTPWindowsFileSubSystemConfiguration() { - super(); - setIsUnixStyle(false); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileOutputStreamTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileOutputStreamTestCase.java deleted file mode 100644 index 68382a292..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileOutputStreamTestCase.java +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: Kevin Doyle - * - * Contributors: - * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - * Martin Oberhuber (Wind River) - [195402] Add constructor with test name - ********************************************************************************/ - -package org.eclipse.rse.tests.subsystems.files; - -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URI; - -import org.eclipse.core.filesystem.EFS; -import org.eclipse.core.filesystem.IFileStore; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.SystemStartHere; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.internal.efs.RSEFileStore; -import org.eclipse.rse.services.clientserver.PathUtility; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - -public class FileOutputStreamTestCase extends FileServiceBaseTest { - - private IHost host = null; - private IRemoteFile tempDirectory; - - /** - * Constructor with specific test name. - * @param name test to execute - */ - public FileOutputStreamTestCase(String name) { - super(name); - } - - private IRemoteFileSubSystem getRemoteFileSubSystem(IHost host) { - IRemoteFileSubSystem fss = null; - ISystemRegistry sr = SystemStartHere.getSystemRegistry(); - ISubSystem[] ss = sr.getServiceSubSystems(host, IFileService.class); - for (int i=0; i<ss.length; i++) { - if (ss[i] instanceof FileServiceSubSystem) { - fss = (IRemoteFileSubSystem)ss[i]; - return fss; - } - } - return null; - } - - public void testRSEFileStoreAppendOutputStreamLocal() throws Exception { - //-test-author-:KevinDoyle - host = getLocalSystemConnection(); - if (isTestDisabled()) - return; - outputStreamFileWriting(EFS.APPEND); - } - - public void testRSEFileStoreAppendOutputStreamFTP() throws Exception { - //-test-author-:KevinDoyle - host = getFTPHost(); - if (isTestDisabled()) - return; - outputStreamFileWriting(EFS.APPEND); - } - - public void testRSEFileStoreAppendOutputStreamLinux() throws Exception { - //-test-author-:KevinDoyle - host = getLinuxHost(); - if (isTestDisabled()) - return; - outputStreamFileWriting(EFS.APPEND); - } - - public void testRSEFileStoreAppendOutputStreamWindows() throws Exception { - //-test-author-:KevinDoyle - host = getWindowsHost(); - if (isTestDisabled()) - return; - outputStreamFileWriting(EFS.APPEND); - } - - public void testRSEFileStoreAppendOutputStreamSSH() throws Exception { - //-test-author-:KevinDoyle - host = getSSHHost(); - if (isTestDisabled()) - return; - outputStreamFileWriting(EFS.APPEND); - } - - public void testRSEFileStoreOverwriteOutputStreamLocal() throws Exception { - //-test-author-:KevinDoyle - host = getLocalSystemConnection(); - if (isTestDisabled()) - return; - outputStreamFileWriting(EFS.NONE); - } - - public void testRSEFileStoreOverwriteOutputStreamFTP() throws Exception { - //-test-author-:KevinDoyle - host = getFTPHost(); - if (isTestDisabled()) - return; - outputStreamFileWriting(EFS.NONE); - } - - public void testRSEFileStoreOverwriteOutputStreamLinux() throws Exception { - //-test-author-:KevinDoyle - host = getLinuxHost(); - if (isTestDisabled()) - return; - outputStreamFileWriting(EFS.NONE); - } - - public void testRSEFileStoreOverwriteOutputStreamWindows() throws Exception { - //-test-author-:KevinDoyle - host = getWindowsHost(); - if (isTestDisabled()) - return; - outputStreamFileWriting(EFS.NONE); - } - - public void testRSEFileStoreOverwriteOutputStreamSSH() throws Exception { - //-test-author-:KevinDoyle - host = getSSHHost(); - if (isTestDisabled()) - return; - outputStreamFileWriting(EFS.NONE); - } - - public void outputStreamFileWriting(int options) throws Exception { - // RSE URI: rse://SYSTEM_ADDRESS/PATH_TO_FIlE - OutputStream outputStream = null; - InputStream inputStream = null; - - // Create temporary folder - FileServiceSubSystem inputFss = (FileServiceSubSystem) getRemoteFileSubSystem(host); - inputFss.connect(new NullProgressMonitor(), false); - IRemoteFile homeDirectory = inputFss.getRemoteFileObject(".", new NullProgressMonitor()); - String baseFolderName = "rsetest"; - String homeFolderName = homeDirectory.getAbsolutePath(); - String testFolderName = FileServiceHelper.getRandomLocation(inputFss, homeFolderName, baseFolderName, new NullProgressMonitor()); - IRemoteFile targetDir = createFileOrFolder(inputFss, homeFolderName, testFolderName, true); - tempDirectory = targetDir; - - String path = targetDir.getAbsolutePath(); - - String systemType = host.getSystemType().getLabel(); - if (host.getSystemType().isWindows()) { - path = path.replace('\\', '/'); - } - path = fixPathForURI(path); - URI uri = new URI("rse", host.getHostName(), path, null); - - IFileStore parentFS = RSEFileStore.getInstance(uri); - createDir(parentFS, true); - - IFileStore childFS = parentFS.getChild("append.txt"); - - outputStream = childFS.openOutputStream(options, new NullProgressMonitor()); - - String contents = getRandomString(); - byte[] readBytes = new byte[contents.length()]; - outputStream.write(contents.getBytes()); - outputStream.close(); - - inputStream = childFS.openInputStream(EFS.NONE, new NullProgressMonitor()); - inputStream.read(readBytes); - - String input = new String(readBytes); - inputStream.close(); - assertTrue(systemType + ": Contents incorrect writing to an empty file. Expected Contents: " + contents + " Actual Contents: " + input, contents.equals(input)); - - outputStream = childFS.openOutputStream(options, new NullProgressMonitor()); - - String write = " " + getRandomString(); - if ((options & EFS.APPEND) != 0) { - contents += write; - } else { - contents = write; - } - outputStream.write(write.getBytes()); - outputStream.close(); - - readBytes = new byte[contents.length()]; - inputStream = childFS.openInputStream(EFS.NONE, new NullProgressMonitor()); - inputStream.read(readBytes); - - input = new String(readBytes); - inputStream.close(); - assertTrue(systemType + ": Contents incorrect writing to a non-empty file. Expected Contents: " + contents + " Actual Contents: " + input, contents.equals(input)); - // Cleanup, so IFileStore uses the correct connection next time. - cleanup(); - } - - /** - * Adapt a local file system path such that it can be used as - * path in an URI. Converts path delimiters do '/' default - * delimiter, and adds a slash in front if necessary. - * - * Copied from RSEFileSystemContributor as it's private - * @param path the path to adapt - * @return adapted path - */ - private String fixPathForURI(String path) { - String sep = PathUtility.getSeparator(path); - if (!sep.equals("/")) { //$NON-NLS-1$ - path = path.replace(sep.charAt(0), '/'); - } - //<adapted from org.eclipse.core.filesystem.URIUtil.toURI() Copyright(c) 2005, 2006 IBM> - final int length = path.length(); - StringBuffer pathBuf = new StringBuffer(length + 3); - //There must be a leading slash in a hierarchical URI - if (length > 0 && (path.charAt(0) != '/')) - pathBuf.append('/'); - //additional double-slash for UNC paths to distinguish from host separator - if (path.startsWith("//")) //$NON-NLS-1$ - pathBuf.append('/').append('/'); - pathBuf.append(path); - //</adapted from org.eclipse.core.filesystem.URIUtil.toURI() Copyright(c) 2005, 2006 IBM> - return pathBuf.toString(); - } - - public void cleanup() throws Exception { - if (host != null) { - if (tempDirectory != null) { - IRemoteFileSubSystem fss = getRemoteFileSubSystem(host); - fss.delete(tempDirectory, new NullProgressMonitor()); - fss.disconnect(); - tempDirectory = null; - } - getConnectionManager().removeConnection(host.getSystemProfile().getName(), host.getName()); - host = null; - } - } - - public void tearDown() throws Exception { - cleanup(); - super.tearDown(); - } -}
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveBaseTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveBaseTest.java deleted file mode 100644 index 61577561c..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveBaseTest.java +++ /dev/null @@ -1,953 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Johnson Ma (Wind River) - [195402] Extracted from FileServiceArchiveTest - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.files; - -import java.io.File; - -import org.eclipse.core.filesystem.EFS; -import org.eclipse.core.filesystem.IFileStore; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.rse.core.model.ISystemResourceSet; -import org.eclipse.rse.core.model.SystemRemoteResourceSet; -import org.eclipse.rse.core.model.SystemWorkspaceResourceSet; -import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter; -import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; - -public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest { - - protected String folderToCopyName1 = "RemoteSystemsConnections"; - protected String folderToCopyName2 = "6YLT5Xa"; - protected String folderToCopyName3 = "folderToCopy"; - - protected String tarSourceFileName1; - protected String tarSourceFileName2; - - protected String tarSourceFolderName1 = "META-INF"; - protected String tarSourceFolderName2 = "org"; - - protected String tarSourceForOpenTest; - protected String tarSourceForOpenFolderName1 = "META-INF"; - protected String tarSourceForOpenFolderName2 = "org"; - - protected String testName; - - protected String fileContentString1 = "this is just some dummy content \n to a remote file \n to test an open operation"; - - /** - * Constructor with specific test name. - * @param name test to execute - */ - public FileServiceArchiveBaseTest(String name) { - super(name); - } - - public static IWorkspace getWorkspace() { - return ResourcesPlugin.getWorkspace(); - } - - public void createSourceFolders() throws Exception - { - String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString(); - IFileStore temp = createDir(tempPath, true); - String content = getRandomString(); - - // create the source folder used for copy or move - IFileStore folderToCopy = temp.getChild(folderToCopyName3); - createDir(folderToCopy, true); - //Now, populate the contents in the folderToCopy. - IFileStore aaaaaaaa = folderToCopy.getChild("aaaaaaaa"); - createDir(aaaaaaaa, true); - //create file inside the aaaaaaaa folder. - IFileStore adsf = aaaaaaaa.getChild("adsf"); - content = getRandomString(); - createFile(adsf, content); - IFileStore eclipse_SDK_3_3M6_win32_zip = aaaaaaaa.getChild("eclipse-SDK-3.3M6-win32.zip"); - createFile(eclipse_SDK_3_3M6_win32_zip, ""); - IFileStore epdcdump01_hex12 = aaaaaaaa.getChild("epdcdump01.hex12"); - content = getRandomString(); - createFile(epdcdump01_hex12, content); - IFileStore epdcdump01_hex12aaaa = aaaaaaaa.getChild("epdcdump01.hex12aaaa"); - content = getRandomString(); - createFile(epdcdump01_hex12aaaa, content); - - IFileStore aaaab = folderToCopy.getChild("aaaab"); - createDir(aaaab, true); - IFileStore features = aaaab.getChild("features"); - createDir(features, true); - IFileStore dummyFile = features.getChild("dummy.txt"); - content = getRandomString(); - createFile(dummyFile, content); - //create file inside the aaaab folder. - content = "this is just a simple content \n to a simple file \n to test a 'simple' copy"; - IFileStore epdcdump01_hex12a = aaaab.getChild("epdcdump01.hex12a"); - content = getRandomString(); - createFile(epdcdump01_hex12a, content); - - IFileStore epdcdump01_hex12a1 = folderToCopy.getChild("epdcdump01.hex12a"); - content = getRandomString(); - createFile(epdcdump01_hex12a1, content); - - IFileStore RSE_SDK_2_0RC1_zip = folderToCopy.getChild("RSE-SDK-2.0RC1.zip"); - content = getRandomString(); - createFile(RSE_SDK_2_0RC1_zip, content); - - //now, copy folderToCopy into the folder in the remote system - IRemoteFile sourceFolderToCopy3 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName3, mon); - ISystemDragDropAdapter srcAdapter3 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy3).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter3); - fromSet3.addResource(sourceFolderToCopy3); - ISystemResourceSet tempObjects3 = srcAdapter3.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, tempDir, mon, true); - - //Then, we need to retrieve children of the tempDir to cache their information. - fss.resolveFilterString(tempDir, null, mon); - - //Then, delete the temp folder in the junit workspace. - temp.delete(EFS.NONE, mon); - } - - - protected void createSuperTransferFolder(IFileStore temp) throws Exception - { - - String content = getRandomString(); - - // create the source folder used for copy or move - IFileStore folderToCopy = temp.getChild(folderToCopyName3); - createDir(folderToCopy, true); - //Now, populate the contents in the folderToCopy. - IFileStore aaaaaaaa = folderToCopy.getChild("aaaaaaaa"); - createDir(aaaaaaaa, true); - //create file inside the aaaaaaaa folder. - IFileStore adsf = aaaaaaaa.getChild("adsf"); - content = getRandomString(); - createFile(adsf, content); - IFileStore eclipse_SDK_3_3M6_win32_zip = aaaaaaaa.getChild("eclipse-SDK-3.3M6-win32.zip"); - createFile(eclipse_SDK_3_3M6_win32_zip, ""); - IFileStore epdcdump01_hex12 = aaaaaaaa.getChild("epdcdump01.hex12"); - content = getRandomString(); - createFile(epdcdump01_hex12, content); - IFileStore epdcdump01_hex12aaaa = aaaaaaaa.getChild("epdcdump01.hex12aaaa"); - content = getRandomString(); - createFile(epdcdump01_hex12aaaa, content); - - IFileStore aaaab = folderToCopy.getChild("aaaab"); - createDir(aaaab, true); - IFileStore features = aaaab.getChild("features"); - createDir(features, true); - IFileStore dummyFile = features.getChild("dummy.txt"); - content = getRandomString(); - createFile(dummyFile, content); - //create file inside the aaaab folder. - content = "this is just a simple content \n to a simple file \n to test a 'simple' copy"; - IFileStore epdcdump01_hex12a = aaaab.getChild("epdcdump01.hex12a"); - content = getRandomString(); - createFile(epdcdump01_hex12a, content); - - IFileStore epdcdump01_hex12a1 = folderToCopy.getChild("epdcdump01.hex12a"); - content = getRandomString(); - createFile(epdcdump01_hex12a1, content); - - IFileStore RSE_SDK_2_0RC1_zip = folderToCopy.getChild("RSE-SDK-2.0RC1.zip"); - content = getRandomString(); - createFile(RSE_SDK_2_0RC1_zip, content); - - return; - - } - - public void createTarSourceForOpen() throws Exception - { - String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString(); - IFileStore temp = createDir(tempPath, true); - String content = getRandomString(); - - //Now, we need to construct a "source.tar" archive file - //We will construct the content of the tar file in folders "META-INF" and "org" - //Then we copy this folder into a tar file by RSE API. - IFileStore META_INF = temp.getChild(tarSourceForOpenFolderName1); - createDir(META_INF, true); - //Now, populate the contents in the folder. - IFileStore MANIFEST_MF = META_INF.getChild("MANIFEST.MF"); - content = fileContentString1; - createFile(MANIFEST_MF, content); - - //create folder "org" - IFileStore org = temp.getChild("org"); - createDir(org, true); - IFileStore eclipse = org.getChild("eclipse"); - createDir(eclipse, true); - //create "dstore" folder inside "org" - IFileStore dstore = eclipse.getChild("dstore"); - createDir(dstore, true); - //Now, create a few folders inside the dstore folder. - IFileStore core = dstore.getChild("core"); - createDir(core, true); - IFileStore internal = dstore.getChild("internal"); - createDir(internal, true); - - //now create directory inside "core": - IFileStore client = core.getChild("client"); - createDir(client, true); - IFileStore java = core.getChild("java"); - createDir(java, true); - IFileStore miners = core.getChild("miners"); - createDir(miners, true); - IFileStore model = core.getChild("model"); - createDir(model, true); - IFileStore server = core.getChild("server"); - createDir(server, true); - IFileStore util = core.getChild("util"); - createDir(util, true); - IFileStore Activator_java = core.getChild("Activator.java"); - content = fileContentString1; - createFile(Activator_java, content); - - //now, some contents on client folder - IFileStore ClientConnection_java = client.getChild("ClientConnection.java"); - content = getRandomString(); - createFile(ClientConnection_java, content); - IFileStore ConnectionStatus_java = client.getChild("ConnectionStatus.java"); - content = fileContentString1; - createFile(ConnectionStatus_java, content); - - //now, some contents in java folder - IFileStore ClassByteStreamHandler$ReceiveClassInstanceThread_java = java.getChild("ClassByteStreamHandler$ReceiveClassInstanceThread.java"); - content = getRandomString(); - createFile(ClassByteStreamHandler$ReceiveClassInstanceThread_java, content); - - //now, some contents in miners folder - IFileStore Miner_java = miners.getChild("Miner.java"); - content = getRandomString(); - createFile(Miner_java, content); - IFileStore MinerThread_java = miners.getChild("MinerThread.java"); - content = getRandomString(); - createFile(MinerThread_java, content); - - //now, some contents in model folder - IFileStore ByteStreamHandler_java = model.getChild("ByteStreamHandler.java"); - content = getRandomString(); - createFile(ByteStreamHandler_java, content); - IFileStore DE_java = model.getChild("DE.java"); - content = getRandomString(); - createFile(DE_java, content); - IFileStore Handler_java = model.getChild("Handler.java"); - content = getRandomString(); - createFile(Handler_java, content); - - //now, some contents in server folder - IFileStore Server_java = server.getChild("Server.java"); - content = getRandomString(); - createFile(Server_java, content); - - //now, some contents in util folder - IFileStore StringCompare_java = util.getChild("StringCompare.java"); - content = fileContentString1; - createFile(StringCompare_java, content); - - //now, create the contents in "internal" folder - IFileStore core1 = internal.getChild("core"); - createDir(core1, true); - - //then create some folder in this "core" folder - IFileStore client1 = core1.getChild("client"); - createDir(client1, true); - IFileStore model1 = core1.getChild("model"); - createDir(model1, true); - IFileStore server1 = core1.getChild("server"); - createDir(server1, true); - IFileStore util1 = core1.getChild("util"); - createDir(util1, true); - - //now, some contents on client folder - IFileStore ClientConnection_java1 = client1.getChild("ClientConnection.java"); - content = getRandomString(); - createFile(ClientConnection_java1, content); - IFileStore ConnectionStatus_java1 = client1.getChild("ConnectionStatus.java"); - content = getRandomString(); - createFile(ConnectionStatus_java1, content); - - - //now, some contents in model folder - IFileStore ByteStreamHandler_java1 = model1.getChild("ByteStreamHandler.java"); - content = getRandomString(); - createFile(ByteStreamHandler_java1, content); - IFileStore DE_java1 = model1.getChild("DE.java"); - content = getRandomString(); - createFile(DE_java1, content); - IFileStore Handler_java1 = model1.getChild("Handler.java"); - content = getRandomString(); - createFile(Handler_java1, content); - - //now, some contents in server folder - IFileStore Server_java1 = server1.getChild("Server.java"); - content = getRandomString(); - createFile(Server_java1, content); - - //now, some contents in util folder - IFileStore StringCompare_java1 = util1.getChild("StringCompare.java"); - content = getRandomString(); - createFile(StringCompare_java1, content); - - //now, copy META_INF into the folder in the remote system - IRemoteFile META_INF_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceForOpenFolderName1, mon); - assertNotNull(META_INF_folder); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) META_INF_folder).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet.addResource(META_INF_folder); - ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true); - - //now, copy org into the folder in the remote system - IRemoteFile org_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceForOpenFolderName2, mon); - assertNotNull(org_folder); - ISystemDragDropAdapter srcAdapter2 = (ISystemDragDropAdapter) ((IAdaptable) org_folder).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet2 = new SystemRemoteResourceSet(localFss, srcAdapter2); - fromSet2.addResource(org_folder); - ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects2, tempDir, mon, true); - - //now, create tar file in the host - IRemoteFile tarSource = createFileOrFolder(tempDir.getAbsolutePath(), tarSourceForOpenTest, false); - assertNotNull(tarSource); - IRemoteFile tarSourceFolder1 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceForOpenFolderName1); - assertNotNull(tarSourceFolder1); - IRemoteFile tarSourceFolder2 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceForOpenFolderName2); - fss.copy(tarSourceFolder1, tarSource, tarSourceForOpenFolderName1, mon); - fss.copy(tarSourceFolder2, tarSource, tarSourceForOpenFolderName2, mon); - - //Then, we need to retrieve children of the tempDir to cache their information. - fss.resolveFilterString(tempDir, null, mon); - - //Then, delete the temp folder in the junit workspace. - temp.delete(EFS.NONE, mon); - } - - - - public void createSourceTarFiles() throws Exception - { - String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString(); - IFileStore temp = createDir(tempPath, true); - String content = getRandomString(); - - //Now, we need to construct a "source.tar" archive file - //We will construct the content of the tar file in folders "META-INF" and "org" - //Then we copy this folder into a tar file by RSE API. - IFileStore META_INF = temp.getChild(tarSourceFolderName1); - createDir(META_INF, true); - //Now, populate the contents in the folder. - IFileStore MANIFEST_MF = META_INF.getChild("MANIFEST.MF"); - content = getRandomString(); - createFile(MANIFEST_MF, content); - //create folder "org" - IFileStore org = temp.getChild(tarSourceFolderName2); - createDir(org, true); - IFileStore eclipse = org.getChild("eclipse"); - createDir(eclipse, true); - //create "dstore" folder inside "org" - IFileStore dstore = eclipse.getChild("dstore"); - createDir(dstore, true); - //Now, create a few folders inside the dstore folder. - IFileStore core = dstore.getChild("core"); - createDir(core, true); - IFileStore internal = dstore.getChild("internal"); - createDir(internal, true); - - //now create directory inside "core": - IFileStore client = core.getChild("client"); - createDir(client, true); - IFileStore java = core.getChild("java"); - createDir(java, true); - IFileStore miners = core.getChild("miners"); - createDir(miners, true); - IFileStore model = core.getChild("model"); - createDir(model, true); - IFileStore server = core.getChild("server"); - createDir(server, true); - IFileStore util = core.getChild("util"); - createDir(util, true); - IFileStore Activator_java = core.getChild("Activator.java"); - content = getRandomString(); - createFile(Activator_java, content); - - //now, some contents on client folder - IFileStore ClientConnection_java = client.getChild("ClientConnection.java"); - content = getRandomString(); - createFile(ClientConnection_java, content); - IFileStore ConnectionStatus_java = client.getChild("ConnectionStatus.java"); - content = getRandomString(); - createFile(ConnectionStatus_java, content); - - //now, some contents in java folder - IFileStore ClassByteStreamHandler$ReceiveClassInstanceThread_java = java.getChild("ClassByteStreamHandler$ReceiveClassInstanceThread.java"); - content = getRandomString(); - createFile(ClassByteStreamHandler$ReceiveClassInstanceThread_java, content); - - //now, some contents in miners folder - IFileStore Miner_java = miners.getChild("Miner.java"); - content = getRandomString(); - createFile(Miner_java, content); - IFileStore MinerThread_java = miners.getChild("MinerThread.java"); - content = getRandomString(); - createFile(MinerThread_java, content); - - //now, some contents in model folder - IFileStore ByteStreamHandler_java = model.getChild("ByteStreamHandler.java"); - content = getRandomString(); - createFile(ByteStreamHandler_java, content); - IFileStore DE_java = model.getChild("DE.java"); - content = getRandomString(); - createFile(DE_java, content); - IFileStore Handler_java = model.getChild("Handler.java"); - content = getRandomString(); - createFile(Handler_java, content); - - //now, some contents in server folder - IFileStore Server_java = server.getChild("Server.java"); - content = getRandomString(); - createFile(Server_java, content); - - //now, some contents in util folder - IFileStore StringCompare_java = util.getChild("StringCompare.java"); - content = getRandomString(); - createFile(StringCompare_java, content); - - //now, create the contents in "internal" folder - IFileStore core1 = internal.getChild("core"); - createDir(core1, true); - - //then create some folder in this "core" folder - IFileStore client1 = core1.getChild("client"); - createDir(client1, true); - IFileStore model1 = core1.getChild("model"); - createDir(model1, true); - IFileStore server1 = core1.getChild("server"); - createDir(server1, true); - IFileStore util1 = core1.getChild("util"); - createDir(util1, true); - - //now, some contents on client folder - IFileStore ClientConnection_java1 = client1.getChild("ClientConnection.java"); - content = getRandomString(); - createFile(ClientConnection_java1, content); - IFileStore ConnectionStatus_java1 = client1.getChild("ConnectionStatus.java"); - content = getRandomString(); - createFile(ConnectionStatus_java1, content); - - - //now, some contents in model folder - IFileStore ByteStreamHandler_java1 = model1.getChild("ByteStreamHandler.java"); - content = getRandomString(); - createFile(ByteStreamHandler_java1, content); - IFileStore DE_java1 = model1.getChild("DE.java"); - content = getRandomString(); - createFile(DE_java1, content); - IFileStore Handler_java1 = model1.getChild("Handler.java"); - content = getRandomString(); - createFile(Handler_java1, content); - - //now, some contents in server folder - IFileStore Server_java1 = server1.getChild("Server.java"); - content = getRandomString(); - createFile(Server_java1, content); - - //now, some contents in util folder - IFileStore StringCompare_java1 = util1.getChild("StringCompare.java"); - content = getRandomString(); - createFile(StringCompare_java1, content); - - //now, copy META_INF into the folder in the remote system - IRemoteFile META_INF_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceFolderName1, mon); - assertNotNull(META_INF_folder); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) META_INF_folder).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet.addResource(META_INF_folder); - ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true); - - //now, copy org into the folder in the remote system - IRemoteFile org_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceFolderName2, mon); - assertNotNull(org_folder); - ISystemDragDropAdapter srcAdapter2 = (ISystemDragDropAdapter) ((IAdaptable) org_folder).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet2 = new SystemRemoteResourceSet(localFss, srcAdapter2); - fromSet2.addResource(org_folder); - ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects2, tempDir, mon, true); - - //now, create tar file in the host - IRemoteFile tarSource = createFileOrFolder(tempDir.getAbsolutePath(), tarSourceFileName1, false); - assertNotNull(tarSource); - IRemoteFile tarSourceFolder1 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceFolderName1); - assertNotNull(tarSourceFolder1); - IRemoteFile tarSourceFolder2 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceFolderName2); - fss.copy(tarSourceFolder1, tarSource, tarSourceFolderName1, mon); - fss.copy(tarSourceFolder2, tarSource, tarSourceFolderName2, mon); - } - - public void testCreateTarFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip file first. - IRemoteFile newArchiveFile = createFileOrFolder(tempDirPath, testName, false); - assertNotNull(newArchiveFile); - assertTrue(newArchiveFile.exists()); - assertTrue(newArchiveFile.canRead()); - assertTrue(newArchiveFile.canWrite()); - assertEquals(newArchiveFile.getName(), testName); - assertEquals(newArchiveFile.getParentPath(), tempDirPath); - - //fss.resolveFilterString(filterString, monitor) - - //Now, we want to create a text file inside. - String childName = "aaa.txt"; - IRemoteFile file1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false); - assertNotNull(file1); - - childName = "bbb.txt"; - IRemoteFile file2 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false); - assertNotNull(file2); - - //Create a folder - childName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, true); - assertNotNull(folder1); - - //Now, check the contents - String[] namesToCheck = {"aaa.txt", "bbb.txt", "folder1"}; - int[] typesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER}; - checkFolderContents(newArchiveFile, namesToCheck, typesToCheck); - - //Now, create some files inside the folder. - String secondLevelChildName = "ccc.exe"; - IRemoteFile levelTwoChild1 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false); - assertNotNull(levelTwoChild1); - - secondLevelChildName = "ddd.bat"; - IRemoteFile levelTwoChild2 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false); - assertNotNull(levelTwoChild2); - - secondLevelChildName = "another Folder"; //folder with space - IRemoteFile levelTwoChild3 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, true); - assertNotNull(levelTwoChild3); - - //Now, check the contents - String[] namesToCheck1 = {"ccc.exe", "ddd.bat", "another Folder"}; - int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER}; - checkFolderContents(folder1, namesToCheck1, typesToCheck1); - } - - public void testCopyToTarArchiveFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //create the source for testing first - createSourceTarFiles(); - createSourceFolders(); - - String tarTargetFileName = tarSourceFileName1; - IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName); - assertNotNull(targetTarFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Now, copy one of the folder from the sourceFolder into copiedTargetZipFile - fss.copy(sourceFolder, targetTarFile, sourceFolder.getName(), mon); - - Object theCopiedChild = getChildFromFolder(targetTarFile, sourceFolderName); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck); - } - - - - public void testCopyTarVirtualFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //create the source for testing first - createSourceTarFiles(); - - String sourceFileName = tarSourceFileName1; - IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName); - assertNotNull(sourceTarFile); - - //then, create a folder inside the tempDir - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true); - assertNotNull(folder1); - - //Get one of its fourth level children, and copy the folder to there. - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1); - assertNotNull(firstLevelChild); - - fss.copy(firstLevelChild, folder1, tarSourceFolderName1, mon); - - Object copiedVirtualFolder = getChildFromFolder(folder1, tarSourceFolderName1); - assertNotNull(copiedVirtualFolder); - - String[] contents = {"MANIFEST.MF"}; - int[] typesToCheck = {TYPE_FILE}; - checkFolderContents((IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - } - - - public void testMoveToTarArchiveFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //create the source for testing first - createSourceTarFiles(); - createSourceFolders(); - - String tarTargetFileName = tarSourceFileName1; - IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName); - assertNotNull(targetTarFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - fss.move(sourceFolder, targetTarFile, sourceFolder.getName(), mon); - - Object theMovedChild = getChildFromFolder(targetTarFile, sourceFolderName); - - assertNotNull(theMovedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theMovedChild, childrenToCheck, typesToCheck); - - //make sure the original folder is gone. - Object originalSource = getChildFromFolder(tempDir, sourceFolderName); - assertNull(originalSource); - } - - - - public void testMoveTarVirtualFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //create the source for testing first - createSourceTarFiles(); - - String sourceFileName = tarSourceFileName1; - IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName); - assertNotNull(sourceTarFile); - - //then, create a folder inside the tempDir - //then, create a folder inside the tempDir - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true); - assertNotNull(folder1); - - //Now, copy one of the folder from the zip file into folder1 - String movedFolderName = tarSourceFolderName1; - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1); - assertNotNull(firstLevelChild); - fss.move(firstLevelChild, folder1, movedFolderName, mon); - - Object movedVirtualFolder = getChildFromFolder(folder1, movedFolderName); - - assertNotNull(movedVirtualFolder); - - String[] contents = {"MANIFEST.MF"}; - int[] typesToCheck = {TYPE_FILE}; - checkFolderContents((IRemoteFile)movedVirtualFolder, contents, typesToCheck); - - //Now, make sure the moved virtual folder is gone from its original zip file - IRemoteFile tmp = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1); - assertNull(tmp); - } - - - public void testRenameTarVirtualFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip file first. - IRemoteFile newArchiveFile = createFileOrFolder(tempDirPath, testName, false); - - //Now, we want to create a text file inside. - String childName = "aaa.txt"; - IRemoteFile file1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false); - assertNotNull(file1); - - childName = "bbb.txt"; - IRemoteFile file2 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false); - assertNotNull(file2); - - //Create a folder - childName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, true); - assertNotNull(folder1); - - //Now, check the contents - String[] levelOneNamesToCheck = {"aaa.txt", "bbb.txt", "folder1"}; - int[] levalOneTypesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER}; - checkFolderContents(newArchiveFile, levelOneNamesToCheck, levalOneTypesToCheck); - - //Now, create some files inside the folder. - String secondLevelChildName = "ccc.exe"; - IRemoteFile levelTwoChild1 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false); - assertNotNull(levelTwoChild1); - - secondLevelChildName = "ddd.bat"; - IRemoteFile levelTwoChild2 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false); - assertNotNull(levelTwoChild2); - - secondLevelChildName = "another Folder"; //folder with space - IRemoteFile levelTwoChild3 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, true); - assertNotNull(levelTwoChild3); - - //Now, check the contents - String[] levelTwoNamesToCheck = {"ccc.exe", "ddd.bat", "another Folder"}; - int[] levalTwoTypesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER}; - checkFolderContents(folder1, levelTwoNamesToCheck, levalTwoTypesToCheck); - - //Now rename one of the text file in the first level: - IRemoteFile childToRename = (IRemoteFile)getChildFromFolder(newArchiveFile, "aaa.txt"); - fss.rename(childToRename, "aaa1.txt", mon); - //Now rename one of the folder in the first level - childToRename = (IRemoteFile)getChildFromFolder(newArchiveFile, "folder1"); - fss.rename(childToRename, "folder2", mon); - - //Check the result of rename - String[] newLevelOneNamesToCheck = {"aaa1.txt", "bbb.txt", "folder2"}; - checkFolderContents(newArchiveFile, newLevelOneNamesToCheck, levalOneTypesToCheck); - - //Now rename one of the text file in the second level: - IRemoteFile thisFolder = (IRemoteFile)getChildFromFolder(newArchiveFile, "folder2"); - childToRename = (IRemoteFile)getChildFromFolder(thisFolder, "ddd.bat"); - fss.rename(childToRename, "ddd1.bat", mon); - //Now rename one of the folder in the second level - childToRename = (IRemoteFile)getChildFromFolder(thisFolder, "another Folder"); - fss.rename(childToRename, "some folder$", mon); - - //Check the result of rename - String[] newLevelTwoNamesToCheck = {"ccc.exe", "ddd1.bat", "some folder$"}; - checkFolderContents(thisFolder, newLevelTwoNamesToCheck, levalTwoTypesToCheck); - } - - public void testDeleteTarVirtualFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //create the source for testing first - createSourceTarFiles(); - - String sourceFileName = tarSourceFileName1; - IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName); - assertNotNull(sourceTarFile); - - //delete a file from level 2 - String parentForFileToDeleteName ="META-INF"; - IRemoteFile parentForFileToDelete = (IRemoteFile)getChildFromFolder(sourceTarFile, parentForFileToDeleteName); - assertNotNull(parentForFileToDelete); - String deleteFileName = "MANIFEST.MF"; - IRemoteFile fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName); - assertNotNull(fileToToDelete); - //Now, delete this file - fss.delete(fileToToDelete, mon); - fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName); - assertNull(fileToToDelete); - - //then, get directory "java" under org/eclipse/dstore/core - String parentForDirectoryToDeleteName ="org"; - IRemoteFile parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(sourceTarFile, parentForDirectoryToDeleteName); - assertNotNull(parentForDirectoryToDelete); - - parentForDirectoryToDeleteName ="eclipse"; - parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName); - assertNotNull(parentForDirectoryToDelete); - - parentForDirectoryToDeleteName ="dstore"; - parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName); - assertNotNull(parentForDirectoryToDelete); - - parentForDirectoryToDeleteName ="core"; - parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName); - assertNotNull(parentForDirectoryToDelete); - - String directoryToDeleteName = "java"; - IRemoteFile directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName); - //Now, delete this directory - fss.delete(directoryToDelete, mon); - directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName); - - //check result of this operation - String[] contents = {"client", "miners", "model", "server", "util", "Activator.java"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents(parentForDirectoryToDelete, contents, typesToCheck); - - //And check this directory is not there any more. - directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName); - assertNull(directoryToDelete); - - //Now, delete some files and folder inside the a virtual folder. - parentForFileToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, "model"); - deleteFileName = "DE.java"; - fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName); - assertNotNull(fileToToDelete); - - fss.delete(fileToToDelete, mon); - - //check the result - fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName); - - assertNull(fileToToDelete); - } - - - - public void testCopyBatchToTarArchiveFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceTarFiles(); - createSourceFolders(); - - String tarTargetFileName = tarSourceFileName1; - IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName); - assertNotNull(targetTarFile); - - //Now, copy the source folder. - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir,sourceFolderName); - assertNotNull(sourceFolder); - - //Now, copy one of the folder from the sourceFolder into copiedTargetZipFile - IRemoteFile[] sourceFiles = new IRemoteFile[3]; - //Also add some of its children into the batch. - String childToCopyName1 = "aaaaaaaa"; - sourceFiles[0] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName1); - String childToCopyName2 = "aaaab"; - sourceFiles[1] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName2); - String childToCopyName3 = "epdcdump01.hex12a"; - sourceFiles[2] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName3); - fss.copyBatch(sourceFiles, targetTarFile, mon); - - //Checking the first copied folder - Object theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName1); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck1 = {"adsf", "eclipse-SDK-3.3M6-win32.zip", "epdcdump01.hex12", "epdcdump01.hex12aaaa"}; - - int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck1, typesToCheck1); - - //Checking the second copied folder - theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName2); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck2 = {"features"}; - - int[] typesToCheck2 = {TYPE_FOLDER}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck2, typesToCheck2); - - //Checking the third copied file - theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName3); - assertNotNull(theCopiedChild); - assertTrue(((IRemoteFile)theCopiedChild).isDirectory() != true); - } - - - - - public void testOpenFileFromTarArchive() throws Exception { - if (isTestDisabled()) - return; - - //create the source for testing first - createTarSourceForOpen(); - - String tarTargetFileName = tarSourceForOpenTest; - IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName); - assertNotNull(targetTarFile); - - //Now get the contents of the virtual file we want to download: - String fileContentToVerifyName1 = "MANIFEST.MF"; - - //Get its parent first. - IRemoteFile itsParentFolder = (IRemoteFile)getChildFromFolder(tempDir,tarSourceForOpenFolderName1); - assertNotNull(itsParentFolder); - - //Then get this file: - IRemoteFile thisVirtualFile = (IRemoteFile)getChildFromFolder(itsParentFolder, fileContentToVerifyName1); - assertNotNull(thisVirtualFile); - - //Now, we want to download the content of this file - //We could just construct a dummy localpath for it. - String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString(); - IFileStore temp = createDir(tempPath, true); - String localPath = tempPath + File.separator + fileContentToVerifyName1; - fss.download(thisVirtualFile, localPath, thisVirtualFile.getEncoding(), mon); - - //now, verify the content of the local file - IFileStore localFile = temp.getChild(fileContentToVerifyName1); - //Check the content of the download file: - boolean sameContent = compareContent(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null)); - assertTrue(sameContent); - - - //now, we got the contents of another virtual file we want to download: - String fileContentToVerifyName2 = "Activator.java"; - itsParentFolder = (IRemoteFile)getChildFromFolder(tempDir,tarSourceForOpenFolderName2); - assertNotNull(itsParentFolder); - itsParentFolder = (IRemoteFile)getChildFromFolder(itsParentFolder,"eclipse"); - assertNotNull(itsParentFolder); - itsParentFolder = (IRemoteFile)getChildFromFolder(itsParentFolder,"dstore"); - assertNotNull(itsParentFolder); - itsParentFolder = (IRemoteFile)getChildFromFolder(itsParentFolder,"core"); - assertNotNull(itsParentFolder); - thisVirtualFile = (IRemoteFile)getChildFromFolder(itsParentFolder, fileContentToVerifyName2); - assertNotNull(thisVirtualFile); - localPath = tempPath + File.separator + fileContentToVerifyName2; - fss.download(thisVirtualFile, localPath, thisVirtualFile.getEncoding(), mon); - - //now, verify the content of the local file - localFile = temp.getChild(fileContentToVerifyName2); - //Check the content of the download file: - sameContent = compareContent(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null)); - assertTrue(sameContent); - } - - - - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveTest.java deleted file mode 100644 index 64e27794f..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveTest.java +++ /dev/null @@ -1,1527 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xuan Chen (IBM) - initial API and implementation - * Martin Oberhuber (Wind River) - Fix Javadoc warnings - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - * Johnson Ma (Wind River) - [195402] Add tar.gz archive support - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.files; - -import org.eclipse.core.filesystem.EFS; -import org.eclipse.core.filesystem.IFileStore; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.model.ISystemResourceSet; -import org.eclipse.rse.core.model.SystemRemoteResourceSet; -import org.eclipse.rse.core.model.SystemWorkspaceResourceSet; -import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter; -import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; - -public class FileServiceArchiveTest extends FileServiceArchiveBaseTest { - - - protected String zipSourceFileName1 = "closedBefore.zip"; - protected String zipSourceFileName2 = "mynewzip.zip"; - - protected String ZIP_SOURCE_DIR = ""; - protected String TEST_DIR = ""; - protected String SYSTEM_TYPE_ID = IRSESystemType.SYSTEMTYPE_LOCAL_ID; - protected String SYSTEM_ADDRESS = ""; - protected String SYSTEM_NAME = ""; - protected String USER_ID = ""; - protected String PASSWORD = ""; - - /** - * Constructor with specific test name. - * @param name test to execute - */ - public FileServiceArchiveTest(String name) { - super(name); - tarSourceFileName1 = "source.tar"; - tarSourceFileName2 = "mynewtar.tar"; - tarSourceForOpenTest = "tarSourceForOpen.tar"; - testName = "dummy.tar"; - } - - public void createSourceZipFiles() throws Exception - { - createSourceZipFiles(fss); - } - public IRemoteFile createSourceZipFiles(IFileServiceSubSystem inputFss) throws Exception - { - /* build scenario */ - String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString(); - IFileStore temp = createDir(tempPath, true); - String content = getRandomString(); - - //Now, we need to construct a "closeBefore.zip" archive file - //We will construct the content of the zip file in folder "RemoteSystemsConnections" - //Then we copy this folder into a zip file by RSE API. - IFileStore RemoteSystemsConnections = temp.getChild(folderToCopyName1); - createDir(RemoteSystemsConnections, true); - //Now, populate the contents in the folderToCopy. - IFileStore Team = RemoteSystemsConnections.getChild("Team"); - createDir(Team, true); - //create folder inside the Team folder. - IFileStore Connections = Team.getChild("Connections"); - createDir(Connections, true); - IFileStore dummyFile = Connections.getChild("dummy.txt"); - content = getRandomString(); - createFile(dummyFile, content); - IFileStore Filters = Team.getChild("Filters"); - createDir(Filters, true); - //Now, create a few folders inside the Filters folder. - IFileStore ibm_cmds = Filters.getChild("ibm.cmds"); - createDir(ibm_cmds, true); - IFileStore ibm_cmds400 = Filters.getChild("ibm.cmds400"); - createDir(ibm_cmds400, true); - //create another directory inside this one - IFileStore filter_pool1 = ibm_cmds400.getChild("FilterPool_Team Filter Pool"); - createDir(filter_pool1, true); - //create a file inside this folder - IFileStore filter_pool1_xml = filter_pool1.getChild("filterPool_Team Filter Pool.xmi"); - content = getRandomString(); - createFile(filter_pool1_xml, content); - - IFileStore ibm_cmdsIFS = Filters.getChild("ibm.cmdsIFS"); - createDir(ibm_cmdsIFS, true); - IFileStore ibm_cmdsLocal = Filters.getChild("ibm.cmdsLocal"); - createDir(ibm_cmdsLocal, true); - - IFileStore ibm_files = Filters.getChild("ibm.files"); - createDir(ibm_files, true); - //create another directory inside this one - IFileStore filter_pool2 = ibm_files.getChild("FilterPool_Team Filter Pool"); - createDir(filter_pool2, true); - //create a file inside this folder - IFileStore filter_pool2_xml = filter_pool2.getChild("filterPool_Team Filter Pool.xmi"); - content = getRandomString(); - createFile(filter_pool2_xml, content); - - IFileStore ibm_files_aix = Filters.getChild("ibm.files.aix"); - createDir(ibm_files_aix, true); - //create another directory inside this one - IFileStore filter_pool3 = ibm_files_aix.getChild("FilterPool_Team Filter Pool"); - createDir(filter_pool3, true); - //create a file inside this folder - IFileStore filter_pool3_xml = filter_pool3.getChild("filterPool_Team Filter Pool.xmi"); - content = getRandomString(); - createFile(filter_pool3_xml, content); - - IFileStore ibm_iles_powerlinux = Filters.getChild("ibm.files.powerlinux"); - createDir(ibm_iles_powerlinux, true); - //create another directory inside this one - IFileStore filter_pool4 = ibm_iles_powerlinux.getChild("FilterPool_Team Filter Pool"); - createDir(filter_pool4, true); - //create a file inside this folder - IFileStore filter_pool4_xml = filter_pool4.getChild("filterPool_Team Filter Pool.xmi"); - content = getRandomString(); - createFile(filter_pool4_xml, content); - - IFileStore ibm_files400 = Filters.getChild("ibm.files400"); - createDir(ibm_files400, true); - //create another directory inside this one - IFileStore filter_pool5 = ibm_files400.getChild("FilterPool_Team Filter Pool"); - createDir(filter_pool5, true); - //create a file inside this folder - IFileStore filter_pool5_xml = filter_pool5.getChild("filterPool_Team Filter Pool.xmi"); - content = getRandomString(); - createFile(filter_pool5_xml, content); - - IFileStore ibm_filesLocal = Filters.getChild("ibm.filesLocal"); - createDir(ibm_filesLocal, true); - //create another directory inside this one - IFileStore filter_pool6 = ibm_filesLocal.getChild("FilterPool_Team Filter Pool"); - createDir(filter_pool6, true); - //create a file inside this folder - IFileStore filter_pool6_xml = filter_pool6.getChild("filterPool_Team Filter Pool.xmi"); - content = getRandomString(); - createFile(filter_pool6_xml, content); - - IFileStore ibm_filesIFS = Filters.getChild("ibm.filesIFS"); - createDir(ibm_filesIFS, true); - //create another directory inside this one - IFileStore filter_pool7 = ibm_filesIFS.getChild("FilterPool_Team Filter Pool"); - createDir(filter_pool7, true); - //create a file inside this folder - IFileStore filter_pool7_xml = filter_pool7.getChild("filterPool_Team Filter Pool.xmi"); - content = getRandomString(); - createFile(filter_pool7_xml, content); - - IFileStore ibm_filesWindows = Filters.getChild("ibm.filesWindows"); - createDir(ibm_filesWindows, true); - //create another directory inside this one - IFileStore filter_pool8 = ibm_filesWindows.getChild("FilterPool_Team Filter Pool"); - createDir(filter_pool8, true); - //create a file inside this folder - IFileStore filter_pool8_xml = filter_pool8.getChild("filterPool_Team Filter Pool.xmi"); - content = getRandomString(); - createFile(filter_pool8_xml, content); - - IFileStore ibm_jobs400 = Filters.getChild("ibm.jobs400"); - createDir(ibm_jobs400, true); - //create another directory inside this one - IFileStore filter_pool9 = ibm_jobs400.getChild("FilterPool_Team Filter Pool"); - createDir(filter_pool9, true); - //create a file inside this folder - IFileStore filter_pool9_xml = filter_pool9.getChild("filterPool_Team Filter Pool.xmi"); - content = getRandomString(); - createFile(filter_pool9_xml, content); - - //create file inside the Team folder. - IFileStore profile_xml = Team.getChild("profile.xmi"); - content = getRandomString(); - createFile(profile_xml, content); - - //Now create another folder TypeFilters in the RemoteSystemsConnections folder - IFileStore TypeFilters = RemoteSystemsConnections.getChild("TypeFilters"); - createDir(TypeFilters, true); - dummyFile = TypeFilters.getChild("dummy.txt"); - content = getRandomString(); - createFile(dummyFile, content); - //Now create another folder xuanchentp in the RemoteSystemsConnections folder - IFileStore xuanchentp = RemoteSystemsConnections.getChild("xuanchentp"); - createDir(xuanchentp, true); - //Create some files and folder inside the xuanchentp folder - IFileStore Connections1 = xuanchentp.getChild("Connections"); - createDir(Connections1, true); - dummyFile = Connections1.getChild("dummy.txt"); - content = getRandomString(); - createFile(dummyFile, content); - IFileStore Filters1 = xuanchentp.getChild("Filters"); - createDir(Filters1, true); - dummyFile = Filters1.getChild("dummy.txt"); - content = getRandomString(); - createFile(dummyFile, content); - IFileStore profile_xml1 = xuanchentp.getChild("profile.xmi"); - content = getRandomString(); - createFile(profile_xml1, content); - //now create two other files inside folder RemoteSystemConnections - IFileStore compatibility = RemoteSystemsConnections.getChild(".compatibility"); - content = getRandomString(); - createFile(compatibility, content); - IFileStore project = RemoteSystemsConnections.getChild(".project"); - createFile(project, content); - - //Now, we need to create the content of mynewzip.zip file - IFileStore folder_6YLT5Xa = temp.getChild(folderToCopyName2); - createDir(folder_6YLT5Xa, true); - IFileStore folder_20070315a = folder_6YLT5Xa.getChild("20070315a"); - createDir(folder_20070315a, true); - IFileStore QB5ROUTaadd = folder_20070315a.getChild("QB5ROUTaadd"); - content = getRandomString(); - createFile(QB5ROUTaadd, content); - IFileStore folder_20070319 = folder_6YLT5Xa.getChild("20070319"); - createDir(folder_20070319, true); - content = getRandomString(); - IFileStore QB5ROUTERa = folder_20070319.getChild("QB5ROUTERa"); - content = getRandomString(); - createFile(QB5ROUTERa, content); - IFileStore folder_20070320a = folder_6YLT5Xa.getChild("20070320a"); - createDir(folder_20070320a, true); - IFileStore QB5ROupdfasd = folder_20070320a.getChild("QB5ROupdfasd"); - content = getRandomString(); - createFile(QB5ROupdfasd, content); - IFileStore folder_20070404a = folder_6YLT5Xa.getChild("20070404a"); - createDir(folder_20070404a, true); - IFileStore qb5routeraad = folder_20070404a.getChild("qb5routeraad"); - content = getRandomString(); - createFile(qb5routeraad, content); - IFileStore dummyFolder = folder_6YLT5Xa.getChild("dummyFolder"); - createDir(dummyFolder, true); - IFileStore folder_20070404a1 = dummyFolder.getChild("20070404a"); - createDir(folder_20070404a1, true); - IFileStore qb5routeraa = folder_20070404a1.getChild("qb5routeraa"); - content = getRandomString(); - createFile(qb5routeraa, content); - IFileStore epdcdump01_hex12ab = dummyFolder.getChild("epdcdump01.hex12ab"); - content = getRandomString(); - createFile(epdcdump01_hex12ab, content); - - IRemoteFile targetDir = null; - if (inputFss != fss) - { - //Create the tempDir inside the inputFss - try - { - IRemoteFile homeDirectory = inputFss.getRemoteFileObject(".", mon); - String baseFolderName = "rsetest"; - String homeFolderName = homeDirectory.getAbsolutePath(); - String testFolderName = FileServiceHelper.getRandomLocation(localFss, homeFolderName, baseFolderName, mon); - targetDir = createFileOrFolder(localFss, homeFolderName, testFolderName, true); - } - catch (Exception e) - { - fail("Problem encountered: " + e.getStackTrace().toString()); - } - } - else - { - targetDir = tempDir; - } - //now, copy folderToCopy into the folder in the remote system - IRemoteFile sourceFolderToCopy1 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName1, mon); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy1).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet.addResource(sourceFolderToCopy1); - ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects1, targetDir, mon, true); - - IRemoteFile sourceFolderToCopy2 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName2, mon); - ISystemDragDropAdapter srcAdapter2 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy2).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet2 = new SystemRemoteResourceSet(localFss, srcAdapter2); - fromSet2.addResource(sourceFolderToCopy2); - ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects2, targetDir, mon, true); - - IRemoteFile zipSource1 = createFileOrFolder(inputFss, targetDir.getAbsolutePath(), zipSourceFileName1, false); - assertNotNull(zipSource1); - IRemoteFile zipSourceFolder = (IRemoteFile)getChildFromFolder(inputFss, targetDir, folderToCopyName1); - inputFss.copy(zipSourceFolder, zipSource1, folderToCopyName1, mon); - - IRemoteFile zipSource2 = createFileOrFolder(inputFss, targetDir.getAbsolutePath(), zipSourceFileName2, false); - assertNotNull(zipSource2); - IRemoteFile zipSourceFolder2 = (IRemoteFile)getChildFromFolder(inputFss, targetDir, folderToCopyName2); - inputFss.copy(zipSourceFolder2, zipSource2, folderToCopyName2, mon); - - //Then, we need to retrieve children of the tempDir to cache their information. - inputFss.resolveFilterString(targetDir, null, mon); - - //Then, delete the temp folder in the junit workspace. - temp.delete(EFS.NONE, mon); - - return targetDir; - } - - - - public void testCreateZipFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip file first. - String testName = "dummy.zip"; - IRemoteFile newArchiveFile = createFileOrFolder(tempDirPath, testName, false); - assertNotNull(newArchiveFile); - assertTrue(newArchiveFile.exists()); - assertTrue(newArchiveFile.canRead()); - assertTrue(newArchiveFile.canWrite()); - assertEquals(newArchiveFile.getName(), testName); - - //fss.resolveFilterString(filterString, monitor) - - //Now, we want to create a text file inside. - String childName = "aaa.txt"; - IRemoteFile file1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false); - assertNotNull(file1); - - childName = "bbb.txt"; - IRemoteFile file2 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false); - assertNotNull(file2); - - //Create a folder - childName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, true); - assertNotNull(folder1); - - //Now, check the contents - String[] namesToCheck = {"aaa.txt", "bbb.txt", "folder1"}; - int[] typesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER}; - checkFolderContents(newArchiveFile, namesToCheck, typesToCheck); - - //Now, create some files inside the folder. - String secondLevelChildName = "ccc.exe"; - IRemoteFile levelTwoChild1 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false); - assertNotNull(levelTwoChild1); - - secondLevelChildName = "ddd.bat"; - IRemoteFile levelTwoChild2 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false); - assertNotNull(levelTwoChild2); - - secondLevelChildName = "another Folder"; //folder with space - IRemoteFile levelTwoChild3 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, true); - assertNotNull(levelTwoChild3); - - //Now, check the contents - String[] namesToCheck1 = {"ccc.exe", "ddd.bat", "another Folder"}; - int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER}; - checkFolderContents(folder1, namesToCheck1, typesToCheck1); - - return; - - } - - public void testRenameVirtualFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip file first. - String testName = "dummy.zip"; - IRemoteFile newArchiveFile = createFileOrFolder(tempDirPath, testName, false); - - //Now, we want to create a text file inside. - String childName = "aaa.txt"; - IRemoteFile file1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false); - assertNotNull(file1); - - childName = "bbb.txt"; - IRemoteFile file2 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false); - assertNotNull(file2); - - //Create a folder - childName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, true); - assertNotNull(folder1); - - //Now, check the contents - String[] levelOneNamesToCheck = {"aaa.txt", "bbb.txt", "folder1"}; - int[] levalOneTypesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER}; - checkFolderContents(newArchiveFile, levelOneNamesToCheck, levalOneTypesToCheck); - - //Now, create some files inside the folder. - String secondLevelChildName = "ccc.exe"; - IRemoteFile levelTwoChild1 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false); - assertNotNull(levelTwoChild1); - - secondLevelChildName = "ddd.bat"; - IRemoteFile levelTwoChild2 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false); - assertNotNull(levelTwoChild2); - - secondLevelChildName = "another Folder"; //folder with space - IRemoteFile levelTwoChild3 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, true); - assertNotNull(levelTwoChild3); - - //Now, check the contents - String[] levelTwoNamesToCheck = {"ccc.exe", "ddd.bat", "another Folder"}; - int[] levalTwoTypesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER}; - checkFolderContents(folder1, levelTwoNamesToCheck, levalTwoTypesToCheck); - - //Now rename one of the text file in the first level: - IRemoteFile childToRename = (IRemoteFile)getChildFromFolder(newArchiveFile, "aaa.txt"); - fss.rename(childToRename, "aaa1.txt", mon); - //Now rename one of the folder in the first level - childToRename = (IRemoteFile)getChildFromFolder(newArchiveFile, "folder1"); - fss.rename(childToRename, "folder2", mon); - - //Check the result of rename - String[] newLevelOneNamesToCheck = {"aaa1.txt", "bbb.txt", "folder2"}; - checkFolderContents(newArchiveFile, newLevelOneNamesToCheck, levalOneTypesToCheck); - - //Now rename one of the text file in the second level: - IRemoteFile thisFolder = (IRemoteFile)getChildFromFolder(newArchiveFile, "folder2"); - childToRename = (IRemoteFile)getChildFromFolder(thisFolder, "ddd.bat"); - fss.rename(childToRename, "ddd1.bat", mon); - //Now rename one of the folder in the second level - childToRename = (IRemoteFile)getChildFromFolder(thisFolder, "another Folder"); - fss.rename(childToRename, "some folder$", mon); - - //Check the result of rename - String[] newLevelTwoNamesToCheck = {"ccc.exe", "ddd1.bat", "some folder$"}; - checkFolderContents(thisFolder, newLevelTwoNamesToCheck, levalTwoTypesToCheck); - - return; - - } - - public void testMoveVirtualFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the source data needed for testing - createSourceZipFiles(); - - //then, create a folder inside the tempDir - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true); - assertNotNull(folder1); - - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName); - - //Now, copy one of the folder from the zip file into folder1 - Object[] children = fss.resolveFilterString(sourceZipFile, null, mon); - IRemoteFile originalVirtualFolder = (IRemoteFile)children[0]; - String movedFolderName = originalVirtualFolder.getName(); - fss.move(originalVirtualFolder, folder1, movedFolderName, mon); - - - Object movedVirtualFolder = getChildFromFolder(folder1, movedFolderName); - - assertNotNull(movedVirtualFolder); - - String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)movedVirtualFolder, contents, typesToCheck); - - //Now, make sure the moved virtual folder is gone from its original zip file - children = fss.resolveFilterString(sourceZipFile, null, mon); - assertTrue(children.length == 0); - } - - public void testMoveVirtualFileLevelTwo() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - - //then, create a folder inside the tempDir - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true); - assertNotNull(folder1); - - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //Now, move one of the level two folder from the zip file into folder1 - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "Team"); - String movedFolderName = secondLevelChild.getName(); - - //copy this level two childer into folder1 - fss.move(secondLevelChild, folder1, movedFolderName, mon); - - Object movedVirtualFolder = getChildFromFolder(folder1, movedFolderName); - - assertNotNull(movedVirtualFolder); - - String[] contents = {"Connections", "Filters", "profile.xmi"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents((IRemoteFile)movedVirtualFolder, contents, typesToCheck); - - //Now, make sure the moved virtual folder is gone from its original zip file - Object originalVirtualFolder = getChildFromFolder(firstLevelChild, movedFolderName); - - assertNull(originalVirtualFolder); //we should not be able to find it. - } - - public void testMoveToArchiveFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - createSourceFolders(); - - String targetZipFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir, targetZipFileName); - assertNotNull(targetZipFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Now, move one of the folder from the sourceFolder into copiedTargetZipFile - fss.move(sourceFolder, targetZipFile, sourceFolder.getName(), mon); - - Object theMovedChild = getChildFromFolder(targetZipFile, sourceFolderName); - assertNotNull(theMovedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theMovedChild, childrenToCheck, typesToCheck); - - //make sure the original folder is gone. - //make sure the original folder is gone. - IRemoteFile tempDirRemoteFile = fss.getRemoteFileObject(tempDirPath, mon); - Object originalSource = getChildFromFolder(tempDirRemoteFile, sourceFolderName); - assertNull(originalSource); - } - - public void testMoveToVirtualFileLevelOne() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - createSourceFolders(); - - String targetZipFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir, targetZipFileName); - assertNotNull(targetZipFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Now, move one of the folder from the sourceFolder into a first level virtual file in targetZipFile - //Get one of its first level children, and move the folder to there. - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(targetZipFile, folderToCopyName1); - - fss.move(sourceFolder, firstLevelChild, sourceFolderName, mon); - - Object theMovedChild = getChildFromFolder(firstLevelChild, sourceFolderName); - - assertNotNull(theMovedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theMovedChild, childrenToCheck, typesToCheck); - - //make sure the original folder is gone. - IRemoteFile tempDirRemoteFile = fss.getRemoteFileObject(tempDirPath, mon); - Object originalSource = getChildFromFolder(tempDirRemoteFile, sourceFolderName); - assertNull(originalSource); - } - - public void testMoveToVirtualFileLevelTwo() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - createSourceFolders(); - - String targetZipFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir, targetZipFileName); - assertTrue(targetZipFile != null); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertTrue(sourceFolder != null); - - //Get one of its second level children, and move the folder to there. - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(targetZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "Team"); - - fss.move(sourceFolder, secondLevelChild, sourceFolder.getName(), mon); - - Object theMovedChild = getChildFromFolder(secondLevelChild, sourceFolderName); - - assertNotNull(theMovedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theMovedChild, childrenToCheck, typesToCheck); - - //make sure the original folder is gone. - IRemoteFile tempDirRemoteFile = fss.getRemoteFileObject(tempDirPath, mon); - Object originalSource = getChildFromFolder(tempDirRemoteFile, sourceFolderName); - assertNull(originalSource); - } - - - public void testCopyVirtualFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //then, create a folder inside the tempDir - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true); - assertNotNull(folder1); - - //Now, copy one of the folder from the zip file into folder1 - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1); - fss.copy(firstLevelChild, folder1, folderToCopyName1, mon); - - Object copiedVirtualFolder = getChildFromFolder(folder1, folderToCopyName1); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - } - - public void testCopyVirtualFileLevelTwo() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - - //copy the zip file first. - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //then, create a folder inside the tempDir - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true); - assertNotNull(folder1); - - //Now, copy one of the level two folder from the zip file into folder1 - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "Team"); - //copy this level two children into folder1 - fss.copy(secondLevelChild, folder1, secondLevelChild.getName(), mon); - - Object copiedVirtualFolder = getChildFromFolder(folder1, secondLevelChild.getName()); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Connections", "Filters", "profile.xmi"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents((IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - } - - - public void testCopyToArchiveFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - createSourceFolders(); - - String targetZipFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir, targetZipFileName); - assertNotNull(targetZipFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Now, copy one of the folder from the sourceFolder into copiedTargetZipFile - fss.copy(sourceFolder, targetZipFile, sourceFolder.getName(), mon); - - Object theCopiedChild = getChildFromFolder(targetZipFile, sourceFolderName); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck); - } - - - - public void testCopyToVirtualFileLevelOne() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - createSourceFolders(); - - String targetZipFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir, targetZipFileName); - assertNotNull(targetZipFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Now, copy one of the folder from the sourceFolder into a first level virtual file in targetZipFile - //Get one of its first level children, and copy the folder to there. - //Now, copy one of the level two folder from the zip file into folder1 - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(targetZipFile, folderToCopyName1); - - fss.copy(sourceFolder, firstLevelChild, sourceFolder.getName(), mon); - - Object theCopiedChild = getChildFromFolder(firstLevelChild, sourceFolderName); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck); - } - - - public void testCopyToVirtualFileLevelTwo() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - createSourceFolders(); - - String zipTargetFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir, zipTargetFileName); - assertNotNull(targetZipFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, folderToCopyName3); - assertNotNull(sourceFolder); - - //Get one of its second level children, and copy the folder to there. - //Now, copy one of the level two folder from the zip file into folder1 - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(targetZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "TypeFilters"); - - fss.copy(sourceFolder, secondLevelChild, sourceFolder.getName(), mon); - - Object theCopiedChild = getChildFromFolder(secondLevelChild, sourceFolderName); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck); - } - - public void testCopyBatchToArchiveFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - createSourceFolders(); - - String zipTargetFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir,zipTargetFileName); - assertNotNull(targetZipFile); - - //Now, copy the source folder. - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir,sourceFolderName); - assertNotNull(sourceFolder); - - //Now, copy one of the folder from the sourceFolder into copiedTargetZipFile - IRemoteFile[] sourceFiles = new IRemoteFile[3]; - //Also add some of its children into the batch. - String childToCopyName1 = "aaaaaaaa"; - sourceFiles[0] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName1); - String childToCopyName2 = "aaaab"; - sourceFiles[1] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName2); - String childToCopyName3 = "epdcdump01.hex12a"; - sourceFiles[2] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName3); - fss.copyBatch(sourceFiles, targetZipFile, mon); - - //Checking the first copied folder - Object theCopiedChild = getChildFromFolder(targetZipFile, childToCopyName1); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck1 = {"adsf", "eclipse-SDK-3.3M6-win32.zip", "epdcdump01.hex12", "epdcdump01.hex12aaaa"}; - - int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck1, typesToCheck1); - - //Checking the second copied folder - theCopiedChild = getChildFromFolder(targetZipFile, childToCopyName2); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck2 = {"features"}; - - int[] typesToCheck2 = {TYPE_FOLDER}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck2, typesToCheck2); - - //Checking the third copied file - theCopiedChild = getChildFromFolder(targetZipFile, childToCopyName3); - assertNotNull(theCopiedChild); - assertTrue(((IRemoteFile)theCopiedChild).isDirectory() != true); - } - - public void testCopyBatchToVirtualFileLevelOne() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - createSourceFolders(); - - String zipTargetFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir, zipTargetFileName); - assertNotNull(targetZipFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Now, copy one of the folder from the sourceFolder into a first level virtual file in targetZipFile - //Get one of its first level children, and copy the folder to there. - Object[] childrenOfTargetZipFile = fss.resolveFilterString(targetZipFile, null, mon); - - IRemoteFile[] sourceFiles = new IRemoteFile[1]; - sourceFiles[0] = sourceFolder; - fss.copyBatch(sourceFiles, ((IRemoteFile)childrenOfTargetZipFile[0]), mon); - - Object theCopiedChild = getChildFromFolder(((IRemoteFile)childrenOfTargetZipFile[0]), sourceFolderName); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck); - } - - public void testCopyBatchToVirtualFileLevelTwo() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - createSourceFolders(); - - String zipTargetFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir, zipTargetFileName); - assertNotNull(targetZipFile); - - //Now, copy the source folder. - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Get one of its second level children, and copy the folder to there. - //Now, copy one of the level two folder from the zip file into folder1 - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(targetZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "TypeFilters"); - - IRemoteFile[] sourceFiles = new IRemoteFile[3]; - //Also add some of its children into the batch. - String childToCopyName1 = "aaaaaaaa"; - sourceFiles[0] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName1); - String childToCopyName2 = "aaaab"; - sourceFiles[1] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName2); - String childToCopyName3 = "epdcdump01.hex12a"; - sourceFiles[2] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName3); - fss.copyBatch(sourceFiles, secondLevelChild, mon); - - - //Checking the first copied folder - Object theCopiedChild = getChildFromFolder(secondLevelChild, childToCopyName1); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck1 = {"adsf", "eclipse-SDK-3.3M6-win32.zip", "epdcdump01.hex12", "epdcdump01.hex12aaaa"}; - - int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck1, typesToCheck1); - - //Checking the second copied folder - theCopiedChild = getChildFromFolder(secondLevelChild, childToCopyName2); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck2 = {"features"}; - - int[] typesToCheck2 = {TYPE_FOLDER}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck2, typesToCheck2); - - //Checking the third copied file - theCopiedChild = getChildFromFolder(secondLevelChild, childToCopyName3); - assertNotNull(theCopiedChild); - assertTrue(((IRemoteFile)theCopiedChild).isDirectory() != true); - } - - public void testCopyBatchVirtualFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - - String sourceFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir,sourceFileName); - assertNotNull(sourceZipFile); - - //then, create a folder inside the tempDir - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true); - assertNotNull(folder1); - - //Now, copy one of the folder from the zip file into folder1 - Object[] children = fss.resolveFilterString(sourceZipFile, null, mon); - IRemoteFile[] sourceFiles = new IRemoteFile[3]; - String childToCopyName1 = "Team"; - sourceFiles[0] = (IRemoteFile)getChildFromFolder((IRemoteFile)children[0], childToCopyName1); - assertNotNull(sourceFiles[0]); - String childToCopyName2 = "xuanchentp"; - sourceFiles[1] = (IRemoteFile)getChildFromFolder((IRemoteFile)children[0], childToCopyName2); - assertNotNull(sourceFiles[1]); - String childToCopyName3 = ".compatibility"; - sourceFiles[2] = (IRemoteFile)getChildFromFolder((IRemoteFile)children[0], childToCopyName3); - assertNotNull(sourceFiles[2]); - fss.copyBatch(sourceFiles, folder1, mon); - - Object copiedVirtualFolder = getChildFromFolder(folder1, childToCopyName1); - assertNotNull(copiedVirtualFolder); - String[] contents1 = {"Connections", "Filters", "profile.xmi"}; - int[] typesToCheck1 = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents((IRemoteFile)copiedVirtualFolder, contents1, typesToCheck1); - - copiedVirtualFolder = getChildFromFolder(folder1, childToCopyName2); - assertNotNull(copiedVirtualFolder); - String[] contents2 = {"Connections", "Filters", "profile.xmi"}; - int[] typesToCheck2 = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents((IRemoteFile)copiedVirtualFolder, contents2, typesToCheck2); - - Object copiedVirtualFile = getChildFromFolder(folder1, childToCopyName3); - assertNotNull(copiedVirtualFile); - assertTrue(((IRemoteFile)copiedVirtualFile).isDirectory() != true); - } - - public void testCopyBatchVirtualFileLevelTwo() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - - String sourceFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName); - assertNotNull(sourceZipFile); - - //then, create a folder inside the tempDir - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true); - assertNotNull(folder1); - - //Now, copy one of the level two folder from the zip file into folder1 - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "Team"); - - IRemoteFile[] sourceFiles = new IRemoteFile[1]; - sourceFiles[0] = secondLevelChild; - //copy this level two childer into folder1 - fss.copyBatch(sourceFiles, folder1, mon); - - Object copiedVirtualFolder = getChildFromFolder(folder1, secondLevelChild.getName()); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Connections", "Filters", "profile.xmi"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents((IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - } - - public void testCopyVirtualBatchToArchiveFile() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - - String zipTargetFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir, zipTargetFileName); - assertNotNull(targetZipFile); - - String sourcefileName = zipSourceFileName2; - IRemoteFile sourceFile = (IRemoteFile)getChildFromFolder(tempDir, sourcefileName); - assertNotNull(sourceFile); - - //Now, copy one of the folder from the sourceFile into copiedTargetZipFile - IRemoteFile[] sourceFiles = new IRemoteFile[1]; - String virutalFolderToCopyName = "6YLT5Xa"; - IRemoteFile virtualFolderToCopy = (IRemoteFile)getChildFromFolder(sourceFile, virutalFolderToCopyName); - sourceFiles[0] = virtualFolderToCopy; - fss.copyBatch(sourceFiles, targetZipFile, mon); - - Object theCopiedChild = getChildFromFolder(targetZipFile, virutalFolderToCopyName); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"20070315a", "20070319", "20070320a", "20070404a", "dummyFolder"}; - - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck); - } - - public void testCopyVirtualBatchToVirtualFileLevelOne() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - - String zipTargetFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir, zipTargetFileName); - assertNotNull(targetZipFile); - - String sourcefileName = zipSourceFileName2; - IRemoteFile sourceFile = (IRemoteFile)getChildFromFolder(tempDir, sourcefileName); - assertNotNull(sourceFile); - - //Now, copy one of the folder from the sourceFolder into a first level virtual file in targetZipFile - //Get one of its first level children, and copy the folder to there. - Object[] childrenOfTargetZipFile = fss.resolveFilterString(targetZipFile, null, mon); - - IRemoteFile[] sourceFiles = new IRemoteFile[3]; - - String parentOfVirutalFolderToCopyName = "6YLT5Xa"; - IRemoteFile parentOfVirtualFolderToCopy = (IRemoteFile)getChildFromFolder(sourceFile, parentOfVirutalFolderToCopyName); - String virtualChildToCopyName1 = "20070315a"; - String virtualChildToCopyName2 = "20070319"; - String virtualChildToCopyName3 = "dummyFolder"; - - sourceFiles[0] = (IRemoteFile)getChildFromFolder(parentOfVirtualFolderToCopy, virtualChildToCopyName1); - assertNotNull(sourceFiles[0]); - sourceFiles[1] = (IRemoteFile)getChildFromFolder(parentOfVirtualFolderToCopy, virtualChildToCopyName2); - assertNotNull(sourceFiles[1]); - sourceFiles[2] = (IRemoteFile)getChildFromFolder(parentOfVirtualFolderToCopy, virtualChildToCopyName3); - assertNotNull(sourceFiles[2]); - fss.copyBatch(sourceFiles, ((IRemoteFile)childrenOfTargetZipFile[0]), mon); - - - Object theCopiedChild = getChildFromFolder(((IRemoteFile)childrenOfTargetZipFile[0]), virtualChildToCopyName1); - assertNotNull(theCopiedChild); - //Also make sure the copied child has the right contents. - String[] childrenToCheck1 = {"QB5ROUTaadd"}; - int[] typesToCheck1 = {TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck1, typesToCheck1); - - theCopiedChild = getChildFromFolder(((IRemoteFile)childrenOfTargetZipFile[0]), virtualChildToCopyName2); - assertNotNull(theCopiedChild); - //Also make sure the copied child has the right contents. - String[] childrenToCheck2 = {"QB5ROUTERa"}; - int[] typesToCheck2 = {TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck2, typesToCheck2); - - theCopiedChild = getChildFromFolder(((IRemoteFile)childrenOfTargetZipFile[0]), virtualChildToCopyName3); - assertNotNull(theCopiedChild); - //Also make sure the copied child has the right contents. - String[] childrenToCheck3 = {"20070404a", "epdcdump01.hex12ab"}; - int[] typesToCheck3 = {TYPE_FOLDER, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck3, typesToCheck3); - } - - public void testCopyVirtualBatchToVirtualFileLevelTwo() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - - String zipTargetFileName = zipSourceFileName1; - IRemoteFile targetZipFile = (IRemoteFile)getChildFromFolder(tempDir, zipTargetFileName); - assertNotNull(targetZipFile); - - String sourcefileName = zipSourceFileName2; - IRemoteFile sourceFile = (IRemoteFile)getChildFromFolder(tempDir, sourcefileName); - assertNotNull(sourceFile); - - //Get one of its second level children, and copy the folder to there. - //Now, copy one of the level two folder from the zip file into folder1 - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(targetZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "TypeFilters"); - - IRemoteFile[] sourceFiles = new IRemoteFile[1]; - - String parentOfVirutalFolderToCopyName = "6YLT5Xa"; - IRemoteFile parentOfVirtualFolderToCopy = (IRemoteFile)getChildFromFolder(sourceFile, parentOfVirutalFolderToCopyName); - String virtualFolderToCopyName = "dummyFolder"; - IRemoteFile virtualFolderToCopy = (IRemoteFile)getChildFromFolder(parentOfVirtualFolderToCopy, virtualFolderToCopyName); - - sourceFiles[0] = virtualFolderToCopy; - - fss.copyBatch(sourceFiles, secondLevelChild, mon); - - Object theCopiedChild = getChildFromFolder(parentOfVirtualFolderToCopy, virtualFolderToCopyName); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"20070404a", "epdcdump01.hex12ab"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck); - } - - - - - public void testCopyToTarVirtualFileLevelOne() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //create the source for testing first - createSourceTarFiles(); - createSourceFolders(); - - String tarTargetFileName = tarSourceFileName1; - IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName); - assertNotNull(targetTarFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Now, copy one of the folder from the sourceFolder into a first level virtual file in targetZipFile - //Get one of its first level children, and copy the folder to there. - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(targetTarFile, "org"); - assertNotNull(firstLevelChild); - - fss.copy(sourceFolder, firstLevelChild, sourceFolder.getName(), mon); - - Object theCopiedChild = getChildFromFolder(firstLevelChild, sourceFolderName); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck); - } - - public void testCopyToTarVirtualFileLevelFour() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //create the source for testing first - createSourceTarFiles(); - createSourceFolders(); - - String tarTargetFileName = tarSourceFileName1; - IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName); - assertNotNull(targetTarFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Get one of its fourth level children, and copy the folder to there. - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(targetTarFile, "org"); - assertNotNull(firstLevelChild); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "eclipse"); - assertNotNull(secondLevelChild); - IRemoteFile thirdLevelChild = (IRemoteFile)getChildFromFolder(secondLevelChild, "dstore"); - assertNotNull(thirdLevelChild); - IRemoteFile fourLevelChild = (IRemoteFile)getChildFromFolder(thirdLevelChild, "core"); - assertNotNull(fourLevelChild); - - //Object[] children = fss.resolveFilterString(sourceZipFile, null, mon); - fss.copy(sourceFolder, fourLevelChild, sourceFolder.getName(), mon); - - Object theCopiedChild = getChildFromFolder(fourLevelChild, sourceFolderName); - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck); - } - - - public void testCopyTarVirtualFileLevelFour() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //create the source for testing first - createSourceTarFiles(); - - String sourceFileName = tarSourceFileName1; - IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName); - assertNotNull(sourceTarFile); - - //then, create a folder inside the tempDir - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true); - assertNotNull(folder1); - - //Now, copy one of the level four folder from the zip file into folder1 - //The folder is org/eclipse/dstore/core - //then, get directory "java" under org/eclipse/dstore/core - String parentForDirectoryToCopyName ="org"; - IRemoteFile parentForDirectoryToCopy = (IRemoteFile)getChildFromFolder(sourceTarFile, parentForDirectoryToCopyName); - assertNotNull(parentForDirectoryToCopy); - - parentForDirectoryToCopyName ="eclipse"; - parentForDirectoryToCopy = (IRemoteFile)getChildFromFolder(parentForDirectoryToCopy, parentForDirectoryToCopyName); - assertNotNull(parentForDirectoryToCopy); - - parentForDirectoryToCopyName ="dstore"; - parentForDirectoryToCopy = (IRemoteFile)getChildFromFolder(parentForDirectoryToCopy, parentForDirectoryToCopyName); - assertNotNull(parentForDirectoryToCopy); - - String directoryToCopyName ="core"; - IRemoteFile directoryToCopy = (IRemoteFile)getChildFromFolder(parentForDirectoryToCopy, directoryToCopyName); - assertNotNull(directoryToCopy); - - - //copy this level four children into folder1 - fss.copy(directoryToCopy, folder1, directoryToCopyName, mon); - - Object copiedVirtualFolder = getChildFromFolder(folder1, directoryToCopyName); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"client", "java", "miners", "model", "server", "util", "Activator.java"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents((IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - } - - - public void testMoveToTarVirtualFileLevelOne() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //create the source for testing first - createSourceTarFiles(); - createSourceFolders(); - - String tarTargetFileName = tarSourceFileName1; - IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName); - assertNotNull(targetTarFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Now, copy one of the folder from the sourceFolder into a first level virtual file in targetZipFile - //Get one of its first level children, and copy the folder to there. - Object[] childrenOfTargetZipFile = fss.resolveFilterString(targetTarFile, null, mon); - - //Object[] children = fss.resolveFilterString(sourceZipFile, null, mon); - fss.move(sourceFolder, ((IRemoteFile)childrenOfTargetZipFile[0]), sourceFolderName, mon); - - Object theMovedChild = getChildFromFolder(((IRemoteFile)childrenOfTargetZipFile[0]), sourceFolderName); - - assertNotNull(theMovedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theMovedChild, childrenToCheck, typesToCheck); - - //make sure the original folder is gone. - Object originalSource = getChildFromFolder(tempDir, sourceFolderName); - assertNull(originalSource); - } - - public void testMoveToVirtualFileLevelFour() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //create the source for testing first - createSourceTarFiles(); - createSourceFolders(); - - String tarTargetFileName = tarSourceFileName1; - IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName); - assertNotNull(targetTarFile); - - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Get one of its fourth level children, and copy the folder to there. - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(targetTarFile, "org"); - assertNotNull(firstLevelChild); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "eclipse"); - assertNotNull(secondLevelChild); - IRemoteFile thirdLevelChild = (IRemoteFile)getChildFromFolder(secondLevelChild, "dstore"); - assertNotNull(thirdLevelChild); - IRemoteFile fourLevelChild = (IRemoteFile)getChildFromFolder(thirdLevelChild, "core"); - assertNotNull(fourLevelChild); - - //Object[] children = fss.resolveFilterString(sourceZipFile, null, mon); - fss.move(sourceFolder, fourLevelChild, sourceFolder.getName(), mon); - - Object theCopiedChild = getChildFromFolder(fourLevelChild, sourceFolderName); - - assertNotNull(theCopiedChild); - - //Also make sure the moved child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck); - - //make sure the original folder is gone. - Object originalSource = getChildFromFolder(tempDir, sourceFolderName); - assertNull(originalSource); - } - - - public void testMoveTarVirtualFileLevelFour() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //create the source for testing first - createSourceTarFiles(); - - String sourceFileName = tarSourceFileName1; - IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName); - assertNotNull(sourceTarFile); - - //then, create a folder inside the tempDir - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true); - assertNotNull(folder1); - - //Get one of its fourth level children, and move it to the folder - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceTarFile, "org"); - assertNotNull(firstLevelChild); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "eclipse"); - assertNotNull(secondLevelChild); - IRemoteFile thirdLevelChild = (IRemoteFile)getChildFromFolder(secondLevelChild, "dstore"); - assertNotNull(thirdLevelChild); - IRemoteFile fourthLevelChild = (IRemoteFile)getChildFromFolder(thirdLevelChild, "core"); - assertNotNull(fourthLevelChild); - String movedFolderName = fourthLevelChild.getName(); - - //copy this level four children into folder1 - fss.move(fourthLevelChild, folder1, movedFolderName, mon); - - Object copiedVirtualFolder = getChildFromFolder(folder1, movedFolderName); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"client", "java", "miners", "model", "server", "util", "Activator.java"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents((IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, make sure the moved virtual folder is gone from its original zip file - //children = fss.resolveFilterString(sourceTarFile, null, mon); - Object result = getChildFromFolder(thirdLevelChild, movedFolderName); - assertNull(result); //we should not be able to find it. - } - - - - public void testCopyBatchToTarVirtualFileLevelFour() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceTarFiles(); - createSourceFolders(); - - String tarTargetFileName = tarSourceFileName1; - IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName); - assertNotNull(targetTarFile); - - //Now, copy the source folder. - String sourceFolderName = folderToCopyName3; - IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName); - assertNotNull(sourceFolder); - - //Get one of its fourth level children, and copy the folder to there. - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(targetTarFile, "org"); - assertNotNull(firstLevelChild); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "eclipse"); - assertNotNull(secondLevelChild); - IRemoteFile thirdLevelChild = (IRemoteFile)getChildFromFolder(secondLevelChild, "dstore"); - assertNotNull(thirdLevelChild); - IRemoteFile fourthLevelChild = (IRemoteFile)getChildFromFolder(thirdLevelChild, "core"); - assertNotNull(fourthLevelChild); - - IRemoteFile[] sourceFiles = new IRemoteFile[3]; - //Also add some of its children into the batch. - String childToCopyName1 = "aaaaaaaa"; - sourceFiles[0] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName1); - String childToCopyName2 = "aaaab"; - sourceFiles[1] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName2); - String childToCopyName3 = "epdcdump01.hex12a"; - sourceFiles[2] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName3); - fss.copyBatch(sourceFiles, fourthLevelChild, mon); - - - //Checking the first copied folder - Object theCopiedChild = getChildFromFolder(fourthLevelChild, childToCopyName1); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck1 = {"adsf", "eclipse-SDK-3.3M6-win32.zip", "epdcdump01.hex12", "epdcdump01.hex12aaaa"}; - - int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck1, typesToCheck1); - - //Checking the second copied folder - theCopiedChild = getChildFromFolder(fourthLevelChild, childToCopyName2); - - assertNotNull(theCopiedChild); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck2 = {"features"}; - - int[] typesToCheck2 = {TYPE_FOLDER}; - checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck2, typesToCheck2); - - //Checking the third copied file - theCopiedChild = getChildFromFolder(fourthLevelChild, childToCopyName3); - assertNotNull(theCopiedChild); - assertTrue(((IRemoteFile)theCopiedChild).isDirectory() != true); - } - - - - public void testCopyBatchTarVirtualFileLevelFive() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceTarFiles(); - - String sourceFileName = tarSourceFileName1; - IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName); - assertNotNull(sourceTarFile); - - //then, create a folder inside the tempDir - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true); - assertNotNull(folder1); - - //Get several of its fifth level children, and them into the folder. - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceTarFile, "org"); - assertNotNull(firstLevelChild); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "eclipse"); - assertNotNull(secondLevelChild); - IRemoteFile thirdLevelChild = (IRemoteFile)getChildFromFolder(secondLevelChild, "dstore"); - assertNotNull(thirdLevelChild); - IRemoteFile fourthLevelChild = (IRemoteFile)getChildFromFolder(thirdLevelChild, "core"); - assertNotNull(fourthLevelChild); - - IRemoteFile[] fifLevelChildrenToCopy = new IRemoteFile[3]; - - String firstToCopyName = "client"; - fifLevelChildrenToCopy[0] = (IRemoteFile)getChildFromFolder(fourthLevelChild, firstToCopyName); - assertNotNull(fifLevelChildrenToCopy[0]); - String secondToCopyName = "miners"; - fifLevelChildrenToCopy[1] = (IRemoteFile)getChildFromFolder(fourthLevelChild, secondToCopyName); - assertNotNull(fifLevelChildrenToCopy[1]); - String thirdToCopyName = "Activator.java"; - fifLevelChildrenToCopy[2] = (IRemoteFile)getChildFromFolder(fourthLevelChild, thirdToCopyName); - assertNotNull(fifLevelChildrenToCopy[2]); - - - fss.copyBatch(fifLevelChildrenToCopy, folder1, mon); - - Object copiedVirtualFolder1 = getChildFromFolder(folder1, firstToCopyName); - assertNotNull(copiedVirtualFolder1); - String[] contents1 = {"ClientConnection.java", "ConnectionStatus.java"}; - int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)copiedVirtualFolder1, contents1, typesToCheck1); - - Object copiedVirtualFolder2 = getChildFromFolder(folder1, secondToCopyName); - assertNotNull(copiedVirtualFolder2); - String[] contents2 = {"Miner.java", "MinerThread.java"}; - int[] typesToCheck2 = {TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)copiedVirtualFolder2, contents2, typesToCheck2); - - Object copiedVirtualFolder3 = getChildFromFolder(folder1, thirdToCopyName); - assertNotNull(copiedVirtualFolder3); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveTestDStore.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveTestDStore.java deleted file mode 100644 index f6afe8ae7..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveTestDStore.java +++ /dev/null @@ -1,1006 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xuan Chen (IBM) - initial API and implementation - * Martin Oberhuber (Wind River) - Fix Javadoc warnings - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - * Martin Oberhuber (Wind River) - [195402] Add constructor with test name - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.files; - -import junit.framework.TestSuite; - -import org.eclipse.core.filesystem.EFS; -import org.eclipse.core.filesystem.IFileStore; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.ISystemResourceSet; -import org.eclipse.rse.core.model.SystemRemoteResourceSet; -import org.eclipse.rse.core.model.SystemStartHere; -import org.eclipse.rse.core.model.SystemWorkspaceResourceSet; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter; -import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility; -import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.ui.ISystemPreferencesConstants; -import org.eclipse.rse.ui.RSEUIPlugin; - -public class FileServiceArchiveTestDStore extends FileServiceArchiveTest { - - private boolean fPreference_ALERT_SSL; - private boolean fPreference_ALERT_NONSSL; - - /** - * Constructor with specific test name. - * @param name test to execute - */ - public FileServiceArchiveTestDStore(String name) { - super(name); - setTargetName("linux"); - } - - public static junit.framework.Test suite() { - TestSuite suite = new TestSuite("FileServiceArchiveTestDStore"); - - //zip file testing - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyBatchToArchiveFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyBatchToVirtualFileLevelOne")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyBatchToVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyBatchVirtualFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyBatchVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyToArchiveFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyToVirtualFileLevelOne")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyToVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualBatchToArchiveFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualBatchToVirtualFileLevelOne")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualBatchToVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCreateZipFile")); //$NON-NLS-1$ - //suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testDeleteVirtualFileBigZip")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testMoveToArchiveFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testMoveToVirtualFileLevelOne")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testMoveToVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testMoveVirtualFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testMoveVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testRenameVirtualFile")); //$NON-NLS-1$ - //suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testRenameVirtualFileBigZip")); //$NON-NLS-1$ - - //tar file testing - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCreateTarFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyTarVirtualFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyTarVirtualFileLevelFour")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyToTarArchiveFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyToTarVirtualFileLevelOne")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyToTarVirtualFileLevelFour")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testDeleteTarVirtualFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testMoveTarVirtualFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testMoveTarVirtualFileLevelFour")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testMoveToTarArchiveFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testMoveToTarVirtualFileLevelOne")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testMoveToVirtualFileLevelFour")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testRenameTarVirtualFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyBatchTarVirtualFileLevelFive")); - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyBatchToTarArchiveFile")); - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyBatchToTarVirtualFileLevelFour")); - - //super transfer - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferLocalToRemote")); - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferDStoreWindowsAndDStore")); - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferDStoreToLocal")); - //open a virtual file in tar archive - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testOpenFileFromTarArchive")); //$NON-NLS-1$ - - //copy the virtual folder across connections - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualFileFromDStoreToLocal")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualFileLevelTwoFromDStoreToLocal")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualFileFromLocalToDStore")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualFileLevelTwoFromLocalToDStore")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFLevelTwoToArchiveFromDStoreToLocal")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFLevelTwoToArchiveFromLocalToDStore")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToArchiveFromDStoreToLocal")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToArchiveFromLocalToDStore")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToVFFromDStoreToLocal")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToVFLevelTwoFromDStoreToLocal")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToVFFromLocalToDStore")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToVFLevelTwoFromLocalToDStore")); //$NON-NLS-1$ - - return suite; - } - - - - protected void setupFileSubSystem() { - - IHost dstoreHost = getLinuxHost(); - assertNotNull(dstoreHost); - ISystemRegistry sr = SystemStartHere.getSystemRegistry(); - ISubSystem[] ss = sr.getServiceSubSystems(dstoreHost, IFileService.class); - for (int i=0; i<ss.length; i++) { - if (ss[i] instanceof IFileServiceSubSystem) { - fss = (IFileServiceSubSystem)ss[i]; - fs = fss.getFileService(); - } - } - - IHost localHost = getLocalSystemConnection(); - sr = SystemStartHere.getSystemRegistry(); - ss = sr.getServiceSubSystems(localHost, IFileService.class); - for (int i=0; i<ss.length; i++) { - if (ss[i] instanceof IFileServiceSubSystem) { - localFss = (IFileServiceSubSystem)ss[i]; - } - } - - try - { - IConnectorService connectionService = fss.getConnectorService(); - - //If you want to connect to a running server, uncomment the following statements - /* - IServerLauncherProperties properties = connectionService.getRemoteServerLauncherProperties(); - - if (properties instanceof IRemoteServerLauncher) - { - IRemoteServerLauncher sl = (IRemoteServerLauncher)properties; - sl.setServerLaunchType(ServerLaunchType.get(ServerLaunchType.RUNNING)); - fss.getSubSystemConfiguration().updateSubSystem(fss, false, "tester", true, 4033); - } - */ - //end here - - connectionService.acquireCredentials(false); - connectionService.connect(mon); - - } catch(Exception e) { - assertTrue("Exception creating temp dir " + e.getStackTrace().toString(), false); //$NON-NLS-1$ - } - } - - public void tearDown() throws Exception { - IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore(); - store.setValue(ISystemPreferencesConstants.ALERT_SSL, fPreference_ALERT_SSL); - store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, fPreference_ALERT_NONSSL); - super.tearDown(); - } - - public void testSuperTransferLocalToRemote() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString(); - IFileStore temp = createDir(tempPath, true); - - createSuperTransferFolder(temp); - - //Set the superTransfer preference on - IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore(); - boolean preference_DOSUPERTRANSFER = store.getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER); - store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, true); - - - //now, copy folderToCopy into the folder in the remote system - IRemoteFile sourceFolderToCopy1 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName3, mon); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy1).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet3.addResource(sourceFolderToCopy1); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, tempDir, mon, true); - - //Then, we need to retrieve children of the tempDir to cache their information. - Object[] children = fss.resolveFilterString(tempDir, null, mon); - //Make sure there is no temp archive file left - assertTrue(children.length == 1); - - Object theCopiedFolder = getChildFromFolder(tempDir, folderToCopyName3); - assertNotNull(theCopiedFolder); - - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents((IRemoteFile)theCopiedFolder, childrenToCheck, typesToCheck); - - //Then, set the preference back to its original value - store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, preference_DOSUPERTRANSFER); - - //Then, delete the temp folder in the junit workspace. - temp.delete(EFS.NONE, mon); - } - - public void testSuperTransferDStoreWindowsAndDStore() throws Exception { - //-test-author-:XuanChen - getWindowsHost(); - if (isTestDisabled()) - return; - String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString(); - IFileStore temp = createDir(tempPath, true); - - createSuperTransferFolder(temp); - - //Set the superTransfer preference on - IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore(); - boolean preference_DOSUPERTRANSFER = store.getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER); - store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, true); - - //now, copy folderToCopy into the folder in the remote system - IRemoteFile sourceFolderToCopy1 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName3, mon); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy1).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet1 = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet1.addResource(sourceFolderToCopy1); - ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet1, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true); - - //Then, we need to retrieve children of the tempDir to cache their information. - fss.resolveFilterString(tempDir, null, mon); - - IHost dstoreHost = getWindowsHost(); - assertNotNull(dstoreHost); - ISystemRegistry sr = SystemStartHere.getSystemRegistry(); - ISubSystem[] ss = sr.getServiceSubSystems(dstoreHost, IFileService.class); - IFileServiceSubSystem dstoreWindowsFss = null; - for (int i=0; i<ss.length; i++) { - if (ss[i] instanceof IFileServiceSubSystem) { - dstoreWindowsFss = (IFileServiceSubSystem)ss[i]; - } - } - assertNotNull(dstoreWindowsFss); - IConnectorService dstoreWindowsConnectionService = dstoreWindowsFss.getConnectorService(); - dstoreWindowsConnectionService.acquireCredentials(false); - dstoreWindowsConnectionService.connect(mon); - - //Then, create a temparory directory the My Home of the DStore Windows - //Create a temparory directory in My Home - IRemoteFile dstoreWindowsTempDir = null; - //String dstoreWindowsTempDirPath = null; - try - { - IRemoteFile homeDirectory = dstoreWindowsFss.getRemoteFileObject(".", mon); - String baseFolderName = "rsetest"; - String homeFolderName = homeDirectory.getAbsolutePath(); - String testFolderName = FileServiceHelper.getRandomLocation(dstoreWindowsFss, homeFolderName, baseFolderName, mon); - dstoreWindowsTempDir = createFileOrFolder(dstoreWindowsFss, homeFolderName, testFolderName, true); - } - catch (Exception e) - { - fail("Problem encountered: " + e.getStackTrace().toString()); - } - - //now, copy that folder in the Dstore connection into the folder in DStore Windows connection - IRemoteFile sourceFolderToCopy2 = (IRemoteFile)getChildFromFolder(tempDir, folderToCopyName3); - ISystemDragDropAdapter srcAdapter2 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy2).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet2 = new SystemRemoteResourceSet(fss, srcAdapter2); - fromSet2.addResource(sourceFolderToCopy2); - ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects2, dstoreWindowsTempDir, mon, true); - - Object[] children = dstoreWindowsFss.resolveFilterString(dstoreWindowsTempDir, null, mon); - //Make sure there is no temp archive file left - assertTrue(children.length == 1); - - //then verify the result of copy - Object theCopiedFolder = getChildFromFolder(dstoreWindowsFss, dstoreWindowsTempDir, folderToCopyName3); - assertNotNull(theCopiedFolder); - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents(dstoreWindowsFss, (IRemoteFile)theCopiedFolder, childrenToCheck, typesToCheck); - - //Then, set the preference back to its original value - store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, preference_DOSUPERTRANSFER); - - //delete the windows dstore temp file just created - try { - dstoreWindowsFss.delete(dstoreWindowsTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - //Then, delete the temp folder in the junit workspace. - temp.delete(EFS.NONE, mon); - } - - public void testSuperTransferDStoreToLocal() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString(); - IFileStore temp = createDir(tempPath, true); - - createSuperTransferFolder(temp); - - //Set the superTransfer preference on - IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore(); - boolean preference_DOSUPERTRANSFER = store.getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER); - store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, true); - - //now, copy folderToCopy into the folder in the remote system - IRemoteFile sourceFolderToCopy1 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName3, mon); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy1).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet1 = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet1.addResource(sourceFolderToCopy1); - ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet1, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true); - - //Then, we need to retrieve children of the tempDir to cache their information. - fss.resolveFilterString(tempDir, null, mon); - - - //Then, create a temparory directory the My Home of the Local connection - //Create a temparory directory in My Home - IRemoteFile localTempDir = null; - try - { - IRemoteFile homeDirectory = localFss.getRemoteFileObject(".", mon); - String baseFolderName = "rsetest"; - String homeFolderName = homeDirectory.getAbsolutePath(); - String testFolderName = FileServiceHelper.getRandomLocation(localFss, homeFolderName, baseFolderName, mon); - localTempDir = createFileOrFolder(localFss, homeFolderName, testFolderName, true); - } - catch (Exception e) - { - fail("Problem encountered: " + e.getStackTrace().toString()); - } - - //now, copy that folder in the Dstore connection into the folder in local connection - IRemoteFile sourceFolderToCopy2 = (IRemoteFile)getChildFromFolder(tempDir, folderToCopyName3); - ISystemDragDropAdapter srcAdapter2 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy2).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet2 = new SystemRemoteResourceSet(fss, srcAdapter2); - fromSet2.addResource(sourceFolderToCopy2); - ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects2, localTempDir, mon, true); - - Object[] localChildren = localFss.resolveFilterString(localTempDir, null, mon); - //Make sure there is no temp archive file left - assertTrue(localChildren.length == 1); - - //then verify the result of copy - Object theCopiedFolderLocal = getChildFromFolder(localFss, localTempDir, folderToCopyName3); - assertNotNull(theCopiedFolderLocal); - //Also make sure the copied child has the right contents. - String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"}; - - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents(localFss, (IRemoteFile)theCopiedFolderLocal, childrenToCheck, typesToCheck); - - //Then, set the preference back to its original value - store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, preference_DOSUPERTRANSFER); - - //delete the windows dstore temp file just created - try { - localFss.delete(localTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - //Then, delete the temp folder in the junit workspace. - temp.delete(EFS.NONE, mon); - } - - public void testCopyVirtualFileFromDStoreToLocal() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //Create the tempDir inside the Local connection first. - IRemoteFile localTempDir = null; - try - { - IRemoteFile homeDirectory = localFss.getRemoteFileObject(".", mon); - String baseFolderName = "rsetest"; - String homeFolderName = homeDirectory.getAbsolutePath(); - String testFolderName = FileServiceHelper.getRandomLocation(localFss, homeFolderName, baseFolderName, mon); - localTempDir = createFileOrFolder(localFss, homeFolderName, testFolderName, true); - } - catch (Exception e) - { - fail("Problem encountered: " + e.getStackTrace().toString()); - } - //then, create a folder inside the tempDir inside the Local connection - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(localFss, localTempDir.getAbsolutePath(), folderName, true); - assertNotNull(folder1); - - - //Now, copy one of the folder from the zip file into folder1 - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1); - fromSet3.addResource(firstLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, folder1, mon, true); - - //make sure some delay before checking the result - Thread.sleep(50); - Object copiedVirtualFolder = getChildFromFolder(localFss, folder1, folderToCopyName1); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(localTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - - - - public void testCopyVirtualFileLevelTwoFromDStoreToLocal() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - createSourceZipFiles(); - - //copy the zip file first. - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //Create the tempDir inside the Local connection first. - IRemoteFile localTempDir = null; - try - { - IRemoteFile homeDirectory = localFss.getRemoteFileObject(".", mon); - String baseFolderName = "rsetest"; - String homeFolderName = homeDirectory.getAbsolutePath(); - String testFolderName = FileServiceHelper.getRandomLocation(localFss, homeFolderName, baseFolderName, mon); - localTempDir = createFileOrFolder(localFss, homeFolderName, testFolderName, true); - } - catch (Exception e) - { - fail("Problem encountered: " + e.getStackTrace().toString()); - } - //then, create a folder inside the tempDir inside the Local connection - String folderName = "folder1"; - String secondLeveChildName = "Team"; - IRemoteFile folder1 = createFileOrFolder(localFss, localTempDir.getAbsolutePath(), folderName, true); - assertNotNull(folder1); - - //Now, copy one of the level two folder from the zip file into folder1 - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "Team"); - - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1); - fromSet3.addResource(secondLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, folder1, mon, true); - - Thread.sleep(50); - - Object copiedVirtualFolder = getChildFromFolder(localFss, folder1, secondLeveChildName); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Connections", "Filters", "profile.xmi"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(localTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - - public void testCopyVirtualFileFromLocalToDStore() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - IRemoteFile sourceZipLocation = createSourceZipFiles(localFss); - - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, sourceZipLocation, sourceZipFileName); - assertNotNull(sourceZipFile); - - //then, create a folder inside the tempDir inside the DStore connection - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(fss, tempDir.getAbsolutePath(), folderName, true); - assertNotNull(folder1); - - - //Now, copy one of the folder from the zip file in Local connection into folder1 - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet3.addResource(firstLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, folder1, mon, true); - - Object copiedVirtualFolder = getChildFromFolder(fss, folder1, folderToCopyName1); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(sourceZipLocation, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - - public void testCopyVirtualFileLevelTwoFromLocalToDStore() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - IRemoteFile sourceZipLocation = createSourceZipFiles(localFss); - - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, sourceZipLocation, sourceZipFileName); - assertNotNull(sourceZipFile); - - //then, create a folder inside the tempDir inside the DStore connection - String folderName = "folder1"; - IRemoteFile folder1 = createFileOrFolder(fss, tempDir.getAbsolutePath(), folderName, true); - assertNotNull(folder1); - - - //Now, copy one of the folder from the zip file in Local connection into folder1 - //Now, copy one of the level two folder from the zip file into folder1 - String secondLeveChildName = "Team"; - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(localFss, firstLevelChild, secondLeveChildName); - - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet3.addResource(secondLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, folder1, mon, true); - - Object copiedVirtualFolder = getChildFromFolder(fss, folder1, secondLeveChildName); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Connections", "Filters", "profile.xmi"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(sourceZipLocation, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - - } - - public void testCopyVFToArchiveFromDStoreToLocal() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip files in dstore connection. - createSourceZipFiles(); - - //Create the zip files in local connection - IRemoteFile localTempDir = createSourceZipFiles(localFss); - - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //The destination is the first level virtual child of a zip file - //in local temp dir - IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, zipSourceFileName2); - //IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(localFss, destinationArchiveFile, folderToCopyName2); - - //Now, copy one of the folder from the zip file in dstore into destinationVirtualFolder - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1); - fromSet3.addResource(firstLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, destinationArchiveFile, mon, true); - - Thread.sleep(50); - Object copiedVirtualFolder = getChildFromFolder(localFss, destinationArchiveFile, folderToCopyName1); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(localTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - - public void testCopyVFLevelTwoToArchiveFromDStoreToLocal() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip files in dstore connection. - createSourceZipFiles(); - - //Create the zip files in local connection - IRemoteFile localTempDir = createSourceZipFiles(localFss); - - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //The destination is the second level virtual child of a zip file - //in local temp dir - IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, zipSourceFileName2); - //IRemoteFile firstChild = (IRemoteFile)getChildFromFolder(localFss, destinationArchiveFile, folderToCopyName2); - //IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(localFss, firstChild, "20070319"); - - //the source is a second level child of a zip file in dstore connection temp dir - String secondLeveChildName = "Team"; - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(fss, sourceZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(fss, firstLevelChild, secondLeveChildName); - - - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1); - fromSet3.addResource(secondLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, destinationArchiveFile, mon, true); - - Thread.sleep(50); - - Object copiedVirtualFolder = getChildFromFolder(localFss, destinationArchiveFile, secondLeveChildName); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Connections", "Filters", "profile.xmi"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(localTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - - public void testCopyVFToArchiveFromLocalToDStore() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip files in dstore connection. - createSourceZipFiles(); - - //Create the zip files in local connection - IRemoteFile localTempDir = createSourceZipFiles(localFss); - - String sourceZipFileName = zipSourceFileName1; - //Source zip file is from Local connection - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //The destination is the first level virtual child of a zip file - //in dstore temp dir - IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(fss, tempDir, zipSourceFileName2); - //IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(fss, destinationArchiveFile, folderToCopyName2); - - //Now, copy one of the folder from the zip file in local into destinationVirtualFolder - //First, drag the virtual folder from the local zip file - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet3.addResource(firstLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - //The drop to the destination virtual folder in dstore connection. - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, destinationArchiveFile, mon, true); - - //The result is in the dstore connection - Thread.sleep(50); - Object copiedVirtualFolder = getChildFromFolder(fss, destinationArchiveFile, folderToCopyName1); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(localTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - - public void testCopyVFLevelTwoToArchiveFromLocalToDStore() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip files in dstore connection. - createSourceZipFiles(); - - //Create the zip files in local connection - IRemoteFile localTempDir = createSourceZipFiles(localFss); - - String sourceZipFileName = zipSourceFileName1; - //Source zip file is in local connection - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //The destination is the second level virtual child of a zip file - //in dstore temp dir - IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(fss, tempDir, zipSourceFileName2); - //IRemoteFile firstChild = (IRemoteFile)getChildFromFolder(fss, destinationArchiveFile, folderToCopyName2); - //IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(fss, firstChild, "20070319"); - - //the source is a second level child of a zip file in local connection temp dir - String secondLeveChildName = "Team"; - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(localFss, firstLevelChild, secondLeveChildName); - - //Now, copy one of the folder from the zip file in local into destinationVirtualFolder - //First, drag the virtual folder from the local zip file - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet3.addResource(secondLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, destinationArchiveFile, mon, true); - - //The result is in the dstore connection - Thread.sleep(50); - Object copiedVirtualFolder = getChildFromFolder(fss, destinationArchiveFile, secondLeveChildName); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Connections", "Filters", "profile.xmi"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(localTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - - public void testCopyVFToVFFromDStoreToLocal() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip files in dstore connection. - createSourceZipFiles(); - - //Create the zip files in local connection - IRemoteFile localTempDir = createSourceZipFiles(localFss); - - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //The destination is the first level virtual child of a zip file - //in local temp dir - IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, zipSourceFileName2); - IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(localFss, destinationArchiveFile, folderToCopyName2); - - //Now, copy one of the folder from the zip file in dstore into destinationVirtualFolder - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1); - fromSet3.addResource(firstLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, destinationVirtualFolder, mon, true); - - Thread.sleep(50); - Object copiedVirtualFolder = getChildFromFolder(localFss, destinationVirtualFolder, folderToCopyName1); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(localTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - - public void testCopyVFToVFLevelTwoFromDStoreToLocal() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip files in dstore connection. - createSourceZipFiles(); - - //Create the zip files in local connection - IRemoteFile localTempDir = createSourceZipFiles(localFss); - - String sourceZipFileName = zipSourceFileName1; - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //The destination is the second level virtual child of a zip file - //in local temp dir - IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, zipSourceFileName2); - IRemoteFile firstChild = (IRemoteFile)getChildFromFolder(localFss, destinationArchiveFile, folderToCopyName2); - IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(localFss, firstChild, "20070319"); - - //the source is a second level child of a zip file in dstore connection temp dir - String secondLeveChildName = "Team"; - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(fss, sourceZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(fss, firstLevelChild, secondLeveChildName); - - - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1); - fromSet3.addResource(secondLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, destinationVirtualFolder, mon, true); - - Thread.sleep(50); - Object copiedVirtualFolder = getChildFromFolder(localFss, destinationVirtualFolder, secondLeveChildName); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Connections", "Filters", "profile.xmi"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(localTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - - public void testCopyVFToVFFromLocalToDStore() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip files in dstore connection. - createSourceZipFiles(); - - //Create the zip files in local connection - IRemoteFile localTempDir = createSourceZipFiles(localFss); - - String sourceZipFileName = zipSourceFileName1; - //Source zip file is from Local connection - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //The destination is the first level virtual child of a zip file - //in dstore temp dir - IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(fss, tempDir, zipSourceFileName2); - IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(fss, destinationArchiveFile, folderToCopyName2); - - //Now, copy one of the folder from the zip file in local into destinationVirtualFolder - //First, drag the virtual folder from the local zip file - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1); - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet3.addResource(firstLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - //The drop to the destination virtual folder in dstore connection. - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, destinationVirtualFolder, mon, true); - - //The result is in the dstore connection - Thread.sleep(50); - Object copiedVirtualFolder = getChildFromFolder(fss, destinationVirtualFolder, folderToCopyName1); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE}; - checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(localTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - - public void testCopyVFToVFLevelTwoFromLocalToDStore() throws Exception { - //-test-author-:XuanChen - if (isTestDisabled()) - return; - - //Create the zip files in dstore connection. - createSourceZipFiles(); - - //Create the zip files in local connection - IRemoteFile localTempDir = createSourceZipFiles(localFss); - - String sourceZipFileName = zipSourceFileName1; - //Source zip file is in local connection - IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, sourceZipFileName); - assertNotNull(sourceZipFile); - - //The destination is the second level virtual child of a zip file - //in dstore temp dir - IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(fss, tempDir, zipSourceFileName2); - IRemoteFile firstChild = (IRemoteFile)getChildFromFolder(fss, destinationArchiveFile, folderToCopyName2); - IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(fss, firstChild, "20070319"); - - //the source is a second level child of a zip file in local connection temp dir - String secondLeveChildName = "Team"; - IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1); - IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(localFss, firstLevelChild, secondLeveChildName); - - //Now, copy one of the folder from the zip file in local into destinationVirtualFolder - //First, drag the virtual folder from the local zip file - ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class); - SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1); - fromSet3.addResource(secondLevelChild); - ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon); - UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, destinationVirtualFolder, mon, true); - - //The result is in the dstore connection - Thread.sleep(50); - Object copiedVirtualFolder = getChildFromFolder(fss, destinationVirtualFolder, secondLeveChildName); - - assertNotNull(copiedVirtualFolder); - - String[] contents = {"Connections", "Filters", "profile.xmi"}; - int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE}; - checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck); - - //Now, need to delete the temp dir in the Local connection - try { - localFss.delete(localTempDir, mon); - } catch(SystemMessageException msg) { - //ensure that super.tearDown() can run - System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveTestDStoreWindows.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveTestDStoreWindows.java deleted file mode 100644 index ded8f07d1..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceArchiveTestDStoreWindows.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xuan Chen (IBM) - initial API and implementation - * Martin Oberhuber (Wind River) - Fix Javadoc warnings - * Martin Oberhuber (Wind River) - [195402] Add constructor with test name - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.files; - -import junit.framework.TestSuite; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.SystemStartHere; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; -import org.eclipse.rse.ui.ISystemPreferencesConstants; -import org.eclipse.rse.ui.RSEUIPlugin; - -public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest { - - private boolean fPreference_ALERT_SSL; - private boolean fPreference_ALERT_NONSSL; - - /** - * Constructor with specific test name. - * @param name test to execute - */ - public FileServiceArchiveTestDStoreWindows(String name) { - super(name); - setTargetName("windows"); - } - - public static junit.framework.Test suite() { - - TestSuite suite = new TestSuite("FileServiceArchiveTestDStoreWindows"); - - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyBatchToArchiveFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyBatchToVirtualFileLevelOne")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyBatchToVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyBatchVirtualFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyBatchVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyToArchiveFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyToVirtualFileLevelOne")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyToVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyVirtualBatchToArchiveFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyVirtualBatchToVirtualFileLevelOne")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyVirtualBatchToVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyVirtualFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCreateZipFile")); //$NON-NLS-1$ - //suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testDeleteVirtualFileBigZip")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testMoveToArchiveFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testMoveToVirtualFileLevelOne")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testMoveToVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testMoveVirtualFile")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testMoveVirtualFileLevelTwo")); //$NON-NLS-1$ - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testRenameVirtualFile")); //$NON-NLS-1$ - //suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testRenameVirtualFileBigZip")); //$NON-NLS-1$ - - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testSuperTransferLocalToRemote")); - suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferDStoreToLocal")); - return suite; - } - - protected void setupFileSubSystem() { - - IHost dstoreHost = getWindowsHost(); - assertTrue(dstoreHost != null); - ISystemRegistry sr = SystemStartHere.getSystemRegistry(); - ISubSystem[] ss = sr.getServiceSubSystems(dstoreHost, IFileService.class); - for (int i=0; i<ss.length; i++) { - if (ss[i] instanceof IFileServiceSubSystem) { - fss = (IFileServiceSubSystem)ss[i]; - fs = fss.getFileService(); - } - } - - IHost localHost = getLocalSystemConnection(); - sr = SystemStartHere.getSystemRegistry(); - ss = sr.getServiceSubSystems(localHost, IFileService.class); - for (int i=0; i<ss.length; i++) { - if (ss[i] instanceof IFileServiceSubSystem) { - localFss = (IFileServiceSubSystem)ss[i]; - } - } - - try - { - IConnectorService connectionService = fss.getConnectorService(); - - //If you want to connect to a running server, uncomment the following statements - /* - IServerLauncherProperties properties = connectionService.getRemoteServerLauncherProperties(); - - if (properties instanceof IRemoteServerLauncher) - { - IRemoteServerLauncher sl = (IRemoteServerLauncher)properties; - sl.setServerLaunchType(ServerLaunchType.get(ServerLaunchType.RUNNING)); - fss.getSubSystemConfiguration().updateSubSystem(fss, false, "xuanchen", true, 4033); - } - */ - //End here. - - connectionService.acquireCredentials(false); - connectionService.connect(mon); - - } catch(Exception e) { - assertTrue("Exception creating temp dir " + e.getStackTrace().toString(), false); //$NON-NLS-1$ - } - } - - public void tearDown() throws Exception { - IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore(); - store.setValue(ISystemPreferencesConstants.ALERT_SSL, fPreference_ALERT_SSL); - store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, fPreference_ALERT_NONSSL); - super.tearDown(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceBaseTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceBaseTest.java deleted file mode 100644 index 42c1f59e8..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceBaseTest.java +++ /dev/null @@ -1,419 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xuan Chen (IBM) - initial API and implementation - * - <copied code from org.eclipse.core.tests.internal.localstore/LocalStoreTest (Copyright IBM)> - * - <copied code from org.eclipse.core.tests.harness/CoreTest (Copyright IBM)> - * - <copied code from org.eclipse.core.tests.resources/ResourceTest (Copyright IBM)> - * - <copied code from org.eclipse.core.tests.harness/CoreTest (Copyright IBM)> - * Martin Oberhuber (Wind River) - [195402] Add constructor with test name - * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.files; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.HashMap; - -import org.eclipse.core.filesystem.EFS; -import org.eclipse.core.filesystem.IFileInfo; -import org.eclipse.core.filesystem.IFileStore; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IVirtualRemoteFile; -import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; - -/** - * Base class for file subsystem / file service unit tests. - * Contains helper methods for test environment setup. - */ -public class FileServiceBaseTest extends RSEBaseConnectionTestCase { - - protected IFileServiceSubSystem fss; - protected IFileServiceSubSystem localFss; - protected IFileService fs; - protected IRemoteFile tempDir; - protected String tempDirPath; - protected IProgressMonitor mon = new NullProgressMonitor(); - - public static int TYPE_FILE = 0; - public static int TYPE_FOLDER = 1; - - /** - * Constructor with specific test name. - * @param name test to execute - */ - public FileServiceBaseTest(String name) { - super(name); - setTargetName("local"); - } - - public void setUp() throws Exception { - super.setUp(); - setupFileSubSystem(); - if (isTestDisabled()) - return; - //Create a temparory directory in My Home - try - { - IRemoteFile homeDirectory = fss.getRemoteFileObject(".", mon); - String baseFolderName = "rsetest"; - String homeFolderName = homeDirectory.getAbsolutePath(); - String testFolderName = FileServiceHelper.getRandomLocation(fss, homeFolderName, baseFolderName, mon); - tempDir = createFileOrFolder(homeFolderName, testFolderName, true); - tempDirPath = tempDir.getAbsolutePath(); - } - catch (Exception e) - { - fail("Problem encountered: " + e.getStackTrace().toString()); - } - } - - public void tearDown() throws Exception { - if (fss != null) { - try { - fss.delete(tempDir, mon); - } catch (SystemMessageException msg) { - // ensure that super.tearDown() can run - System.err.println("Exception on tearDown: " + msg.getLocalizedMessage()); //$NON-NLS-1$ - } - } - super.tearDown(); - } - - public boolean isWindows() { - return fss.getHost().getSystemType().isWindows(); - } - - public String getTestFileName() { - //Return a filename for testing that exposes all characters valid on the file system - if (!isWindows()) { - //UNIX TODO: test embedded newlines - return "a !@#${a}\"\' fi\tle\b\\%^&*()?_ =[]~+-'`;:,.|<>"; //$NON-NLS-1$ - } - //Fallback: Windows TODO: test unicode - return "a !@#${a}'` file%^&()_ =[]~+-;,."; //$NON-NLS-1$ - } - - - public IRemoteFile copySourceFileOrFolder(String sourceFullName, String sourceName, String targetFolderFullName) throws Exception - { - IRemoteFile result = null; - IRemoteFile originalTargetArchiveFile = fss.getRemoteFileObject(sourceFullName, mon); - IRemoteFile targetFolder = fss.getRemoteFileObject(targetFolderFullName, mon); - fss.copy(originalTargetArchiveFile, targetFolder, sourceName, mon); - result = fss.getRemoteFileObject(getNewAbsoluteName(targetFolder, sourceName), mon); - //Need to call resolveFilterString of the parent to make sure the newly copied child - //is added to the DStore map. Otherwise, next time when query it, it will just created a - //default filter string. And the dstore server cannot handler it correctly. - fss.resolveFilterString(targetFolder, null, mon); - return result; - } - - public IRemoteFile createFileOrFolder(String targetFolderName, String fileOrFolderName, boolean isFolder) throws Exception - { - return createFileOrFolder(fss, targetFolderName, fileOrFolderName, isFolder); - } - - public IRemoteFile createFileOrFolder(IFileServiceSubSystem inputFss, String targetFolderName, String fileOrFolderName, boolean isFolder) throws Exception - { - IRemoteFile result = null; - //System.out.println("createFileOrFolder: targetFolderName is " + targetFolderName); - IRemoteFile targetFolder = inputFss.getRemoteFileObject(targetFolderName, mon); - String fileOrFolderAbsName = getNewAbsoluteName(targetFolder, fileOrFolderName); - IRemoteFile newFileOrFolderPath = inputFss.getRemoteFileObject(fileOrFolderAbsName, mon); - if (isFolder) - { - result = inputFss.createFolder(newFileOrFolderPath, mon); - } - else - { - result = inputFss.createFile(newFileOrFolderPath, mon); - } - //Need to call resolveFilterString of the parent to make sure the newly created child - //is added to the DStore map. Otherwise, next time when query it, it will just created a - //default filter string. And the dstore server cannot handler it correctly. - inputFss.resolveFilterString(targetFolder, null, mon); - return result; - } - - public Object getChildFromFolder(IRemoteFile folderToCheck, String childName) throws Exception - { - return getChildFromFolder(fss, folderToCheck, childName); - } - - public Object getChildFromFolder(IFileServiceSubSystem inputFss, IRemoteFile folderToCheck, String childName) throws Exception - { - //then check the result of copy - Object[] children = null; - Object foundChild = null; - children = inputFss.resolveFilterString(folderToCheck, null, mon); - for (int i=0; i<children.length; i++) - { - String thisName = ((IRemoteFile)children[i]).getName(); - if (thisName.equals(childName)) - { - foundChild = children[i]; - break; - } - } - return foundChild; - } - - public void checkFolderContents(IRemoteFile folderToCheck, String[] names, int[] types) throws Exception - { - checkFolderContents(fss, folderToCheck, names, types); - } - - public void checkFolderContents(IFileServiceSubSystem inputFss, IRemoteFile folderToCheck, String[] names, int[] types) throws Exception - { - //the folder returned by the create API did not get the right attributes. - //We need to call getRemoteFileObject to get its attribute updated. - //Otherwise, will get error "directory not readable" - folderToCheck = inputFss.getRemoteFileObject(folderToCheck.getAbsolutePath(), mon); - System.out.println("verifying the contents for folder: " + folderToCheck.getAbsolutePath()); - Object[] children = inputFss.resolveFilterString(folderToCheck, null, mon); - //Make sure the children array includes the copied folder. - HashMap childrenMap = new HashMap(); - //Add children name into the map - for (int i=0; i<children.length; i++) - { - String thisName = ((IRemoteFile)children[i]).getName(); - childrenMap.put(thisName, children[i]); - } - //Check contents are in the array list - for (int i=0; i<names.length; i++) - { - IRemoteFile found = (IRemoteFile)(childrenMap.get(names[i])); - assertTrue("Could not find " + names[i], found != null); - assertTrue(found.exists()); - if (types != null && types.length != 0) - { - //If input array of types, we also need to check if the type is correct. - if (types[i] == TYPE_FILE) - { - assertTrue(found.isFile()); - } - else if (types[i] == TYPE_FOLDER) - { - assertTrue(found.isDirectory()); - } - } - } - } - - protected static String getNewAbsoluteName(IRemoteFile parentFolder, String newName) - { - String newAbsName = null; - char sep = parentFolder.getSeparatorChar(); - String parentFolderPath = parentFolder.getAbsolutePath(); - - // hack by Mike to allow virtual files and folders. - if (parentFolder instanceof IVirtualRemoteFile) - { - sep = '/'; - } - else if (parentFolder.isArchive()) - { - sep = '/'; - parentFolderPath = parentFolderPath + ArchiveHandlerManager.VIRTUAL_SEPARATOR; - } - - if ((parentFolderPath.length()==1) && (parentFolderPath.charAt(0)=='/') && - (parentFolderPath.charAt(0)==sep)) - newAbsName = sep + newName; - else - newAbsName = parentFolderPath + sep + newName; - return newAbsName; - } - - //---------------------------------------------------------------------- - // <copied code from org.eclipse.core.tests.internal.localstore/LocalStoreTest (Copyright IBM)> - //---------------------------------------------------------------------- - protected IFileStore createDir(IFileStore store, boolean clear) throws CoreException { - if (clear && store.fetchInfo().exists()) - store.delete(EFS.NONE, new NullProgressMonitor()); - store.mkdir(EFS.NONE, new NullProgressMonitor()); - IFileInfo info = store.fetchInfo(); - assertTrue("createDir.1", info.exists()); - assertTrue("createDir.1", info.isDirectory()); - return store; - } - - //---------------------------------------------------------------------- - // <copied code from org.eclipse.core.tests.internal.localstore/LocalStoreTest (Copyright IBM)> - //---------------------------------------------------------------------- - protected IFileStore createDir(String string, boolean clear) throws CoreException { - return createDir(EFS.getFileSystem(EFS.SCHEME_FILE).getStore(new Path(string)), clear); - } - - /** - * Create a file with random content. If a resource exists in the same path, - * the resource is deleted. - * <copied code from org.eclipse.core.tests.internal.localstore/LocalStoreTest (Copyright IBM)> - * - * @param target the file to create - * @param content content of the new file - * @throws CoreException in case of failure - */ - protected void createFile(IFileStore target, String content) throws CoreException { - target.delete(EFS.NONE, null); - InputStream input = new ByteArrayInputStream(content.getBytes()); - transferData(input, target.openOutputStream(EFS.NONE, null)); - IFileInfo info = target.fetchInfo(); - assertTrue(info.exists() && !info.isDirectory()); - } - - /** - * <copied code from org.eclipse.core.tests.harness/CoreTest (Copyright IBM)> - * Asserts that a stream closes successfully. Null streams - * are ignored, but failure to close the stream is reported as - * an assertion failure. - * @param stream the input stream to close - */ - protected void assertClose(InputStream stream) { - if (stream == null) - return; - try { - stream.close(); - } catch (IOException e) { - fail("Failed close in assertClose"); - } - } - - /** - * <copied code from org.eclipse.core.tests.harness/CoreTest (Copyright IBM)> - * Return an input stream with some the specified text to use - * as contents for a file resource. - * @param text the input text - * @return the input stream of the input text - */ - public InputStream getContents(String text) { - return new ByteArrayInputStream(text.getBytes()); - } - - /** - * <copied code from org.eclipse.core.tests.resources/ResourceTest.java (Copyright IBM) > - * - * Returns a boolean value indicating whether or not the contents - * of the given streams are considered to be equal. Closes both input streams. - * @param a input stream a - * @param b input stream b - * @return if both stream are consider to be equal - */ - public boolean compareContent(InputStream a, InputStream b) { - int c, d; - if (a == null && b == null) - return true; - try { - if (a == null || b == null) - return false; - while ((c = a.read()) == (d = b.read()) && (c != -1 && d != -1)) { - //body not needed - } - return (c == -1 && d == -1); - } catch (IOException e) { - return false; - } finally { - assertClose(a); - assertClose(b); - } - } - - /** - * Copy the data from the input stream to the output stream. - * Close both streams when finished. - * <copied code from org.eclipse.core.tests.harness/CoreTest (Copyright IBM)> - * - * @param input input stream - * @param output output stream - */ - protected void transferData(InputStream input, OutputStream output) { - try { - try { - int c = 0; - while ((c = input.read()) != -1) - output.write(c); - } finally { - input.close(); - output.close(); - } - } catch (IOException e) { - e.printStackTrace(); - assertTrue(e.toString(), false); - } - } - - /** - * Return String with some random text to use - * as contents for a file resource. - * <copied code from org.eclipse.core.tests.harness/CoreTest (Copyright IBM)> - * - * @return the result random string - */ - protected String getRandomString() { - switch ((int) Math.round(Math.random() * 10)) { - case 0 : - return "este e' o meu conteudo (portuguese)"; - case 1 : - return "ho ho ho"; - case 2 : - return "I'll be back"; - case 3 : - return "don't worry, be happy"; - case 4 : - return "there is no imagination for more sentences"; - case 5 : - return "customize yours"; - case 6 : - return "foo"; - case 7 : - return "bar"; - case 8 : - return "foobar"; - case 9 : - return "case 9"; - default : - return "these are my contents"; - } - } - - /** - * Setup the file subsystem used for this testcase - */ - protected void setupFileSubSystem() - { - IHost localHost = getLocalSystemConnection(); - if (isTestDisabled()) - return; - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - ISubSystem[] ss = sr.getServiceSubSystems(localHost, IFileService.class); - for (int i=0; i<ss.length; i++) { - if (ss[i] instanceof IFileServiceSubSystem) { - fss = (IFileServiceSubSystem)ss[i]; - fs = fss.getFileService(); - } - } - localFss = fss; //Used for creating test source data. - assertNotNull(localFss); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceHelper.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceHelper.java deleted file mode 100644 index c630e6ffb..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceHelper.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xuan Chen (IBM) - copied and adapted from org.eclipse.core.tests.harness/FileSystemHelper - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.files; - -import java.io.IOException; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; - -/** - * Home for file system-related utility methods. - */ -public class FileServiceHelper { - /** counter for generating unique random file system locations */ - protected static int nextLocationCounter = 0; - private static final long MASK = 0x00000000FFFFFFFFL; - - /* - * Return the root directory for the temp dir. - */ - public static IPath getTempDir() { - String tempPath = System.getProperty("java.io.tmpdir"); - try { - tempPath = new java.io.File(tempPath).getCanonicalPath(); - } catch (IOException e) { - //ignore and use non-canonical path - } - return new Path(tempPath); - } - - /** - * Returns a unique location on the remote file system. It is guaranteed that no file currently - * exists at that location. The returned location will be unique with respect - * to all other locations generated by this method in the current session. - * If the caller creates a folder or file at this location, they are responsible for - * deleting it when finished. - * @param fss The FileServiceSubSystem where we want to get this location - * @param parentPath The path of the parent folder - * @param baseName the name where the calculated extension will be appended to - * @param mon Progress Monitor needed for necessary remote query - * @return the generated name of this location - */ - public static String getRandomLocation(IFileServiceSubSystem fss, String parentPath, String baseName, IProgressMonitor mon) { - String resultName = computeRandomLocation(fss, baseName); - try - { - IRemoteFile remoteFile = fss.getRemoteFileObject(parentPath + fss.getSeparator() + resultName, mon); - boolean fileExist = (remoteFile != null) && remoteFile.exists(); - while (fileExist) - { - try - { - Thread.sleep(10); - } catch (InterruptedException e) { - // ignore - } - resultName = computeRandomLocation(fss, baseName); - remoteFile = fss.getRemoteFileObject(parentPath + fss.getSeparator() + resultName, mon); - fileExist = (remoteFile != null) && remoteFile.exists(); - } - } - catch (Exception e) - { - return null; - } - return resultName; - - } - - public static String computeRandomLocation(IFileServiceSubSystem fss, String path) { - long segment = (((long) ++nextLocationCounter) << 32) | (System.currentTimeMillis() & MASK); - return path +(Long.toString(segment)); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceTest.java deleted file mode 100644 index de0a6f956..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceTest.java +++ /dev/null @@ -1,433 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Martin Oberhuber (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core - * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API - * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - * Martin Oberhuber (Wind River) - [235360][ftp][ssh] Return proper "Root" IHostFile - * Patrick Tassé (Ericsson) - [285226] Empty directory shown as an error message - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.files; - -import java.io.File; -import java.lang.reflect.Method; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.services.IService; -import org.eclipse.rse.services.clientserver.PathUtility; -import org.eclipse.rse.services.clientserver.messages.SystemElementNotFoundException; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.services.files.RemoteFileException; -import org.eclipse.rse.services.shells.IHostOutput; -import org.eclipse.rse.services.shells.IHostShell; -import org.eclipse.rse.services.shells.IShellService; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; -import org.eclipse.rse.tests.subsystems.shells.ShellOutputListener; - -public class FileServiceTest extends RSEBaseConnectionTestCase { - - private String fPropertiesFileName; - // For testing the test: verify methods on Local - public static String fDefaultPropertiesFile = "localConnection.properties"; - - private IFileServiceSubSystem fss; - private IFileService fs; - private IRemoteFile fHomeDirectory; - private IRemoteFile remoteTempDir; - private String tempDirPath; - private IProgressMonitor mon = new NullProgressMonitor(); - - /** - * Constructor with specific test name. - * - * @param name test to execute - */ - public FileServiceTest(String name) { - this(name, fDefaultPropertiesFile); - } - - /** - * Constructor with connection type and specific test name. - * - * @param name test to execute - * @param propertiesFileName file with connection properties to use - */ - public FileServiceTest(String name, String propertiesFileName) { - super(name); - fPropertiesFileName = propertiesFileName; - if (propertiesFileName != null) { - int idx = propertiesFileName.indexOf("Connection.properties"); - String targetName = propertiesFileName.substring(0, idx); - setTargetName(targetName); - } - } - - public static Test suite() { - String baseName = FileServiceTest.class.getName(); - TestSuite suite = new TestSuite(baseName); - - // // Add a test suite for each connection type - String[] connTypes = { "local", "ssh", "ftpWindows", "ftpSsh", "linux", "windows", "unix" }; - //String[] connTypes = { "unix" }; - //String[] connTypes = { "local" }; - // String[] connTypes = { "ssh" }; - - for (int i = 0; i < connTypes.length; i++) { - String suiteName = connTypes[i] == null ? "EFS" : connTypes[i]; - String propFileName = connTypes[i] == null ? null : connTypes[i] + "Connection.properties"; - TestSuite subSuite = new TestSuite(baseName + "." + suiteName); - Method[] m = FileServiceTest.class.getMethods(); - for (int j = 0; j < m.length; j++) { - String testName = m[j].getName(); - if (testName.startsWith("test")) { - subSuite.addTest(new FileServiceTest(testName, propFileName)); - } - } - suite.addTest(subSuite); - } - return suite; - } - - - public void setUp() throws Exception { - super.setUp(); - IHost host = getHost(fPropertiesFileName); - fss = (IFileServiceSubSystem) RemoteFileUtility.getFileSubSystem(host); - fs = fss.getFileService(); - fss.checkIsConnected(getDefaultProgressMonitor()); - fHomeDirectory = fss.getRemoteFileObject(".", getDefaultProgressMonitor()); - remoteTempDir = fss.getRemoteFileObject(fHomeDirectory, "rsetest" + System.currentTimeMillis(), getDefaultProgressMonitor()); - fss.createFolder(remoteTempDir, getDefaultProgressMonitor()); - tempDirPath = remoteTempDir.getAbsolutePath(); - } - - public void tearDown() throws Exception { - fss.delete(remoteTempDir, getDefaultProgressMonitor()); - super.tearDown(); - } - - public boolean isWindows() { - return fss.getHost().getSystemType().isWindows(); - } - - public String getTestFileName() { - //Return a filename for testing that exposes all characters valid on the file system - if (!isWindows()) { - //UNIX TODO: test embedded newlines - String testName = "a !@#${a}\"\' fi\tle\b\\%^&*()?_ =[]~+-'`;:,.|<>"; //$NON-NLS-1$ - // Bug 235492: DStore is designed to treat '\' and '/' the same way, so do not - // test this. - if (fss.getSubSystemConfiguration().getServiceImplType().getName().equals("org.eclipse.rse.services.dstore.IDStoreService")) { //$NON-NLS-1$ - testName.replace('\\', ' '); - } - } - //Fallback: Windows TODO: test unicode - //Note: The trailing dot ('.') is really unfair on Windows because the file - //system doesn't seem to ever store trailing dots - //return "a !@#${a}'` file%^&()_ =[]~+-;,."; //$NON-NLS-1$ - return "a !@#${a}'` file%^&()_ =[]~+-;.,"; //$NON-NLS-1$ - } - - /** - * Find the first IShellServiceSubSystem service associated with the host. - * - * @return shell service subsystem, or <code>null</code> if not found. - */ - public IShellService getRelatedShellService() { - IHost host = fss.getHost(); - ISubSystem[] subSystems = host.getSubSystems(); - IShellService ssvc = null; - for (int i = 0; subSystems != null && i < subSystems.length; i++) { - IService svc = subSystems[i].getSubSystemConfiguration().getService(host); - if (svc != null) { - ssvc = (IShellService) svc.getAdapter(IShellService.class); - if (ssvc != null) { - try { - subSystems[i].checkIsConnected(getDefaultProgressMonitor()); - return ssvc; - } catch (SystemMessageException e) { - e.printStackTrace(); - } - } - } - } - return null; - } - - public void testGetRootProperties() throws Exception { - //-test-author-:MartinOberhuber - if (isTestDisabled()) return; - IHostFile[] roots = fs.getRoots(new NullProgressMonitor()); - assertNotNull(roots); - assertTrue(roots.length > 0); - for (int i = 0; i < roots.length; i++) { - assertTrue(roots[i].isRoot()); - assertTrue(roots[i].exists()); - assertNull(roots[i].getParentPath()); - String rootName = roots[i].getName(); - assertNotNull(rootName); - System.out.println(rootName); - IHostFile newHf = fs.getFile(null, rootName, new NullProgressMonitor()); - assertTrue(newHf.isRoot()); - assertTrue(newHf.exists()); - assertEquals(newHf.getName(), rootName); - newHf = fs.getFile("", rootName, new NullProgressMonitor()); - assertTrue(newHf.isRoot()); - assertTrue(newHf.exists()); - assertEquals(newHf.getName(), rootName); - } - } - - public void testCaseSensitive() { - //-test-author-:MartinOberhuber - if (isTestDisabled()) return; - - if (isWindows()) { - assertFalse(fs.isCaseSensitive()); - assertFalse(fss.isCaseSensitive()); - assertFalse(fss.getSubSystemConfiguration().isCaseSensitive()); - } else { - assertTrue(fs.isCaseSensitive()); - assertTrue(fss.isCaseSensitive()); - assertTrue(fss.getSubSystemConfiguration().isCaseSensitive()); - } - } - - public void testCreateFile() throws SystemMessageException { - //-test-author-:MartinOberhuber - if (isTestDisabled()) return; - - String testName = getTestFileName(); - IHostFile hf = fs.createFile(tempDirPath, testName, mon); - assertTrue(hf.exists()); - assertTrue(hf.canRead()); - assertTrue(hf.canWrite()); - assertEquals(hf.getName(), testName); - assertEquals(hf.getParentPath(), tempDirPath); - assertEquals(hf.getSize(), 0); - long modDate = hf.getModifiedDate(); - assertTrue(modDate > 0); - if (fss.getHost().getSystemType().isLocal()) { - File theFile = new File(remoteTempDir.getAbsolutePath(), testName); - assertTrue(theFile.exists()); - assertTrue(modDate == theFile.lastModified()); - } - } - - public void testCreateCaseSensitive() throws SystemMessageException { - //-test-author-:MartinOberhuber - if (isTestDisabled()) return; - - String testName = getTestFileName(); - String testName2 = testName.toUpperCase(); - IHostFile hf = fs.createFile(tempDirPath, testName, mon); - if (fss.isCaseSensitive()) { - //UNIX: uppercase version must be distinct - IHostFile hf2 = fs.getFile(tempDirPath, testName2, mon); - assertFalse(hf2.exists()); - hf2 = fs.createFolder(tempDirPath, testName2, mon); - assertTrue(hf2.exists()); - assertTrue(hf2.isDirectory()); - assertFalse(hf.equals(hf2)); - } else { - //Windows: uppercase version must be the same - IHostFile hf2 = fs.getFile(tempDirPath, testName2, mon); - assertTrue(hf2.exists()); - try { - hf2 = fs.createFolder(tempDirPath, testName2, mon); - } catch(SystemMessageException e) { - //Windows cannot create a folder when the file is already there - assertNotNull(e); - } - assertTrue(hf2.exists()); - assertFalse(hf2.isDirectory()); - assertEquals(hf.getModifiedDate(), hf2.getModifiedDate()); - assertEquals(hf.getSize(), hf2.getSize()); - //Different abstract path names but denote the same file - //Should be equal since java.io.File treats them as equal - assertEquals(new File(tempDirPath, testName), new File(tempDirPath, testName2)); - ////While the file handles were created with different names, - ////resolving them should return the same name (the one that's on disk) - ////But Local and java.io.File do not work that way - //assertEquals(hf.getName(), hf2.getName()); - assertEquals(hf, hf2); //bug 168591, bug 235489: no equals() for IHostFile - } - } - - public String[] runRemoteCommand(IShellService shellService, String workingDirectory, String cmd) throws SystemMessageException, InterruptedException { - IHostShell hostShell = null; - hostShell = shellService.runCommand(workingDirectory, cmd, null, mon); - ShellOutputListener outputListener = new ShellOutputListener(); - hostShell.addOutputListener(outputListener); - hostShell.writeToShell("exit"); - assertNotNull(hostShell); - assertNotNull(hostShell.getStandardOutputReader()); - while (hostShell.isActive()) { - Thread.sleep(1000); - } - Object[] allOutput = outputListener.getAllOutput(); - if (allOutput!=null) { - String[] sOutput = new String[allOutput.length]; - for (int i = 0; i < allOutput.length; i++) { - if (allOutput[i] instanceof IHostOutput) { - sOutput[i] = ((IHostOutput) allOutput[i]).getString(); - } else { - sOutput[i] = allOutput[i].toString(); - } - } - return sOutput; - } - return null; - } - - /** - * Create a symbolic link in the context of tempDirPath. - * - * @param source source file to link from - * @param target target file to link to - * @return <code>true</code> if link was successfully created. - */ - public boolean mkSymLink(String source, String target) { - if (!fss.getHost().getSystemType().isWindows()) { - IShellService ss = getRelatedShellService(); - if (ss != null) { - String[] allOutput; - try { - String src = PathUtility.enQuoteUnix(source); - String tgt = PathUtility.enQuoteUnix(target); - String cmd = "ln -s " + src + " " + tgt; - allOutput = runRemoteCommand(ss, tempDirPath, cmd); - IHostFile hf = fs.getFile(tempDirPath, target, mon); - if (hf.exists()) { - return true; - } - allOutput = new String[] { "Failed to symlink: " + cmd }; - } catch (Exception e) { - allOutput = new String[] { "Exception thrown: " + e }; - } - System.out.println("WARNING: Could not create symlink"); - if (allOutput != null) { - for (int i = 0; i < allOutput.length; i++) { - System.out.println(allOutput[i]); - } - } - } - } - return false; - } - - public void testListEmptyFolder() throws SystemMessageException { - // -test-author-:PatrickTassé - if (isTestDisabled()) return; - - String testName = "empty"; - IHostFile hf = fs.createFolder(tempDirPath, testName, mon); - assertTrue(hf.exists()); - assertTrue(hf.isDirectory()); - assertTrue(hf.canRead()); - assertTrue(hf.canWrite()); - assertEquals(testName, hf.getName()); - assertEquals(tempDirPath, hf.getParentPath()); - long modDate = hf.getModifiedDate(); - assertTrue(modDate > 0); - if (fss.getHost().getSystemType().isLocal()) { - File theFile = new File(remoteTempDir.getAbsolutePath(), testName); - assertTrue(theFile.exists()); - assertTrue(modDate == theFile.lastModified()); - } - IHostFile[] hfa = fs.list(hf.getAbsolutePath(), "*", IFileService.FILE_TYPE_FILES_AND_FOLDERS, mon); - assertEquals(0, hfa.length); - // check for symlink-to-empty-folder case - if (mkSymLink(testName, "lto" + testName)) { - IHostFile hf2 = fs.getFile(tempDirPath, "lto" + testName, mon); - assertTrue(hf2.isDirectory()); - hfa = fs.list(hf2.getAbsolutePath(), "*", IFileService.FILE_TYPE_FILES_AND_FOLDERS, mon); - assertEquals(0, hfa.length); - } - } - - public void testListNonExistentFolder() throws SystemMessageException, InterruptedException { - // -test-author-:PatrickTassé - if (isTestDisabled()) return; - - String testPath = tempDirPath + "/non/existent"; - try { - IHostFile[] hfa = fs.list(testPath, "*", IFileService.FILE_TYPE_FILES_AND_FOLDERS, mon); - // Bug 285942: LocalFileService and DStoreFileService return empty array today - // Assert something impossible since an exception is expected - assertEquals("Exception expected on list nonexistent", -1, hfa.length); - } catch (SystemMessageException e) { - assertTrue(e instanceof SystemElementNotFoundException); - } - // check for symlink-to-non-existent case - if (mkSymLink("non/existent", "ltononex")) { - IHostFile hf2 = fs.getFile(tempDirPath, "ltononex", mon); - try { - IHostFile[] hfa = fs.list(hf2.getAbsolutePath(), "*", IFileService.FILE_TYPE_FILES_AND_FOLDERS, mon); - assertEquals("Exception expected on list broken symlink", -1, hfa.length); - } catch (SystemMessageException e) { - assertTrue(e instanceof SystemElementNotFoundException); - } - } - } - - public void testListNotAFolder() throws SystemMessageException { - // -test-author-:PatrickTassé - if (isTestDisabled()) return; - - String testName = getTestFileName(); - IHostFile hf = fs.createFile(tempDirPath, testName, mon); - assertTrue(hf.exists()); - assertTrue(hf.canRead()); - assertTrue(hf.canWrite()); - assertEquals(hf.getName(), testName); - assertEquals(hf.getParentPath(), tempDirPath); - assertEquals(hf.getSize(), 0); - long modDate = hf.getModifiedDate(); - assertTrue(modDate > 0); - if (fss.getHost().getSystemType().isLocal()) { - File theFile = new File(remoteTempDir.getAbsolutePath(), testName); - assertTrue(theFile.exists()); - assertTrue(modDate == theFile.lastModified()); - } - try { - IHostFile[] hfa = fs.list(hf.getAbsolutePath(), "*", IFileService.FILE_TYPE_FILES_AND_FOLDERS, mon); - // Bug 285942: LocalFileService and DStoreFileService return empty array today - // Assert something impossible since an exception is expected - assertEquals("Exception expected on list not-a-folder", -1, hfa.length); - } catch (SystemMessageException e) { - assertTrue(e instanceof RemoteFileException); - } - // check for symlink-to-not-a-folder case - if (mkSymLink(testName, "lto" + testName)) { - try { - IHostFile hf2 = fs.getFile(tempDirPath, "lto" + testName, mon); - assertTrue(hf2.isFile()); - IHostFile[] hfa = fs.list(hf2.getAbsolutePath(), "*", IFileService.FILE_TYPE_FILES_AND_FOLDERS, mon); - // Assert something impossible since an exception is expected - assertEquals("Exception expected on list symlink-to-folder", -1, hfa.length); - } catch (SystemMessageException e) { - assertTrue(e instanceof RemoteFileException); - } - } - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceTgzArchiveTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceTgzArchiveTest.java deleted file mode 100644 index bb9497246..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceTgzArchiveTest.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Johnson Ma (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.files; - -/** - * this class is used to test tgz and .tar.gz archive function - */ -public class FileServiceTgzArchiveTest extends FileServiceArchiveBaseTest { - - public FileServiceTgzArchiveTest(String name) { - super(name); - //-test-author-:JohnsonMa:9 - tarSourceFileName1 = "source.tar.gz"; - tarSourceFileName2 = "mynewtar.tgz"; - tarSourceForOpenTest = "tarSourceForOpen.TAR.gz"; - testName = "dummy.tGz"; - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileSubsystemConsistencyTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileSubsystemConsistencyTestCase.java deleted file mode 100644 index 1592c43ad..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileSubsystemConsistencyTestCase.java +++ /dev/null @@ -1,501 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David McKnight (IBM) - [207095] test case to compare same op between subsystems - * David McKnight (IBM) - [162195] new APIs for upload multi and download multi - * David McKnight (IBM) - [209552] API changes to use multiple and getting rid of deprecated - * David McKnight (IBM) - [210109] store constants in IFileService rather than IFileServiceConstants - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - * Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases - * Martin Oberhuber (Wind River) - [240704] Protect against illegal API use of getRemoteFileObject() with relative path as name - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.files; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.SystemStartHere; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; - -/** - * Test cases for comparing various file subsystem operations - */ -public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase { - - private List _subSystems; - private List _connections; - private List _samplePaths; - - private String LOCALTEMPDIR = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - if (_subSystems != null) { - for (int i = 0; i < _subSystems.size(); i++) { - IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i); - if (ss != null && ss.isConnected()) { - ss.disconnect(true); - } - - } - _subSystems.clear(); - } - - if (_connections != null) - { - for (int j = 0; j < _connections.size(); j++) { - IHost host = (IHost)_connections.get(j); - if (host != null) { - getConnectionManager().removeConnection(host.getSystemProfileName(), host.getName()); - } - } - _connections.clear(); - } - - _subSystems = null; - _connections = null; - - super.tearDown(); - } - - - - protected void setupConnections() { - if (_connections == null) - { - _connections = new ArrayList(); - _subSystems = new ArrayList(); - - //TODO Support Windows style connections - //String[] connTypes = { "local", "ssh", "ftpWindows", "ftp", "linux", "windows" }; - String[] connTypes = { "ssh", "ftp", "linux" }; - for (int i = 0; i < connTypes.length; i++) { - setTargetName(connTypes[i]); - if (!isTestDisabled()) { - addSystem(getHost(connTypes[i] + "Connection.properties")); - } - } - setTargetName(null); - - _samplePaths = new ArrayList(); - _samplePaths.add("/usr"); - _samplePaths.add("/usr/lib"); - _samplePaths.add("/usr/bin"); - _samplePaths.add("/bin"); - _samplePaths.add("/etc"); - _samplePaths.add("/home"); - _samplePaths.add("/sbin"); - - } - } - - private void addSystem(IHost host) { - IRemoteFileSubSystem fss = null; - ISystemRegistry sr = SystemStartHere.getSystemRegistry(); - ISubSystem[] ss = sr.getServiceSubSystems(host, IFileService.class); - for (int i=0; i<ss.length; i++) { - if (ss[i] instanceof IRemoteFileSubSystem) { - fss = (IRemoteFileSubSystem)ss[i]; - } - } - _subSystems.add(fss); - _connections.add(host); - } - - /** - * Test the implicit connect of each connection when calling getRemoteFileObject(). - */ - public void testImplicitConnectViaFileSubSystem() { - //-test-author-:DaveMcKnight - if (isTestDisabled()) - return; - setupConnections(); - - String testPath = "/usr/lib"; - - for (int i = 0; i < _subSystems.size(); i++) { - IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i); - - // ensure that the system is NOT connected - if (ss.isConnected()) { - try { - ss.disconnect(true); - } - catch (Exception e) { - // disconnect failed - } - } - - - - String systemType = ss.getConfigurationId(); - - Exception exception = null; - String cause = null; - IRemoteFile remoteFile = null; - - try { - remoteFile = ss.getRemoteFileObject(testPath, new NullProgressMonitor()); - } - catch (Exception e){ - exception = e; - cause = e.getLocalizedMessage(); - } - - assertNull(systemType + ":Exception getting remote file! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertTrue(ss.isConnected()); - assertNotNull(systemType + ":Unexpected return value for getRemoteFile(). Remote file is null!", remoteFile); - } - } - public void testSingleFileQuery() { - //-test-author-:DaveMcKnight - if (isTestDisabled()) - return; - setupConnections(); - - - String[] testPaths = (String[])_samplePaths.toArray(new String[_samplePaths.size()]); - - for (int i = 0; i < _subSystems.size(); i++) { - IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i); - - // ensure that the system is connected - if (!ss.isConnected()) { - try { - ss.connect(new NullProgressMonitor(), false); - } - catch (Exception e) { - // connect failed - } - } - - String systemType = ss.getConfigurationId(); - - Exception exception = null; - String cause = null; - IRemoteFile[] remoteFiles = new IRemoteFile[testPaths.length]; - - long t1 = System.currentTimeMillis(); - for (int f = 0; f < testPaths.length; f++) - { - try - { - remoteFiles[f] = ss.getRemoteFileObject(testPaths[f], new NullProgressMonitor()); - } - catch (Exception e){ - exception = e; - cause = e.getLocalizedMessage(); - } - } - - long t2 = System.currentTimeMillis(); - - System.out.println(systemType + ": get files time = "+ (t2 - t1) + " milliseconds"); - - // query folders - IRemoteFile[] results = null; - List consolidatedResults = new ArrayList(); - long t3 = System.currentTimeMillis(); - for (int q = 0; q < remoteFiles.length; q++) - { - try - { - IRemoteFile[] children = ss.list(remoteFiles[q], IFileService.FILE_TYPE_FILES_AND_FOLDERS, new NullProgressMonitor()); - for (int c = 0; c < children.length; c++) - { - consolidatedResults.add(children[c]); - } - } - catch (Exception e){ - exception = e; - cause = e.getLocalizedMessage(); - } - } - results = (IRemoteFile[])consolidatedResults.toArray(new IRemoteFile[consolidatedResults.size()]); - long t4 = System.currentTimeMillis(); - - System.out.println(systemType + ": query time = "+ (t4 - t3) + " milliseconds"); - - assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertTrue(ss.isConnected()); - - System.out.println(systemType + ": results size="+results.length); - /* - for (int r = 0; r < remoteFiles.length; r++) - { - IRemoteFile rfile = remoteFiles[r]; - boolean exists = rfile.exists(); - if (!exists){ - System.out.println(rfile.getAbsolutePath() + " doesn't exist!"); - } - assertTrue(exists); - } - */ - - } - } - - /** - * Test the multi file query - */ - public void testMultiFileQuery() { - //-test-author-:DaveMcKnight - if (isTestDisabled()) - return; - setupConnections(); - - - - String[] testPaths = (String[])_samplePaths.toArray(new String[_samplePaths.size()]); - - for (int i = 0; i < _subSystems.size(); i++) { - IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i); - - // ensure that the system is connected - if (!ss.isConnected()) { - try { - ss.connect(new NullProgressMonitor(), false); - } - catch (Exception e) { - // connect failed - } - } - - String systemType = ss.getConfigurationId(); - - Exception exception = null; - String cause = null; - IRemoteFile[] remoteFiles = null; - - // get folders to query - long t1 = System.currentTimeMillis(); - try - { - remoteFiles = ss.getRemoteFileObjects(testPaths, new NullProgressMonitor()); - } - catch (Exception e){ - exception = e; - e.printStackTrace(); - cause = e.getLocalizedMessage(); - } - - long t2 = System.currentTimeMillis(); - - System.out.println(systemType + ": get files time = "+ (t2 - t1) + " milliseconds"); - - // query folders - IRemoteFile[] results = null; - long t3 = System.currentTimeMillis(); - try - { - results = ss.listMultiple(remoteFiles, IFileService.FILE_TYPE_FILES_AND_FOLDERS, new NullProgressMonitor()); - } - catch (Exception e){ - exception = e; - e.printStackTrace(); - cause = e.getLocalizedMessage(); - } - long t4 = System.currentTimeMillis(); - - System.out.println(systemType + ": query time = "+ (t4 - t3) + " milliseconds"); - - assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertTrue(ss.isConnected()); - - System.out.println(systemType + ":results size="+results.length); - } - } - - /** - * Test the single file download - */ - public void testSingleFileDownload() { - //-test-author-:DaveMcKnight - if (isTestDisabled()) - return; - setupConnections(); - internalFileDownload(false); - } - - /** - * Test the multi file download - */ - public void testMultiFileDownload() { - //-test-author-:DaveMcKnight - if (isTestDisabled()) - return; - setupConnections(); - internalFileDownload(true); - } - - protected void internalFileDownload(boolean multi) - { - String remoteParentDir = "/usr/include"; - File tempDir = new File(LOCALTEMPDIR); - if (!tempDir.exists()) - { - tempDir.mkdirs(); - } - - for (int i = 0; i < _subSystems.size(); i++) { - IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i); - - // ensure that the system is connected - if (!ss.isConnected()) { - try { - ss.connect(new NullProgressMonitor(), false); - } - catch (Exception e) { - // connect failed - } - } - - String systemType = ss.getConfigurationId(); - - File subTempDir = new File(tempDir, systemType + (multi ? "_multi" : "_single")); - if (subTempDir.exists()) - { - // delete old contents - try - { - String[] children = subTempDir.list(); - for (int c = 0; c < children.length; c++) - { - new File(children[c]).delete(); - } - } - catch (Exception e) - { - /*ignore*/ - } - } - else - { - subTempDir.mkdirs(); - } - - Exception exception = null; - String cause = null; - //IRemoteFile[] remoteFiles = null; - - try - { - IProgressMonitor monitor = new NullProgressMonitor(); - IRemoteFile includeDir = ss.getRemoteFileObject(remoteParentDir, monitor); - - // get all the files - IRemoteFile[] files = ss.list(includeDir, IFileService.FILE_TYPE_FILES, monitor); - - System.out.println(systemType + ": downloading "+files.length+ " files"); - - - // determine local locations for each - String[] destinations = new String[files.length]; - String[] encodings = new String[files.length]; - long[] fileSizes = new long[files.length]; - - - - for (int d = 0; d < files.length; d++) - { - IRemoteFile file = files[d]; - destinations[d] = subTempDir.getAbsolutePath() + File.separatorChar + file.getName(); - encodings[d] = file.getEncoding(); - fileSizes[d] = file.getLength(); - } - - long t1 = System.currentTimeMillis(); - if (multi) // multi file download - { - System.out.println(systemType + ":Starting multi-file Download"); - - // transfer the files - ss.downloadMultiple(files, destinations, encodings, monitor); - } - else // single file download - { - System.out.println(systemType + ":Starting single file Download"); - - for (int s = 0; s < files.length; s++) - { - // transfer the files - ss.download(files[s], destinations[s], encodings[s], monitor); - } - } - long t2 = System.currentTimeMillis(); - System.out.println(systemType + ": download time = "+ (t2 - t1) + " milliseconds"); - - - assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertTrue(ss.isConnected()); - - // examine results - for (int r = 0; r < destinations.length; r++) - { - // check results and compare their sizes - long expectedSize = fileSizes[r]; - - File destination = new File(destinations[r]); - long actualSize = destination.length(); - - boolean goodDownload = expectedSize == actualSize; - - if (!goodDownload) - { - System.out.println("bad download of "+ destination.getAbsolutePath()); - System.out.println("expected size:"+expectedSize); - System.out.println("actual size:"+actualSize); - } - assertTrue(goodDownload); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - - } - } - - public void testGetRemoteFileRelativePath() throws Exception { - // for bug 240704 - // -test-author-:MartinOberhuber - if (isTestDisabled()) - return; - setupConnections(); - for (int i = 0; i < _subSystems.size(); i++) { - IRemoteFileSubSystem ss = (IRemoteFileSubSystem) _subSystems.get(i); - ss.checkIsConnected(getDefaultProgressMonitor()); - IRemoteFile homeDir = ss.getRemoteFileObject(".", getDefaultProgressMonitor()); - assertTrue(homeDir.exists()); - assertTrue(homeDir.isDirectory()); - String sep = homeDir.getSeparator(); - String relativePath = "rsetest" + System.currentTimeMillis() + sep + "foo" + sep + "bar"; - try { - IRemoteFile subDir = ss.getRemoteFileObject(homeDir, relativePath, getDefaultProgressMonitor()); - assertTrue(subDir.isDescendantOf(homeDir)); - assertEquals("bar", subDir.getName()); - assertFalse(subDir.exists()); - assertFalse(subDir.isDirectory()); - } catch (IllegalArgumentException e) { - // Expected here: IllegalArgumentException is OK - } - } - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/RSEFileStoreTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/RSEFileStoreTest.java deleted file mode 100644 index 2d1ea3abf..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/RSEFileStoreTest.java +++ /dev/null @@ -1,655 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Martin Oberhuber (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases - *******************************************************************************/ - -package org.eclipse.rse.tests.subsystems.files; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.reflect.Method; -import java.net.URI; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.filesystem.EFS; -import org.eclipse.core.filesystem.IFileInfo; -import org.eclipse.core.filesystem.IFileStore; -import org.eclipse.core.filesystem.provider.FileInfo; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.internal.efs.RSEFileSystem; -import org.eclipse.rse.services.shells.IShellService; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.subsystems.shells.core.model.SimpleCommandOperation; -import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystem; - -/** - * Testcase for RSEFileStore - */ -public class RSEFileStoreTest extends FileServiceBaseTest { - - private String fPropertiesFileName; - //For testing the test: verify methods on Eclipse Local Filesystem - public static String fDefaultPropertiesFile = null; - //public static String fDefaultPropertiesFile = "sshConnection.properties"; //$NON-NLS-1$ - - private IRemoteFile fHomeDirectory; - private String fTestStorePath; - private IFileStore fTestStore; - private InputStream fIS; - private OutputStream fOS; - - /** - * Constructor with specific test name. - * - * @param name test to execute - */ - public RSEFileStoreTest(String name) { - this(name, fDefaultPropertiesFile); - } - - /** - * Constructor with connection type and specific test name. - * - * @param name test to execute - * @param propertiesFileName file with connection properties to use - */ - public RSEFileStoreTest(String name, String propertiesFileName) { - super(name); - fPropertiesFileName = propertiesFileName; - if (propertiesFileName != null) { - int idx = propertiesFileName.indexOf("Connection.properties"); - String targetName = propertiesFileName.substring(0, idx); - setTargetName(targetName); - } - } - - public static Test suite() { - String baseName = RSEFileStoreTest.class.getName(); - TestSuite suite = new TestSuite(baseName); - - //// Add a test suite for each connection type - //String[] connTypes = { null, "local", "ssh", "ftp", "linux", "windows" }; - String[] connTypes = { null, "local" }; - //String[] connTypes = { "ssh" }; - - for (int i = 0; i < connTypes.length; i++) { - String suiteName = connTypes[i] == null ? "EFS" : connTypes[i]; - String propFileName = connTypes[i] == null ? null : connTypes[i] + "Connection.properties"; - TestSuite subSuite = new TestSuite(baseName + "." + suiteName); - Method[] m = RSEFileStoreTest.class.getMethods(); - for (int j = 0; j < m.length; j++) { - String testName = m[j].getName(); - if (testName.startsWith("test")) { - subSuite.addTest(new RSEFileStoreTest(testName, propFileName)); - } - } - suite.addTest(subSuite); - } - return suite; - } - - - protected IShellServiceSubSystem getShellServiceSubSystem() { - if (fPropertiesFileName == null) { - return null; - } - IHost host = getHost(fPropertiesFileName); - ISubSystem[] ss = RSECorePlugin.getTheSystemRegistry().getServiceSubSystems(host, IShellService.class); - for (int i = 0; i < ss.length; i++) { - if (ss[i] instanceof ShellServiceSubSystem) { - return (ShellServiceSubSystem) ss[i]; - } - } - return null; - } - - public void setUp() throws Exception { - super.setUp(); - if (fPropertiesFileName == null) { - //For testing the test: Use Eclipse EFS.getLocalFileSystem() - String homePath = System.getProperty("user.home"); - IPath testPath = new Path(homePath + "/rseTest" + System.currentTimeMillis()); - fTestStorePath = testPath.toOSString(); - fTestStore = EFS.getLocalFileSystem().getStore(testPath); - fTestStore.mkdir(EFS.NONE, getDefaultProgressMonitor()); - } else { - //RSE method - IHost host = getHost(fPropertiesFileName); - IRemoteFileSubSystem fss = RemoteFileUtility.getFileSubSystem(host); - fss.checkIsConnected(getDefaultProgressMonitor()); - fHomeDirectory = fss.getRemoteFileObject(".", getDefaultProgressMonitor()); - IPath testPath = new Path(fHomeDirectory.getAbsolutePath() + "/rseTest" + System.currentTimeMillis()); - fTestStorePath = testPath.toString(); - URI testURI = RSEFileSystem.getURIFor(host.getHostName(), fTestStorePath); - fTestStore = RSEFileSystem.getInstance().getStore(testURI); - fTestStore.mkdir(EFS.NONE, getDefaultProgressMonitor()); - } - } - - public void tearDown() throws Exception { - if (fIS != null) { - try { - fIS.close(); - } catch (IOException e) { - System.err.println("Exception in tearDown.closeInputStream:"); - e.printStackTrace(); - } - } - if (fOS != null) { - try { - fOS.close(); - } catch (IOException e) { - System.err.println("Exception in tearDown.closeOutputStream:"); - e.printStackTrace(); - } - } - //Try..catch to allow super.tearDown() to run - try { - fTestStore.delete(EFS.NONE, getDefaultProgressMonitor()); - } catch (CoreException ce) { - System.err.println("Exception in tearDown.deleteTestStore:"); - ce.printStackTrace(); - } - super.tearDown(); - } - - protected IFileStore createFile(String name) throws Exception { - IFileStore store = fTestStore.getChild(name); - fOS = store.openOutputStream(EFS.NONE, getDefaultProgressMonitor()); - fOS.write(name.getBytes()); - fOS.flush(); - fOS.close(); - fOS = null; - return store; - } - - public void testRecursiveGetParent() { - //-test-author-:MartinOberhuber - if (isTestDisabled()) - return; - IFileStore store = fTestStore; - String homePath = store.toURI().getPath(); - assertTrue("exists: " + store, store.fetchInfo().exists()); - IFileStore newStore = store.getParent(); - while (newStore != null && newStore.isParentOf(store)) { - assertTrue("exists: " + newStore, newStore.fetchInfo().exists()); - store = newStore; - } - String newPath = store.toURI().getPath(); - assertTrue("newPath not empty: " + newPath, newPath.length() > 0); - assertTrue("newPath < homePath " + homePath, newPath.length() < homePath.length()); - } - - public void testAppendOutputStream() throws Exception { - //-test-author-:MartinOberhuber - if (isTestDisabled()) - return; - IFileStore f = createFile("foo"); - fOS = f.openOutputStream(EFS.APPEND, getDefaultProgressMonitor()); - fOS.write("bar".getBytes()); - fOS.flush(); - fOS.close(); - fOS = null; - fIS = f.openInputStream(EFS.NONE, getDefaultProgressMonitor()); - byte[] b = "foobar".getBytes(); - for (int i = 0; i < b.length; i++) { - assertTrue("Reading byte " + i, b[i] == fIS.read()); - } - assertTrue("EOF", fIS.read() == -1); - fIS.close(); - fIS = null; - } - - public void testPutInfo() throws Exception { - //-test-author-:MartinOberhuber - if (isTestDisabled()) - return; - IFileInfo testInfo = fTestStore.fetchInfo(); - assertTrue("1.1", testInfo.exists()); - assertTrue("1.2", testInfo.isDirectory()); - // if (fPropertiesFileName != null) { - // // bug 249316: fails on EFS localstore linux nfs - // assertTrue("1.3", testInfo.getLength() == 0); - // } - long parentModified = testInfo.getLastModified(); - - IFileStore f = createFile("testReadOnly.txt"); - IFileInfo info = f.fetchInfo(); - assertFalse("2.1", info.isDirectory()); - assertFalse("2.2", info.getAttribute(EFS.ATTRIBUTE_READ_ONLY)); - assertTrue("2.3", info.getLastModified() >= parentModified); - - info.setLastModified(parentModified - 120000); // 2 minutes earlier - f.putInfo(info, EFS.SET_LAST_MODIFIED, getDefaultProgressMonitor()); - info = f.fetchInfo(); - assertTrue("2.4", info.getLastModified() < parentModified); - - info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true); - f.putInfo(info, EFS.SET_ATTRIBUTES, getDefaultProgressMonitor()); - info = f.fetchInfo(); - assertTrue("2.5", info.getAttribute(EFS.ATTRIBUTE_READ_ONLY)); - - //Modifying modtime of read-only file: expected to fail - info.setLastModified(parentModified + 120000); // 2 minutes later - assertTrue("2.6.1", info.getLastModified() > parentModified); - try { - f.putInfo(info, EFS.SET_LAST_MODIFIED, getDefaultProgressMonitor()); - } catch (CoreException ce) { - //TODO: Not specified by EFS whether putInfo modtime of a read-only file should throw an exception - //EFS.getLocalFileSystem() does not throw an exception, but also doesn't change the modtime - System.out.println("OK: Exception on putInfo to read-only: " + ce.getLocalizedMessage()); - } - info = f.fetchInfo(); - //SSH is capable of modifying modtime of read-only files - //assertTrue("2.6.2", info.getLastModified() <= parentModified); //not actually changed - } - - public void testDeleteSpecialCases() throws Exception { - //-test-author-:MartinOberhuber - if (isTestDisabled()) - return; - String testFileName = "noPerm.txt"; //$NON-NLS-1$ - boolean exceptionThrown = false; - - //delete file without read permissions on parent - IFileStore store = createFile(testFileName); - IFileInfo info = store.fetchInfo(EFS.NONE, getDefaultProgressMonitor()); - info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true); - store.putInfo(info, EFS.SET_ATTRIBUTES, getDefaultProgressMonitor()); - info = fTestStore.fetchInfo(); - info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true); - info.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, false); - fTestStore.putInfo(info, EFS.SET_ATTRIBUTES, getDefaultProgressMonitor()); - try { - store.delete(EFS.NONE, getDefaultProgressMonitor()); - } catch (CoreException ce) { - exceptionThrown = true; - System.out.println("Good! " + ce); - assertTrue("1.1.1", ce.getStatus().getCode() == EFS.ERROR_DELETE); - } - if (fPropertiesFileName != null || File.separatorChar != '\\') { - // On Windows, no exception is thrown (read-only stuff can be deleted) - if (fHomeDirectory == null || fHomeDirectory.getSeparatorChar() != '\\') { - assertTrue("1.1", exceptionThrown); - IFileInfo info2 = store.fetchInfo(); - assertTrue(info2.exists()); - } - } - - // restore deletable - info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, false); - info.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, true); - fTestStore.putInfo(info, EFS.SET_ATTRIBUTES, getDefaultProgressMonitor()); - store.delete(EFS.NONE, getDefaultProgressMonitor()); - info = store.fetchInfo(EFS.NONE, getDefaultProgressMonitor()); - assertTrue("1.2", !info.exists()); - - if (fHomeDirectory != null && fHomeDirectory.getSeparatorChar() == '/' && fHomeDirectory.getParentRemoteFileSubSystem().isCaseSensitive()) { - //IRemoteFileSubSystem rfss = fHomeDirectory.getParentRemoteFileSubSystem(); - IRemoteCmdSubSystem rcmd = getShellServiceSubSystem(); - //SimpleCommandOperation op = new SimpleCommandOperation(rcmd, fHomeDirectory, false); - SimpleCommandOperation op = new SimpleCommandOperation(rcmd, fHomeDirectory, true); - op.runCommand("ln -s notExisting2.txt \"" + fTestStorePath + "/" + testFileName + "\"", true); - while (op.isActive()) { - Thread.sleep(200); - } - //delete symbolic link pointing to nowhere - store.delete(EFS.NONE, getDefaultProgressMonitor()); - info = store.fetchInfo(EFS.NONE, getDefaultProgressMonitor()); - assertTrue("1.3", !info.exists()); - - SimpleCommandOperation op2 = new SimpleCommandOperation(rcmd, fHomeDirectory, true); - op2.runCommand("ln -s . \"" + fTestStorePath + "/" + testFileName + "\"", true); - while (op2.isActive()) { - Thread.sleep(200); - } - // delete symbolic link pointing to current folder - store.delete(EFS.NONE, getDefaultProgressMonitor()); - info = store.fetchInfo(EFS.NONE, getDefaultProgressMonitor()); - assertTrue("1.4", !info.exists()); - - //Delete without even read permission on parent folder - store = createFile(testFileName); - SimpleCommandOperation op3 = new SimpleCommandOperation(rcmd, fHomeDirectory, true); - op3.runCommand("chmod 000 \"" + fTestStorePath + "\"", true); - while (op3.isActive()) { - Thread.sleep(200); - } - exceptionThrown = false; - try { - store.delete(EFS.NONE, getDefaultProgressMonitor()); - } catch (CoreException ce) { - exceptionThrown = true; - System.out.println("Good! " + ce); - assertTrue("1.5.1", ce.getStatus().getCode() == EFS.ERROR_DELETE); - } - assertTrue("1.5", exceptionThrown); - - exceptionThrown = false; - try { - info = store.fetchInfo(EFS.NONE, getDefaultProgressMonitor()); - } catch (CoreException ce) { - exceptionThrown = true; - System.out.println("Good! " + ce); - assertTrue("1.6.1", ce.getStatus().getCode() == EFS.ERROR_READ); - } - assertTrue("1.6", exceptionThrown); - SimpleCommandOperation op4 = new SimpleCommandOperation(rcmd, fHomeDirectory, true); - op4.runCommand("chmod 777 \"" + fTestStorePath + "\"", true); - while (op3.isActive()) { - Thread.sleep(200); - } - //Experience shows that we need to wait a little longer until the filesystem calms down - Thread.sleep(500); - info = store.fetchInfo(); - assertTrue(info.exists()); - } - } - - public void testModifyNonExisting() throws Exception { - // -test-author-:MartinOberhuber - if (isTestDisabled()) - return; - IFileStore store = fTestStore.getChild("nonExisting.txt"); - IFileInfo info; - boolean exceptionThrown = false; - - // fetchInfo on non-Existing - info = store.fetchInfo(EFS.NONE, getDefaultProgressMonitor()); - assertTrue("1.1", !info.exists()); - - // delete non-Existing - store.delete(EFS.NONE, getDefaultProgressMonitor()); - // TODO IFileStore.delete() does not specify whether deleting a - // non-existing file should throw an Exception. - // EFS.getLocalFileSystem() does not throw the exception. - info = store.fetchInfo(EFS.NONE, getDefaultProgressMonitor()); - assertTrue("1.2", !info.exists()); - - // putInfo on non-Existing - exceptionThrown = false; - try { - info = new FileInfo(); - store.putInfo(info, EFS.SET_ATTRIBUTES, getDefaultProgressMonitor()); - } catch (CoreException ce) { - System.out.println("Good! putInfo attrib non-existing: " + ce.getLocalizedMessage()); - exceptionThrown = true; - assertTrue("1.3.1", ce.getStatus().getCode() == EFS.ERROR_NOT_EXISTS); - } - assertTrue("1.3", exceptionThrown); - - // putInfo on non-Existing - exceptionThrown = false; - try { - info = new FileInfo(); - store.putInfo(info, EFS.SET_LAST_MODIFIED, getDefaultProgressMonitor()); - } catch (CoreException ce) { - System.out.println("Good! putInfo lastMod non-existing: " + ce.getLocalizedMessage()); - exceptionThrown = true; - assertTrue("1.4.1", ce.getStatus().getCode() == EFS.ERROR_NOT_EXISTS); - } - assertTrue("1.4", exceptionThrown); - - // fetchInfo on non-Existing - exceptionThrown = false; - info = store.fetchInfo(EFS.NONE, getDefaultProgressMonitor()); - assertTrue("1.5", !info.exists()); - - // openInputStream on non-Existing - exceptionThrown = false; - try { - fIS = store.openInputStream(EFS.NONE, getDefaultProgressMonitor()); - } catch (CoreException ce) { - System.out.println("Good! openInputStream non-existing: " + ce.getLocalizedMessage()); - exceptionThrown = true; - //FIXME EFS.getLocalFileSystem() uses EFS.ERROR_READ but should ERROR_NOT_EXISTS - int code = ce.getStatus().getCode(); - assertTrue("1.6.1", code == EFS.ERROR_NOT_EXISTS || code == EFS.ERROR_READ); - } - assertTrue("1.6", exceptionThrown); - - // fetchInfo on non-Existing - exceptionThrown = false; - info = store.fetchInfo(EFS.NONE, getDefaultProgressMonitor()); - assertTrue("1.7", !info.exists()); - - // openOutputStream append on non-Existing - // IFileStore specifies that this method succeeds in case of non-existing files. - fOS = store.openOutputStream(EFS.APPEND, getDefaultProgressMonitor()); - fOS.write('a'); - fOS.close(); - fOS = null; - info = store.fetchInfo(EFS.NONE, getDefaultProgressMonitor()); - assertTrue("1.8.1", info.exists()); - assertTrue("1.8.2", info.getLength() == 1); - - // openOutputStream overwrite - fOS = store.openOutputStream(EFS.NONE, getDefaultProgressMonitor()); - fOS.write('b'); - fOS.close(); - fOS = null; - info = store.fetchInfo(EFS.NONE, getDefaultProgressMonitor()); - assertTrue("1.9.1", info.exists()); - assertTrue("1.9.2", info.getLength() == 1); - } - - public void testModifyReadOnly() throws Exception { - //-test-author-:MartinOberhuber - if (isTestDisabled()) - return; - IFileStore store = createFile("readOnly.txt"); - IFileInfo info = store.fetchInfo(); - info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true); - store.putInfo(info, EFS.SET_ATTRIBUTES, getDefaultProgressMonitor()); - - boolean exceptionThrown = false; - try { - fOS = store.openOutputStream(EFS.APPEND, getDefaultProgressMonitor()); - fOS.write('a'); - fOS.close(); - fOS = null; - } catch (CoreException ce) { - System.out.println("Good! appendReadOnly: " + ce.getLocalizedMessage()); - exceptionThrown = true; - int code = ce.getStatus().getCode(); - //assertTrue("1.1.1", ce.getStatus().getCode() == EFS.ERROR_READ_ONLY); - assertTrue("1.1.1", code == EFS.ERROR_WRITE); - assertTrue(fOS==null); - } - assertTrue("1.1", exceptionThrown); - - //set writable again - info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, false); - store.putInfo(info, EFS.SET_ATTRIBUTES, getDefaultProgressMonitor()); - - //append, but KEEP STORE OPEN - fOS = store.openOutputStream(EFS.APPEND, getDefaultProgressMonitor()); - fOS.write('a'); - fOS.flush(); - - // set read-only WHILE FILE IS OPEN - info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true); - exceptionThrown = false; - try { - store.putInfo(info, EFS.SET_ATTRIBUTES, getDefaultProgressMonitor()); - } catch (CoreException ce) { - System.out.println("Good! setOpenFileReadOnly: " + ce.getLocalizedMessage()); - int code = ce.getStatus().getCode(); - assertTrue("2.1", code == EFS.ERROR_WRITE); - } - //FIXME Platform EFS.getLocalFileSystem() doesn't throw exception here - //assertTrue("2.2", exceptionThrown); - if (!exceptionThrown) { - info = store.fetchInfo(); - assertTrue("2.2", info.getAttribute(EFS.ATTRIBUTE_READ_ONLY)); - } - - // continue appending now that the file is read-only - fOS.write('b'); - fOS.flush(); - - // set read-only AFTER CLOSING - fOS.close(); - store.putInfo(info, EFS.SET_ATTRIBUTES, getDefaultProgressMonitor()); - } - - public void testMakeDeleteTree() throws Exception { - // -test-author-:MartinOberhuber - // Create folder - if (isTestDisabled()) - return; - IFileStore treeStore = fTestStore.getChild("treeTest"); - treeStore.mkdir(EFS.SHALLOW, getDefaultProgressMonitor()); - - // Neg: Create folder where file already exists - boolean exceptionThrown = false; - IFileStore treeNegStore = createFile("treeNegTest"); - treeNegStore = fTestStore.getChild("treeNegTest"); - try { - treeNegStore.mkdir(EFS.SHALLOW, getDefaultProgressMonitor()); - } catch (CoreException ce) { - System.out.println("Good! treeNegStore.mkdir: " + ce.getLocalizedMessage()); - exceptionThrown = true; - int code = ce.getStatus().getCode(); - assertTrue("1.1", code == EFS.ERROR_WRONG_TYPE); - } - assertTrue("1.2", exceptionThrown); - - // Neg: Create deep folder with EFS.SHALLOW - exceptionThrown = false; - //IFileStore store = treeStore.getFileStore(new Path("foo/bar/baz")); - IFileStore store = treeStore.getChild("foo").getChild("bar").getChild("baz"); - try { - store.mkdir(EFS.SHALLOW, getDefaultProgressMonitor()); - } catch (CoreException ce) { - System.out.println("Good! mkdirsShallow: " + ce.getLocalizedMessage()); - exceptionThrown = true; - int code = ce.getStatus().getCode(); - //assertTrue("2.1", code == EFS.ERROR_NOT_EXISTS); - assertTrue("2.1", code == EFS.ERROR_WRITE); - } - assertTrue("2.2", exceptionThrown); - - // Create deep folder - store.mkdir(EFS.NONE, getDefaultProgressMonitor()); - - // Neg: openInputStream on a folder - exceptionThrown = false; - try { - fIS = store.openInputStream(EFS.NONE, getDefaultProgressMonitor()); - } catch (CoreException ce) { - System.out.println("Good! openInputStream on folder: " + ce.getLocalizedMessage()); - exceptionThrown = true; - int code = ce.getStatus().getCode(); - //FIXME would expect EFS.ERROR_WRONG_TYPE, but EFS.getLocalFileSystem() throws EFS.ERROR_READ - assertTrue("3.1", code == EFS.ERROR_READ || code == EFS.ERROR_WRONG_TYPE); - } - assertTrue("3.2", exceptionThrown); - - // Neg: openOutputStream on a folder - exceptionThrown = false; - try { - fOS = store.openOutputStream(EFS.NONE, getDefaultProgressMonitor()); - } catch (CoreException ce) { - System.out.println("Good! openOutputStream on folder: " + ce.getLocalizedMessage()); - exceptionThrown = true; - int code = ce.getStatus().getCode(); - //FIXME expected ERROR_WRONG_TYPE, but EFS.getLocalFileSystem() throws EFS.ERROR_WRITE - assertTrue("4.1", code == EFS.ERROR_WRITE || code == EFS.ERROR_WRONG_TYPE); - } - assertTrue("4.2", exceptionThrown); - - // Create file in deep folder but READ-ONLY - IFileStore child1 = store.getChild("readOnlyFile.txt"); - fOS = child1.openOutputStream(EFS.NONE, getDefaultProgressMonitor()); - fOS.write("foobar\nbaz\n".getBytes()); - fOS.flush(); - fOS.close(); - fOS = null; - IFileInfo child1info = child1.fetchInfo(); - child1info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true); - child1.putInfo(child1info, EFS.SET_ATTRIBUTES, getDefaultProgressMonitor()); - - // Create file in deep folder but LEAVE IT OPEN - IFileStore child2 = store.getChild("openFile.txt"); - fOS = child2.openOutputStream(EFS.NONE, getDefaultProgressMonitor()); - fOS.write("foobar\nbaz\n".getBytes()); - fOS.flush(); - - // Delete tree - exceptionThrown = false; - try { - treeStore.delete(EFS.NONE, getDefaultProgressMonitor()); - fOS.close(); - fOS = null; - } catch (CoreException ce) { - System.out.println("Good! Exception while deleting tree with open File: " + ce.getLocalizedMessage()); - int code = ce.getStatus().getCode(); - assertTrue(code == EFS.ERROR_DELETE); - exceptionThrown = true; - fOS.close(); - fOS = null; - treeStore.delete(EFS.NONE, getDefaultProgressMonitor()); - } - //We don't care about exception thrown or not, as long as tree is gone - //assertTrue("5", exceptionThrown); - - IFileInfo treeInfo = treeStore.fetchInfo(); - assertFalse("5.1", treeInfo.exists()); - assertFalse("5.2", child1.fetchInfo().exists()); - assertFalse("5.3", child2.fetchInfo().exists()); - } - - public static Test suite255files() { - String baseName = RSEFileStoreTest.class.getName(); - TestSuite suite = new TestSuite(baseName); - suite.addTest(new RSEFileStoreTest("test255files", "sshConnection.properties")); - suite.addTest(new RSEFileStoreTest("test255files", "linuxConnection.properties")); - suite.addTest(new RSEFileStoreTest("test255files", "sshConnection.properties")); - suite.addTest(new RSEFileStoreTest("test255files", "linuxConnection.properties")); - return suite; - } - - public void test255files() throws Exception { - if (isTestDisabled()) - return; - IFileStore f = fTestStore.getChild("f"); - f.mkdir(EFS.SHALLOW, getDefaultProgressMonitor()); - for (int i = 0; i < 255; i++) { - IFileStore store = f.getChild("f" + i); - fOS = store.openOutputStream(EFS.NONE, getDefaultProgressMonitor()); - fOS.write(String.valueOf(i).getBytes()); - fOS.flush(); - fOS.close(); - fOS = null; - } - IFileInfo[] infos = f.childInfos(EFS.NONE, getDefaultProgressMonitor()); - assertTrue("1", infos.length == 255); - for (int i = 0; i < 255; i++) { - assertTrue("1.1", infos[i].exists()); - assertFalse("1.2", infos[i].isDirectory()); - } - f.delete(EFS.NONE, getDefaultProgressMonitor()); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/RSEFileSubsystemTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/RSEFileSubsystemTestSuite.java deleted file mode 100644 index 3e2dc6b98..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/RSEFileSubsystemTestSuite.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Martin Oberhuber (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - * Johnson Ma (Wind River) - [195402] Add tar.gz archive support - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.files; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -public class RSEFileSubsystemTestSuite extends DelegatingTestSuiteHolder { - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSEFileSubsystemTestSuite"); //$NON-NLS-1$ - // add the single test suites to the overall one here. - //-test-disabled-//suite.addTestSuite(CreateFileTestCase.class); - //-test-disabled-//suite.addTestSuite(FileOutputStreamTestCase.class); - suite.addTestSuite(FileServiceArchiveTest.class); - //-test-disabled-//suite.addTest(FileServiceArchiveTestDStore.suite()); - //-test-disabled-//suite.addTest(FileServiceArchiveTestDStoreWindows.suite()); - suite.addTestSuite(FileServiceTest.class); - //-test-disabled-//suite.addTestSuite(FileSubsystemConsistencyTestCase.class); - - // Do not include the ftp sub system test case within the automated tests. - // Most server seems to limit the amount of connections per IP-address, so - // we run in problems with that. The test needs to be executed manually with - // the ftp server to use possibly changed to whatever host will do. - suite.addTestSuite(FTPFileSubsystemTestCase.class); - suite.addTestSuite(FileServiceTgzArchiveTest.class); - suite.addTest(RSEFileStoreTest.suite()); - - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)RSEFileSubsystemTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/RSEShellSubsystemTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/RSEShellSubsystemTestSuite.java deleted file mode 100644 index 9c30e273d..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/RSEShellSubsystemTestSuite.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Anna Dushistova (MontaVista) - adapted from RSEFileSubsystemTestSuite - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.shells; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -public class RSEShellSubsystemTestSuite extends DelegatingTestSuiteHolder { - /** - * Standard Java application main method. Allows to launch the test suite - * from outside as part of nightly runs, headless runs or other. - * <p> - * <b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as it is - * explicitly supposed to output the test output to the shell the test suite - * has been launched from. - * <p> - * - * @param args - * The standard Java application command line parameters passed - * in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! - * Otherwise the JUnit plug-in test launcher will fail to detect this - * class!</b> - * <p> - * - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSEShellSubsystemTestSuite"); //$NON-NLS-1$ - // add the single test suites to the overall one here. - suite.addTestSuite(ShellServiceTest.class); - suite.addTestSuite(ShellSubSystemTest.class); - return suite; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite) RSEShellSubsystemTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/ShellOutputListener.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/ShellOutputListener.java deleted file mode 100644 index aab1be8d0..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/ShellOutputListener.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2008 MontaVista Software, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Anna Dushistova (MontaVista) - [249102][testing] Improve ShellService Unittests - ********************************************************************************/ -package org.eclipse.rse.tests.subsystems.shells; - -import java.util.ArrayList; - -import org.eclipse.rse.services.shells.IHostOutput; -import org.eclipse.rse.services.shells.IHostShellChangeEvent; -import org.eclipse.rse.services.shells.IHostShellOutputListener; - -public class ShellOutputListener implements IHostShellOutputListener { - - private ArrayList outputs; - - public ShellOutputListener() { - outputs = new ArrayList(); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.rse.services.shells.IHostShellOutputListener#shellOutputChanged - * (org.eclipse.rse.services.shells.IHostShellChangeEvent) - */ - public void shellOutputChanged(IHostShellChangeEvent event) { - IHostOutput[] output = event.getLines(); - for (int i = 0; i < output.length; i++) - outputs.add(output[i]); - } - - /** - * @return - */ - public Object[] getAllOutput() { - return outputs.toArray(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/ShellServiceTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/ShellServiceTest.java deleted file mode 100644 index 81a1ed553..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/ShellServiceTest.java +++ /dev/null @@ -1,247 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Anna Dushistova (MontaVista) - adapted from FileServiceTest - * Anna Dushistova (MontaVista) - [249102][testing] Improve ShellService Unittests - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.shells; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.reflect.Method; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; -import org.eclipse.rse.services.shells.HostShellProcessAdapter; -import org.eclipse.rse.services.shells.IHostOutput; -import org.eclipse.rse.services.shells.IHostShell; -import org.eclipse.rse.services.shells.IShellService; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystem; -import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; - -public class ShellServiceTest extends RSEBaseConnectionTestCase { - - protected String fPropertiesFileName; - // For testing the test: verify methods on Local - public static String fDefaultPropertiesFile = "localConnection.properties"; - - protected IShellServiceSubSystem shellSubSystem; - protected IShellService shellService; - protected IProgressMonitor mon = new NullProgressMonitor(); - - /** - * Constructor with specific test name. - * - * @param name - * test to execute - */ - public ShellServiceTest(String name) { - this(name, fDefaultPropertiesFile); - } - - /** - * Constructor with connection type and specific test name. - * - * @param name - * test to execute - * @param propertiesFileName - * file with connection properties to use - */ - public ShellServiceTest(String name, String propertiesFileName) { - super(name); - fPropertiesFileName = propertiesFileName; - if (propertiesFileName != null) { - int idx = propertiesFileName.indexOf("Connection.properties"); - String targetName = propertiesFileName.substring(0, idx); - setTargetName(targetName); - } - } - - public static Test suite() { - String baseName = ShellServiceTest.class.getName(); - TestSuite suite = new TestSuite(baseName); - - // // Add a test suite for each connection type - String[] connTypes = { "local", "ssh", "telnet" }; - - for (int i = 0; i < connTypes.length; i++) { - String suiteName = connTypes[i]; - String propFileName = connTypes[i] == null ? null : connTypes[i] - + "Connection.properties"; - TestSuite subSuite = new TestSuite(baseName + "." + suiteName); - Method[] m = ShellServiceTest.class.getMethods(); - for (int j = 0; j < m.length; j++) { - String testName = m[j].getName(); - if (testName.startsWith("test")) { - subSuite.addTest(new ShellServiceTest(testName, - propFileName)); - } - } - suite.addTest(subSuite); - } - return suite; - } - - protected IShellServiceSubSystem getShellServiceSubSystem() { - if (fPropertiesFileName == null) { - return null; - } - IHost host = getHost(fPropertiesFileName); - ISubSystem[] ss = RSECorePlugin.getTheSystemRegistry() - .getServiceSubSystems(host, IShellService.class); - for (int i = 0; i < ss.length; i++) { - if (ss[i] instanceof ShellServiceSubSystem) { - return (ShellServiceSubSystem) ss[i]; - } - } - return null; - } - - public void setUp() throws Exception { - super.setUp(); - initShellService(); - } - - protected void initShellService() throws SystemMessageException { - shellSubSystem = getShellServiceSubSystem(); - shellService = shellSubSystem.getShellService(); - shellSubSystem.checkIsConnected(getDefaultProgressMonitor()); - } - - public void tearDown() throws Exception { - super.tearDown(); - } - - public boolean isWindows() { - return shellSubSystem.getHost().getSystemType().isWindows(); - } - - public void testLaunchShell() throws Exception { - Object[] allOutput = launchShell("", "echo test", new String[] {}); - boolean matchFound = false; - for (int i = 0; i < allOutput.length; i++) { - matchFound = ((IHostOutput) allOutput[i]).getString() - .equals("test"); - System.out.println(((IHostOutput) allOutput[i]).getString()); - if (matchFound) - break; - } - assertTrue(matchFound); - // now set working directory -- Linux only - allOutput = launchShell("/", "echo test", new String[] {}); - matchFound = false; - for (int i = 0; i < allOutput.length; i++) { - matchFound = ((IHostOutput) allOutput[i]).getString() - .equals("test"); - System.out.println(((IHostOutput) allOutput[i]).getString()); - if (matchFound) - break; - } - } - - public Object[] launchShell(String workingDirectory, String cmd, - String[] env) throws SystemMessageException, InterruptedException { - IHostShell hostShell = shellService.launchShell(workingDirectory, env, - mon); - assertNotNull(hostShell); - assertNotNull(hostShell.getStandardOutputReader()); - ShellOutputListener outputListener = new ShellOutputListener(); - hostShell.addOutputListener(outputListener); - // run command - hostShell.writeToShell(cmd); - hostShell.writeToShell("exit"); - while (hostShell.isActive()) { - Thread.sleep(1000); - } - Object[] allOutput = outputListener.getAllOutput(); - return allOutput; - } - - public void testRunCommand() throws Exception { - Object[] allOutput = runCommand("", "echo test", new String[] {}); - boolean matchFound = false; - for (int i = 0; i < allOutput.length; i++) { - System.out.println(((IHostOutput) allOutput[i]).getString()); - matchFound = ((IHostOutput) allOutput[i]).getString() - .equals("test"); - if (matchFound) - break; - } - assertTrue("Failed without changing initial working directory",matchFound); - //set initial working directory -- Linux only - allOutput = runCommand("/", "echo test", new String[] {}); - matchFound = false; - for (int i = 0; i < allOutput.length; i++) { - System.out.println(((IHostOutput) allOutput[i]).getString()); - matchFound = ((IHostOutput) allOutput[i]).getString() - .equals("test"); - if (matchFound) - break; - } - assertTrue("Failed with changing initial working directory",matchFound); - } - - public Object[] runCommand(String workingDirectory, String cmd, String[] env) - throws SystemMessageException, InterruptedException { - IHostShell hostShell = null; - hostShell = shellService.runCommand(workingDirectory, cmd, env, mon); - ShellOutputListener outputListener = new ShellOutputListener(); - hostShell.addOutputListener(outputListener); - hostShell.writeToShell("exit"); - assertNotNull(hostShell); - assertNotNull(hostShell.getStandardOutputReader()); - while (hostShell.isActive()) { - Thread.sleep(1000); - } - Object[] allOutput = outputListener.getAllOutput(); - return allOutput; - } - - public void testRunCommandViaHostShellProcessAdapter() throws Exception { - IHostShell hostShell = null; - String commandSeparator = (shellSubSystem!=null)?shellSubSystem.getParentRemoteCmdSubSystemConfiguration() - .getCommandSeparator():"\r\n"; - hostShell = shellService.runCommand("", "echo test" - + commandSeparator + " exit", new String[] {}, mon); - HostShellProcessAdapter p = null; - try { - p = new HostShellProcessAdapter(hostShell); - } catch (Exception e) { - fail(e.getMessage()); - return; - } - BufferedReader bufferReader = new BufferedReader(new InputStreamReader( - p.getInputStream())); - - String nextLine; - boolean matchFound = false; - try { - while ((nextLine = bufferReader.readLine()) != null) { - System.out.println(nextLine); - matchFound = nextLine.equals("test"); - if(matchFound) - break; - } - bufferReader.close(); - } catch (IOException e) { - e.printStackTrace(); - fail(e.getMessage()); - } - assertTrue(matchFound); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/ShellSubSystemTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/ShellSubSystemTest.java deleted file mode 100644 index 7965b0d2c..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/ShellSubSystemTest.java +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Anna Dushistova (MontaVista) - adapted from FileServiceTest - * Anna Dushistova (MontaVista) - [249102][testing] Improve ShellService Unittests - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.shells; - -import java.lang.reflect.Method; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.services.shells.IShellService; -import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCommandShell; -import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteOutput; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; -import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystem; -import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; - -public class ShellSubSystemTest extends RSEBaseConnectionTestCase { - - private String fPropertiesFileName; - // For testing the test: verify methods on Local - public static String fDefaultPropertiesFile = "localConnection.properties"; - - private IShellServiceSubSystem shellSubSystem; - private IProgressMonitor mon = new NullProgressMonitor(); - - /** - * Constructor with specific test name. - * - * @param name - * test to execute - */ - public ShellSubSystemTest(String name) { - this(name, fDefaultPropertiesFile); - } - - /** - * Constructor with connection type and specific test name. - * - * @param name - * test to execute - * @param propertiesFileName - * file with connection properties to use - */ - public ShellSubSystemTest(String name, String propertiesFileName) { - super(name); - fPropertiesFileName = propertiesFileName; - if (propertiesFileName != null) { - int idx = propertiesFileName.indexOf("Connection.properties"); - String targetName = propertiesFileName.substring(0, idx); - setTargetName(targetName); - } - } - - public static Test suite() { - String baseName = ShellSubSystemTest.class.getName(); - TestSuite suite = new TestSuite(baseName); - - // // Add a test suite for each connection type - String[] connTypes = { "local", "ssh" }; - // String[] connTypes = { "local" }; - // String[] connTypes = { "ssh" }; - - for (int i = 0; i < connTypes.length; i++) { - String suiteName = connTypes[i]; - String propFileName = connTypes[i] == null ? null : connTypes[i] - + "Connection.properties"; - TestSuite subSuite = new TestSuite(baseName + "." + suiteName); - Method[] m = ShellSubSystemTest.class.getMethods(); - for (int j = 0; j < m.length; j++) { - String testName = m[j].getName(); - if (testName.startsWith("test")) { - subSuite.addTest(new ShellSubSystemTest(testName, - propFileName)); - } - } - suite.addTest(subSuite); - } - return suite; - } - - protected IShellServiceSubSystem getShellServiceSubSystem() { - if (fPropertiesFileName == null) { - return null; - } - IHost host = getHost(fPropertiesFileName); - ISubSystem[] ss = RSECorePlugin.getTheSystemRegistry() - .getServiceSubSystems(host, IShellService.class); - for (int i = 0; i < ss.length; i++) { - if (ss[i] instanceof ShellServiceSubSystem) { - return (ShellServiceSubSystem) ss[i]; - } - } - return null; - } - - public void setUp() throws Exception { - super.setUp(); - shellSubSystem = getShellServiceSubSystem(); - shellSubSystem.checkIsConnected(getDefaultProgressMonitor()); - } - - public void tearDown() throws Exception { - super.tearDown(); - } - - public boolean isWindows() { - return shellSubSystem.getHost().getSystemType().isWindows(); - } - - public void testRunShell() throws Exception { - // the IRemoteCommandShell returned should have getOutputAt() and - // similar methods - if (shellSubSystem.canRunShell()) { - IRemoteCommandShell cmd = shellSubSystem.runShell(null, mon); - assertNotNull(cmd); - shellSubSystem.sendCommandToShell("echo test"+shellSubSystem.getParentRemoteCmdSubSystemConfiguration().getCommandSeparator()+" exit", cmd, mon); - while (cmd.isActive()) { - Thread.sleep(200); - } - assertNotNull(cmd.getOutputAt(0)); - shellSubSystem.removeShell(cmd); - } - - } - - public void testRunCommand() throws Exception { - if (shellSubSystem.canRunCommand()) { - Object[] results = shellSubSystem - .runCommand("echo test\r\nexit", null, mon); - - boolean matchFound = false; - Object cmdObject = results[0]; - assertTrue(cmdObject instanceof IRemoteCommandShell); - - while (((IRemoteCommandShell)cmdObject).isActive()) { - Thread.sleep(200); - } - Object[] result = ((IRemoteCommandShell) cmdObject) - .listOutput(); - for (int i = 0; i < result.length; i++) { - System.out.println(((IRemoteOutput) result[i]).getText()); - matchFound = ((IRemoteOutput) result[i]).getText().equals( - "test"); - if (matchFound) - break; - } - - assertTrue(matchFound); - } - } - - public void testCancelShell() throws Exception { - if (shellSubSystem.canRunShell()) { - IRemoteCommandShell cmd = shellSubSystem.runShell(null, mon); - shellSubSystem.cancelShell(cmd, mon); - assertFalse(cmd.isActive()); - - } - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/TerminalShellServiceTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/TerminalShellServiceTest.java deleted file mode 100644 index 1dc1a645a..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/shells/TerminalShellServiceTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 MontaVista Software, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Anna Dushistova (MontaVista)- initial API and implementation - *******************************************************************************/ - -package org.eclipse.rse.tests.subsystems.shells; - -import java.lang.reflect.Method; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; -import org.eclipse.rse.services.shells.IShellService; -import org.eclipse.rse.services.terminals.ITerminalService; -import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystem; - -public class TerminalShellServiceTest extends ShellServiceTest{ - - protected ITerminalService terminalService; - protected TerminalServiceSubSystem terminalSubSystem; - - /** - * @param name - * @param propertiesFileName - */ - public TerminalShellServiceTest(String name, String propertiesFileName) { - super(name, propertiesFileName); - } - - /** - * @param name - */ - public TerminalShellServiceTest(String name) { - super(name); - } - - public static Test suite() { - String baseName = TerminalShellServiceTest.class.getName(); - TestSuite suite = new TestSuite(baseName); - - // // Add a test suite for each connection type - String[] connTypes = { "sshTerminal" }; - // String[] connTypes = { "local" }; - // String[] connTypes = { "ssh" }; - - for (int i = 0; i < connTypes.length; i++) { - String suiteName = connTypes[i]; - String propFileName = connTypes[i] == null ? null : connTypes[i] - + "Connection.properties"; - TestSuite subSuite = new TestSuite(baseName + "." + suiteName); - Method[] m = TerminalShellServiceTest.class.getMethods(); - for (int j = 0; j < m.length; j++) { - String testName = m[j].getName(); - if (testName.startsWith("test")) { - subSuite.addTest(new TerminalShellServiceTest(testName, - propFileName)); - } - } - suite.addTest(subSuite); - } - return suite; - } - - protected TerminalServiceSubSystem getTerminalServiceSubSystem() { - if (fPropertiesFileName == null) { - return null; - } - IHost host = getHost(fPropertiesFileName); - ISubSystem[] ss = RSECorePlugin.getTheSystemRegistry() - .getServiceSubSystems(host, ITerminalService.class); - for (int i = 0; i < ss.length; i++) { - if (ss[i] instanceof TerminalServiceSubSystem) { - return (TerminalServiceSubSystem) ss[i]; - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.subsystems.shells.ShellServiceTest#initShellService() - */ - protected void initShellService() throws SystemMessageException { - terminalSubSystem = getTerminalServiceSubSystem(); - terminalService = terminalSubSystem.getTerminalService(); - terminalSubSystem.checkIsConnected(getDefaultProgressMonitor()); - shellService = (IShellService) terminalService.getAdapter(IShellService.class); - } - - public boolean isWindows() { - return terminalSubSystem.getHost().getSystemType().isWindows(); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/testsubsystem/RSETestSubsystemTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/testsubsystem/RSETestSubsystemTestSuite.java deleted file mode 100644 index a2e9122ed..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/testsubsystem/RSETestSubsystemTestSuite.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation. - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.testsubsystem; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -public class RSETestSubsystemTestSuite extends DelegatingTestSuiteHolder { - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE Test Subsystem Test Suite"); //$NON-NLS-1$ - // add the single test suites to the overall one here. - suite.addTestSuite(TestSubsystemTestCase.class); - - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)RSETestSubsystemTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/testsubsystem/TestSubsystemTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/testsubsystem/TestSubsystemTestCase.java deleted file mode 100644 index 62f367116..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/testsubsystem/TestSubsystemTestCase.java +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation. - * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core - * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - *******************************************************************************/ -package org.eclipse.rse.tests.subsystems.testsubsystem; - -import junit.framework.AssertionFailedError; - -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.events.ISystemResourceChangeEvents; -import org.eclipse.rse.core.events.SystemResourceChangeEvent; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.internal.ui.view.SystemView; -import org.eclipse.rse.internal.ui.view.SystemViewPart; -import org.eclipse.rse.tests.core.IRSEViews; -import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil; -import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; -import org.eclipse.rse.tests.testsubsystem.TestSubSystemContainerNode; -import org.eclipse.rse.tests.testsubsystem.TestSubSystemNode; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystem; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.PlatformUI; - -public class TestSubsystemTestCase extends RSEBaseConnectionTestCase { - private ITestSubSystem testSubSystem; - SystemView rseSystemView; - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - - // all view management must happen in the UI thread! - PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { - public void run() { - // For the test subsystem test case we need the RSE remote systems view - IViewPart viewPart = showView(IRSEViews.RSE_REMOTE_SYSTEMS_VIEW_ID, IRSEViews.RSE_PERSPECTIVE_ID); - assertNotNull("Failed to show required RSE remote systems view!", viewPart); //$NON-NLS-1$ - if (viewPart instanceof SystemViewPart) { - rseSystemView = ((SystemViewPart)viewPart).getSystemView(); - } - } - }); - assertNotNull("Failed to get remote system viewer instance from RSE remote systems view!", rseSystemView); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - rseSystemView = null; - testSubSystem = null; - - super.tearDown(); - } - - public void testAddAndDeleteDeepNodes() { - //-test-author-:TobiasSchwarz - if (isTestDisabled()) - return; - // these test _must_ run in UI thread - PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { - public void run() { - internalTestAddAndDeleteNodes(true); - } - }); - } - - public void testAddAndDeleteFlatNodes() { - //-test-author-:TobiasSchwarz - if (isTestDisabled()) - return; - // these test _must_ run in UI thread - PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { - public void run() { - internalTestAddAndDeleteNodes(false); - } - }); - } - - public void internalTestAddAndDeleteNodes(boolean deep) { - IHost connection = getLocalSystemConnection(); - assertNotNull("Failed to get local system connection", connection); //$NON-NLS-1$ - - Exception exception = null; - String cause = null; - - testSubSystem = null; - try { - testSubSystem = getConnectionManager().getTestSubSystem(connection); - } catch(Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } - assertNull("Failed to get test subsystem! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertNotNull("No test subystem", testSubSystem); //$NON-NLS-1$ - - testSubSystem.removeAllChildNodes(); - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - registry.invalidateFiltersFor(testSubSystem); - - TestSubSystemContainerNode node = null; - for (int i=0; i<100; i++) { - if (node == null) { - node = new TestSubSystemContainerNode("node "+i); //$NON-NLS-1$ - testSubSystem.addChildNode(node); - } - else { - TestSubSystemContainerNode parentNode = node; - node = new TestSubSystemContainerNode("node "+i); //$NON-NLS-1$ - if (deep) { - parentNode.addChildNode(node); - } - else { - testSubSystem.addChildNode(node); - } - } - } - rseSystemView.refresh(testSubSystem); - rseSystemView.expandToLevel(testSubSystem, AbstractTreeViewer.ALL_LEVELS); - RSEWaitAndDispatchUtil.waitAndDispatch(1000); - - testSubSystem.removeAllChildNodes(); - //registry.invalidateFiltersFor(testSubSystem); - - //SystemPerspectiveHelpers.findRSEView().refresh(testSubSystem); - registry.fireEvent(new SystemResourceChangeEvent(testSubSystem, ISystemResourceChangeEvents.EVENT_REFRESH, testSubSystem)); - RSEWaitAndDispatchUtil.waitAndDispatch(1000); - } - - public void testBugzilla170728() { - //-test-author-:TobiasSchwarz - if (isTestDisabled()) - return; - // these test _must_ run in UI thread - PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { - public void run() { - internalTestBugzilla170728(); - } - }); - } - - public void internalTestBugzilla170728() { - IHost connection = getLocalSystemConnection(); - assertNotNull("Failed to get local system connection", connection); //$NON-NLS-1$ - - Exception exception = null; - String cause = null; - - testSubSystem = null; - try { - testSubSystem = getConnectionManager().getTestSubSystem(connection); - } catch(Exception e) { - exception = e; - cause = e.getLocalizedMessage(); - } - assertNull("Failed to get test subsystem! Possible cause: " + cause, exception); //$NON-NLS-1$ - assertNotNull("No test subystem", testSubSystem); //$NON-NLS-1$ - - RSECorePlugin.getTheSystemRegistry().invalidateFiltersFor(testSubSystem); - rseSystemView.refresh(testSubSystem); - RSEWaitAndDispatchUtil.waitAndDispatch(1000); - rseSystemView.expandToLevel(testSubSystem, AbstractTreeViewer.ALL_LEVELS); - RSEWaitAndDispatchUtil.waitAndDispatch(1000); - - ISystemFilterPoolManager mgr = testSubSystem.getFilterPoolReferenceManager().getDefaultSystemFilterPoolManager(); - String[] strings = new String[] { "Node.*" }; //$NON-NLS-1$ - - try { - mgr.createSystemFilter(mgr.getFirstDefaultSystemFilterPool(), "Node*", strings, "Node*"); //$NON-NLS-1$ //$NON-NLS-2$ - - TestSubSystemNode node = new TestSubSystemNode("Node 1"); //$NON-NLS-1$ - testSubSystem.addChildNode(node); - testSubSystem.addChildNode(new TestSubSystemNode("Node 2")); //$NON-NLS-1$ - testSubSystem.addChildNode(new TestSubSystemNode("Node 3")); //$NON-NLS-1$ - testSubSystem.addChildNode(new TestSubSystemNode("Node 4")); //$NON-NLS-1$ - - RSECorePlugin.getTheSystemRegistry().invalidateFiltersFor(testSubSystem); - rseSystemView.refresh(testSubSystem); - - RSEWaitAndDispatchUtil.waitAndDispatch(1000); - rseSystemView.expandToLevel(testSubSystem, AbstractTreeViewer.ALL_LEVELS); - rseSystemView.refresh(testSubSystem); - RSEWaitAndDispatchUtil.waitAndDispatch(1000); - - node.setName("Node 1 (changed)"); //$NON-NLS-1$ - - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - registry.fireEvent(new SystemResourceChangeEvent(node, ISystemResourceChangeEvents.EVENT_REFRESH, node)); - - RSEWaitAndDispatchUtil.waitAndDispatch(10000); - } - catch (Exception e) { - //We cannot have the Exception forwarded to the test framework, because - //it happens in the dispatch thread and our Runnable.run() method does - //not allow checked exceptions. Therefore, convert the exception into - //an Error that the test framework can handle, but make sure that the - //cause of the Error (the original exception) is maintained by calling - //initCause(). This will allow seeing it in the JUnit runner later on. - Error err = new AssertionFailedError("Unhandled event loop exception"); - err.initCause(e); - throw err; - } - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/synchronize/RSESynchronizeTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/synchronize/RSESynchronizeTest.java deleted file mode 100644 index 6a429a633..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/synchronize/RSESynchronizeTest.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Martin Oberhuber (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - Adapted from org.eclipse.rse.tests / FileServiceTest - *******************************************************************************/ -package org.eclipse.rse.tests.synchronize; - -import java.lang.reflect.Method; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.rse.internal.synchronize.SynchronizeData; -import org.eclipse.rse.internal.synchronize.provisional.ISynchronizeConnectionManager; -import org.eclipse.rse.internal.synchronize.provisional.ISynchronizer; -import org.eclipse.rse.internal.synchronize.provisional.SynchronizeConnectionManager; -import org.eclipse.rse.internal.synchronize.provisional.SynchronizeOperation; -import org.eclipse.rse.internal.synchronize.provisional.Synchronizer; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; - -public class RSESynchronizeTest extends SynchronizeTestBase { - - /** - * Constructor with specific test name. - * - * @param name test to execute - */ - public RSESynchronizeTest(String name) { - super(name); - } - - /** - * Constructor with connection type and specific test name. - * - * @param name test to execute - * @param propertiesFileName file with connection properties to use - */ - public RSESynchronizeTest(String name, String propertiesFileName) { - super(name, propertiesFileName); - } - - public static Test suite() { - String baseName = RSESynchronizeTest.class.getName(); - TestSuite suite = new TestSuite(baseName); - - // // Add a test suite for each connection type - // String[] connTypes = { "local", "ssh", "ftpWindows", "ftp", "linux", - // "windows" }; - String[] connTypes = { "local" }; - // String[] connTypes = { "ssh" }; - - for (int i = 0; i < connTypes.length; i++) { - String suiteName = connTypes[i] == null ? "EFS" : connTypes[i]; - String propFileName = connTypes[i] == null ? null : connTypes[i] + "Connection.properties"; - TestSuite subSuite = new TestSuite(baseName + "." + suiteName); - Method[] m = RSESynchronizeTest.class.getMethods(); - for (int j = 0; j < m.length; j++) { - String testName = m[j].getName(); - if (testName.startsWith("test")) { - subSuite.addTest(new RSESynchronizeTest(testName, propFileName)); - } - } - suite.addTest(subSuite); - } - return suite; - } - - public void testConnectDisconnect() throws Exception { - // -test-author-:MartinOberhuber - if (isTestDisabled()) - return; - - // Create a local test project with some files and folders in it - IProject project = getProject(getUniqueString()); - IResource[] resources = new IResource[] { project }; - ensureExistsInWorkspace(resources, true); - - ISynchronizeConnectionManager connection = new SynchronizeConnectionManager(); - assertTrue("1.1", !connection.isConnected(project)); - // FIXME not a good idea to throw TeamException here -- this is the only - // reason why I need to import org.eclipse.team.core here - connection.connect(project); - assertTrue("1.2", connection.isConnected(project)); - - connection.disconnect(project); - assertTrue("1.3", !connection.isConnected(project)); - - // What happens if a connected project is deleted? - ensureDoesNotExistInWorkspace(project); - assertTrue("2.1", !connection.isConnected(project)); - } - - - public void testExport() throws Exception { - // -test-author-:MartinOberhuber - if (isTestDisabled()) - return; - - // Create a local test project with some files and folders in it - IProject project = getProject(getUniqueString()); - IFolder folder = project.getFolder("folder"); - IFile file = project.getFile("file.txt"); - IFile subFile = folder.getFile("subfile.txt"); - IResource[] resources = new IResource[] { project, folder, file, subFile }; - ensureExistsInWorkspace(resources, true); - - // Initial export of test project to remote folder - SynchronizeData sd = new SynchronizeData(); - // //What to do here? - // sd.addChild(new SynchronizeDataNode()); - ISynchronizer synchronizer = new Synchronizer(sd); - synchronizer.run(new SynchronizeOperation()); - - // Check file files and folders exist on the remote - IRemoteFile rFolder = fss.getRemoteFileObject(remoteTempDir, "folder", getDefaultProgressMonitor()); - assertTrue("1.1", rFolder.exists()); - assertTrue("1.2", rFolder.isDirectory()); - IRemoteFile rFile = fss.getRemoteFileObject(remoteTempDir, "file.txt", getDefaultProgressMonitor()); - assertTrue("2.1", rFile.exists()); - assertTrue("2.2", rFile.isFile()); - IRemoteFile rSubFile = fss.getRemoteFileObject(rFolder, "subfile.txt", getDefaultProgressMonitor()); - assertTrue("3.1", rSubFile.exists()); - assertTrue("3.2", rSubFile.isFile()); - - // TODO: Check file contents, timestamp etc - - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/synchronize/SynchronizeTestBase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/synchronize/SynchronizeTestBase.java deleted file mode 100644 index 631224469..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/synchronize/SynchronizeTestBase.java +++ /dev/null @@ -1,223 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Martin Oberhuber (Wind River) - initial API and implementation - * Martin Oberhuber (Wind River) - Adapted from org.eclipse.rse.tests / FileServiceTest - * - Portions adapted from org.eclipse.core.tests.resources / ResourceTest - * - Portions adapted from org.eclipse.core.tests.harness / CoreTest - *******************************************************************************/ -package org.eclipse.rse.tests.synchronize; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; - -import org.eclipse.core.internal.utils.UniversalUniqueIdentifier; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; - -/** - * Base class for RSE Synchronization Tests. Contains utility methods copied - * from org.eclipse.core.resources.tests - */ -public class SynchronizeTestBase extends RSEBaseConnectionTestCase { - - private String fPropertiesFileName; - // For testing the test: verify methods on Local - public static String fDefaultPropertiesFile = "localConnection.properties"; - - protected IFileServiceSubSystem fss; - protected IFileService fs; - private IRemoteFile fHomeDirectory; - protected IRemoteFile remoteTempDir; - private String tempDirPath; - - /** - * Constructor with specific test name. - * - * @param name test to execute - */ - public SynchronizeTestBase(String name) { - this(name, fDefaultPropertiesFile); - } - - /** - * Constructor with connection type and specific test name. - * - * @param name test to execute - * @param propertiesFileName file with connection properties to use - */ - public SynchronizeTestBase(String name, String propertiesFileName) { - super(name); - fPropertiesFileName = propertiesFileName; - if (propertiesFileName != null) { - int idx = propertiesFileName.indexOf("Connection.properties"); - String targetName = propertiesFileName.substring(0, idx); - setTargetName(targetName); - } - } - - public void setUp() throws Exception { - super.setUp(); - IHost host = getHost(fPropertiesFileName); - fss = (IFileServiceSubSystem) RemoteFileUtility.getFileSubSystem(host); - fs = fss.getFileService(); - fss.checkIsConnected(getDefaultProgressMonitor()); - fHomeDirectory = fss.getRemoteFileObject(".", getDefaultProgressMonitor()); - remoteTempDir = fss.getRemoteFileObject(fHomeDirectory, "rsetest" + System.currentTimeMillis(), getDefaultProgressMonitor()); - fss.createFolder(remoteTempDir, getDefaultProgressMonitor()); - tempDirPath = remoteTempDir.getAbsolutePath(); - } - - public void tearDown() throws Exception { - fss.delete(remoteTempDir, getDefaultProgressMonitor()); - super.tearDown(); - } - - public boolean isWindows() { - return fss.getHost().getSystemType().isWindows(); - } - - public IProgressMonitor getMonitor() { - return getDefaultProgressMonitor(); - } - - public String getTempDirPath() { - return tempDirPath; - } - - // <Copied from org.eclipse.core.tests.harness / CoreTest> - /** - * Fails the test due to the given throwable. - */ - public static void fail(String message, Throwable e) { - // If the exception is a CoreException with a multistatus - // then print out the multistatus so we can see all the info. - if (e instanceof CoreException) { - IStatus status = ((CoreException) e).getStatus(); - //if the status does not have an exception, print the stack for this one - if (status.getException() == null) - e.printStackTrace(); - write(status, 0); - } else - e.printStackTrace(); - fail(message + ": " + e); - } - private static void write(IStatus status, int indent) { - PrintStream output = System.out; - indent(output, indent); - output.println("Severity: " + status.getSeverity()); - - indent(output, indent); - output.println("Plugin ID: " + status.getPlugin()); - - indent(output, indent); - output.println("Code: " + status.getCode()); - - indent(output, indent); - output.println("Message: " + status.getMessage()); - - if (status.getException() != null) { - indent(output, indent); - output.print("Exception: "); - status.getException().printStackTrace(output); - } - - if (status.isMultiStatus()) { - IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) - write(children[i], indent + 1); - } - } - private static void indent(OutputStream output, int indent) { - for (int i = 0; i < indent; i++) - try { - output.write("\t".getBytes()); - } catch (IOException e) { - // ignore - } - } - // </Copied from org.eclipse.core.tests.harness / CoreTest (Copyright (c) IBM)> - - // <Copied from org.eclipse.core.tests.resources / ResourceTest (Copyright (c) IBM)> - public String getUniqueString() { - return new UniversalUniqueIdentifier().toString(); - } - protected void create(final IResource resource, boolean local) throws CoreException { - if (resource == null || resource.exists()) - return; - if (!resource.getParent().exists()) - create(resource.getParent(), local); - switch (resource.getType()) { - case IResource.FILE : - ((IFile) resource).create(local ? new ByteArrayInputStream(new byte[0]) : null, true, getMonitor()); - break; - case IResource.FOLDER : - ((IFolder) resource).create(true, local, getMonitor()); - break; - case IResource.PROJECT : - ((IProject) resource).create(getMonitor()); - ((IProject) resource).open(getMonitor()); - break; - } - } - /** - * Create each element of the resource array in the workspace resource - * info tree. - */ - public void ensureExistsInWorkspace(final IResource[] resources, final boolean local) { - IWorkspaceRunnable body = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - for (int i = 0; i < resources.length; i++) - create(resources[i], local); - } - }; - try { - getWorkspace().run(body, null); - } catch (CoreException e) { - fail("#ensureExistsInWorkspace(IResource[])", e); - } - } - /** - * Delete the given resource from the workspace resource tree. - */ - public void ensureDoesNotExistInWorkspace(IResource resource) { - try { - if (resource.exists()) - resource.delete(true, null); - } catch (CoreException e) { - fail("#ensureDoesNotExistInWorkspace(IResource): " + resource.getFullPath(), e); - } - } - // </Copied from org.eclipse.core.tests.resources / ResourceTest> - - // <Copied from org.eclipse.core.tests.resources / ProjectPreferencesTest (Copyright (c) IBM)> - public static IWorkspace getWorkspace() { - return ResourcesPlugin.getWorkspace(); - } - protected static IProject getProject(String name) { - return getWorkspace().getRoot().getProject(name); - } - // </Copied from org.eclipse.core.tests.resources / ProjectPreferencesTest (Copyright (c) IBM)> - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/TestSubSystemAddAction.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/TestSubSystemAddAction.java deleted file mode 100644 index 9eb6bbe66..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/TestSubSystemAddAction.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.testsubsystem; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.rse.tests.RSETestsPlugin; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystem; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemAddTarget; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNode; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNodeContainer; -import org.eclipse.rse.ui.actions.SystemBaseAction; -import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; -import org.eclipse.swt.widgets.Shell; - -/** - * Add action for container nodes. - * This action can add branches or leafes. - */ -public class TestSubSystemAddAction extends SystemBaseAction { - - private boolean fAddContainer = false; - - /** - * Constructor. - * @param text The text of this action shwon in context menues. - * @param addContainer True if a container node should be added, - * False if a simple node should be added. - * @param shell The current shell. - */ - public TestSubSystemAddAction(String text, boolean addContainer, Shell shell) { - super(text, shell); - - fAddContainer = addContainer; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.Action#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return RSETestsPlugin.getDefault().getImageDescriptor(fAddContainer ? "ICON_ID_BRANCH" : "ICON_ID_LEAF"); //$NON-NLS-1$//$NON-NLS-2$ - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.actions.SystemBaseAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection) - */ - public boolean updateSelection(IStructuredSelection selection) { - return selection.size() == 1 && checkObjectType(selection.getFirstElement()); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.actions.SystemBaseAction#checkObjectType(java.lang.Object) - */ - public boolean checkObjectType(Object selectedObject) { - return selectedObject instanceof ITestSubSystemNodeContainer; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.actions.SystemBaseAction#run() - */ - public void run() { - IStructuredSelection selection = getSelection(); - Object object = selection.getFirstElement(); - ISystemRemoteElementAdapter adapter = getRemoteAdapter(object); - if (adapter != null && adapter instanceof ITestSubSystemAddTarget && object instanceof ITestSubSystemNodeContainer) { - ITestSubSystemAddTarget addTarget = (ITestSubSystemAddTarget)adapter; - ITestSubSystemNodeContainer container = (ITestSubSystemNodeContainer)object; - String name = ((object instanceof ITestSubSystem) ? "" : adapter.getName(container) + ":") + container.getChildNodeCount(); //$NON-NLS-1$ //$NON-NLS-2$ - ITestSubSystemNode node = fAddContainer ? new TestSubSystemContainerNode(name) : new TestSubSystemNode(name + ";"); //$NON-NLS-1$ - addTarget.doAdd(getShell(), container, node, null); - } - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/TestSubSystemContainerNode.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/TestSubSystemContainerNode.java deleted file mode 100644 index a7f7ae9d2..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/TestSubSystemContainerNode.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.testsubsystem; - -import java.util.ArrayList; - -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNode; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNodeContainer; - - -/** - * A simple container node (branch). - */ -public class TestSubSystemContainerNode extends TestSubSystemNode - implements ITestSubSystemNode, ITestSubSystemNodeContainer { - - private ArrayList fChildren = new ArrayList(); - - /** - * Constructor. - * @param name The name of the conatiner node shown in the tree. - */ - public TestSubSystemContainerNode(String name) { - super(name); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#addChildNode(org.eclipse.rse.tests.testsubsystem.ITestSubSystemNode) - */ - public boolean addChildNode(ITestSubSystemNode node) { - if (node != null && !fChildren.contains(node)) { - node.setSubSystem(getSubSystem()); - node.setParent(this); - fChildren.add(node); - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#removeChildNode(org.eclipse.rse.tests.testsubsystem.ITestSubSystemNode) - */ - public boolean removeChildNode(ITestSubSystemNode node) { - if (node != null && fChildren.contains(node)) { - if (node instanceof ITestSubSystemNodeContainer) { - ((ITestSubSystemNodeContainer)node).removeAllChildNodes(); - } - fChildren.remove(node); - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#removeAllChildNodes() - */ - public boolean removeAllChildNodes() { - if (!fChildren.isEmpty()) { - ITestSubSystemNode[] childs = getChildNodes(); - for (int i = 0; i < childs.length; i++) { - if (childs[i] instanceof ITestSubSystemNodeContainer) { - ((ITestSubSystemNodeContainer)childs[i]).removeAllChildNodes(); - } - } - fChildren.clear(); - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#hasChildNodes() - */ - public boolean hasChildNodes() { - return !fChildren.isEmpty(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#getChildNodeCount() - */ - public int getChildNodeCount() { - return fChildren.size(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNodeContainer#getChildNodes() - */ - public ITestSubSystemNode[] getChildNodes() { - return (ITestSubSystemNode[])fChildren.toArray(new ITestSubSystemNode[fChildren.size()]); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/TestSubSystemNode.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/TestSubSystemNode.java deleted file mode 100644 index 5aa445f42..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/TestSubSystemNode.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.testsubsystem; - -import org.eclipse.rse.core.subsystems.AbstractResource; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNode; - -/** - * A simple node (leaf). - */ -public class TestSubSystemNode extends AbstractResource - implements ITestSubSystemNode { - - private String fName; - private ITestSubSystemNode fParent; - - /** - * Constructor. - * @param name The name for this node shown in the tree. - */ - public TestSubSystemNode(String name) { - super(); - fName = name; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNode#getName() - */ - public String getName() { - return fName; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNode#setName(java.lang.String) - */ - public void setName(String name) { - fName = name; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNode#setParent(org.eclipse.rse.tests.testsubsystem.ITestSubSystemNode) - */ - public void setParent(ITestSubSystemNode parent) { - fParent = parent; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.testsubsystem.ITestSubSystemNode#getParent() - */ - public ITestSubSystemNode getParent() { - return fParent; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.AbstractResource#getSubSystem() - */ - public ISubSystem getSubSystem() { - ISubSystem subSystem = super.getSubSystem(); - if (subSystem == null && getParent() != null) { - subSystem = getParent().getSubSystem(); - } - return subSystem; - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystem.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystem.java deleted file mode 100644 index 574ca2c97..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystem.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.testsubsystem.interfaces; - -import org.eclipse.rse.core.subsystems.ISubSystem; - -/** - * Interface for the test subsystem. - */ -public interface ITestSubSystem extends ISubSystem, ITestSubSystemNodeContainer { - // only for internal use -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemAddTarget.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemAddTarget.java deleted file mode 100644 index 141f7f884..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemAddTarget.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.testsubsystem.interfaces; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.swt.widgets.Shell; - -/** - * Interface for UI parts that support add actions. - */ -public interface ITestSubSystemAddTarget { - - /** - * Returns true if add action should be shown for the element. - * @param element Element for which add should be shown. - * @return True if add should be shown. - */ - public boolean showAdd(Object element); - - /** - * Returns true if add action should be enabled for the element. - * @param element Element for which add should be enabled. - * @return True if add should be enabled. - */ - public boolean canAdd(Object element); - - /** - * Add action of the element. - * @param shell The current shell. - * @param container The container to wich the element should be added. - * @param element The element to add to the container. - * @param monitor The progressmonitor if needed during the add operation. - * @return True, if the element was added to the container. - */ - public boolean doAdd(Shell shell, Object container, Object element, IProgressMonitor monitor); -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemConfiguration.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemConfiguration.java deleted file mode 100644 index c016dd437..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemConfiguration.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.testsubsystem.interfaces; - -/** - * Interface for the test subsystem configuration. - */ -public interface ITestSubSystemConfiguration { - // only for internal use -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemNode.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemNode.java deleted file mode 100644 index e05c5d20e..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemNode.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.testsubsystem.interfaces; - -import org.eclipse.rse.core.subsystems.ISubSystem; - -/** - * Interface for all test subsystem nodes. - */ -public interface ITestSubSystemNode { - - /** - * Returns the name of this node shown in the tree. - * @return The name of the node. - */ - public String getName(); - - /** - * Set the name for this node. - * @param name The Name of this node. - */ - public void setName(String name); - - /** - * Set the subsystem this node belongs to. - * This value should be set automatically when adding this node to a subsystem or other node. - * @param subSystem The subsystem. - */ - public void setSubSystem(ISubSystem subSystem); - - /** - * Returns the subsystem this node belongs to. - * @return The subsystem. - */ - public ISubSystem getSubSystem(); - - /** - * Set the node container this node belongs to. - * This value should be set automatically when adding this node to a node container. - * @param parent The parent node container. - */ - public void setParent(ITestSubSystemNode parent); - - /** - * Returns the parent node this node belongs to. - * @return The parent node. - */ - public ITestSubSystemNode getParent(); -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemNodeContainer.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemNodeContainer.java deleted file mode 100644 index 7dd520b1b..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/testsubsystem/interfaces/ITestSubSystemNodeContainer.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tobias Schwarz (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.testsubsystem.interfaces; - -/** - * Interface for node container. - */ -public interface ITestSubSystemNodeContainer { - - /** - * Adds the node to the list of childs if not already in the list. - * @param node The node that should be added to the list of childs. - * @return True if the node was added. - */ - public boolean addChildNode(ITestSubSystemNode node); - - /** - * Removes the node from the list of childs. - * If the node is a node container, all children are removed recursively. - * @param node The node that should be removed from the list of childs. - * @return True if the node exists as a child and was removed. - */ - public boolean removeChildNode(ITestSubSystemNode node); - - /** - * Removes all children of this container. - * If a hild node is a node container, all children are removed recursively. - * @return True if children were removed. - */ - public boolean removeAllChildNodes(); - - /** - * Returns true if this container has children. - * @return True if this node has children. - */ - public boolean hasChildNodes(); - - /** - * Returns the number of children. - * @return The number of children. - */ - public int getChildNodeCount(); - - /** - * Returns an array of all children. - * @return Array of children. - */ - public ITestSubSystemNode[] getChildNodes(); -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestCase.java deleted file mode 100644 index 841e66df8..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestCase.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.ui.connectionwizard; - -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.rse.core.IRSECoreRegistry; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.tests.RSETestsPlugin; -import org.eclipse.rse.tests.core.RSECoreTestCase; -import org.eclipse.ui.PlatformUI; - -/** - * Tests the RSE new connection wizard functionality. - * - * This is a manual test! Users need to manually make some selections and close - * the dialog for the test to complete. Therefore this test cannot be run in - * unattended nightly builds. - * - * What testers should check: - * <ul> - * <li>On 1st wizard page, select a type and press next</li> - * <li>On 2nd page, selected type should be visible.</li> - * <li>Select type again on that page -- next should be enabled, press next</li> - * <li>Press back, select a different type, press next -- correct type should be - * shown</li> </li> For details, see - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=237816 - * - * @author uwe.stieber@windriver.com - */ -public class RSENewConnectionWizardTestCase extends RSECoreTestCase { - - /* Test restrictToSystemType functionality. See bug 237816 */ - public void testRestrictToSystemType() { - //-test-author-:UweStieber - if (!RSETestsPlugin.isTestCaseEnabled("RSENewConnectionWizardTestCase.testRestrictToSystemType")) return; //$NON-NLS-1$ - - IRSECoreRegistry coreRegistry = RSECorePlugin.getTheCoreRegistry(); - assertNotNull("Failed to fetch RSE core registry instance!", coreRegistry); //$NON-NLS-1$ - - // Construct the wizard - RSENewConnectionWizardTestWizard wizard = new RSENewConnectionWizardTestWizard(); - - WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard); - dialog.open(); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestSimpleWizardPage.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestSimpleWizardPage.java deleted file mode 100644 index a67e0d8e2..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestSimpleWizardPage.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation. - *******************************************************************************/ -package org.eclipse.rse.tests.ui.connectionwizard; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.rse.core.IRSECoreRegistry; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.ui.wizards.newconnection.RSEMainNewConnectionWizard; -import org.eclipse.rse.ui.wizards.newconnection.RSENewConnectionWizardRegistry; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.List; - -/** - * Simple wizard page listing the available system types in a simple text list. - * - * @author uwe.stieber@windriver.com - */ -public class RSENewConnectionWizardTestSimpleWizardPage extends WizardPage { - private List fList; - private IRSESystemType[] fSystemTypes; - RSEMainNewConnectionWizard fMainWizard; - /** - * Constructor. - * - * @param wizardRegistry The wizard registry to use. Must not be <code>null</code> - * @param pageName the name of the page - */ - public RSENewConnectionWizardTestSimpleWizardPage(RSENewConnectionWizardRegistry wizardRegistry, String pageName) { - super(pageName); - assert wizardRegistry != null; - } - - /** - * Constructor. - * - * @param wizardRegistry The wizard registry to use. Must not be <code>null</code> - * @param pageName the name of the page - * @param title the title for this wizard page, - * or <code>null</code> if none - * @param titleImage the image descriptor for the title of this wizard page, - * or <code>null</code> if none - */ - public RSENewConnectionWizardTestSimpleWizardPage(RSENewConnectionWizardRegistry wizardRegistry, String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - assert wizardRegistry != null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.DialogPage#dispose() - */ - public void dispose() { - fSystemTypes = null; - - fList = null; - - if (fMainWizard != null) { fMainWizard.dispose(); fMainWizard = null; } - - super.dispose(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - setControl(composite); - - fList = new List(composite, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL); - fList.setLayoutData(new GridData(GridData.FILL_BOTH)); - - IRSECoreRegistry coreRegistry = RSECorePlugin.getTheCoreRegistry(); - fSystemTypes = coreRegistry.getSystemTypes(); - for (int i = 0; i < fSystemTypes.length; i++) { - fList.add(fSystemTypes[i].getLabel()); - } - - fList.addSelectionListener(new SelectionAdapter() { - /* (non-Javadoc) - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) { - // Update the main wizard if already created - if (fMainWizard != null && getSelectedSystemType() != null) fMainWizard.restrictToSystemType(getSelectedSystemType()); - setPageComplete(getSelectedSystemType() != null); - } - }); - - setPageComplete(false); - } - - /** - * Returns the selected system type instance. This method will - * return <code>null</code> if the page hasn't been visible yet or - * got already disposed. - * - * @return The selected RSE system type instance or <code>null</code>. - */ - public IRSESystemType getSelectedSystemType() { - if (fList != null && !fList.isDisposed() && fList.getSelectionIndex() != -1) { - return fSystemTypes[fList.getSelectionIndex()]; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage() - */ - public boolean canFlipToNextPage() { - return super.canFlipToNextPage() && (fList != null && !fList.isDisposed() && fList.getSelectionIndex() != -1); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.wizard.WizardPage#getNextPage() - */ - public IWizardPage getNextPage() { - if (fMainWizard == null) { - // Create a new instance - fMainWizard = new RSEMainNewConnectionWizard(); - // Create the pages - fMainWizard.addPages(); - // Restrict the wizard to the selected system type - if (getSelectedSystemType() != null) fMainWizard.restrictToSystemType(getSelectedSystemType()); - } - return fMainWizard.getStartingPage(); - } -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestSuite.java deleted file mode 100644 index 59860ff15..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestSuite.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation. - *******************************************************************************/ -package org.eclipse.rse.tests.ui.connectionwizard; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -public class RSENewConnectionWizardTestSuite extends DelegatingTestSuiteHolder { - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE New Connection Wizard Test Suite"); //$NON-NLS-1$ - // add the single test suites to the overall one here. - //Attention: MANUAL testcase below! Not for unattended nightly builds! - suite.addTestSuite(RSENewConnectionWizardTestCase.class); - - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)RSENewConnectionWizardTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestWizard.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestWizard.java deleted file mode 100644 index 3c9401eba..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/connectionwizard/RSENewConnectionWizardTestWizard.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Uwe Stieber (Wind River) - initial API and implementation - *******************************************************************************/ - -package org.eclipse.rse.tests.ui.connectionwizard; - -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.rse.ui.wizards.newconnection.RSENewConnectionWizardRegistry; - -/** - * Simple test wizard implementation. - * - * @author uwe.stieber@windriver.com - */ -public class RSENewConnectionWizardTestWizard extends Wizard { - private final RSENewConnectionWizardRegistry fWizardRegisty; - - /** - * Constructor. - * - */ - public RSENewConnectionWizardTestWizard() { - super(); - - fWizardRegisty = new RSENewConnectionWizardRegistry(); - - setNeedsProgressMonitor(false); - setForcePreviousAndNextButtons(true); - } - - /** - * Returns the RSE new connection wizard registry instance. - * - * @return The new connection wizard registry. - */ - public RSENewConnectionWizardRegistry getWizardRegistry() { - return fWizardRegisty; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ - public void addPages() { - addPage(new RSENewConnectionWizardTestSimpleWizardPage(getWizardRegistry(), "Simple Selection Page")); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.jface.wizard.Wizard#performFinish() - */ - public boolean performFinish() { - return true; - } - - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/mnemonics/MnemonicsTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/mnemonics/MnemonicsTest.java deleted file mode 100644 index ae4d3d4f1..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/mnemonics/MnemonicsTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation. - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - ********************************************************************************/ - -package org.eclipse.rse.tests.ui.mnemonics; - -import org.eclipse.rse.tests.core.RSECoreTestCase; -import org.eclipse.rse.ui.Mnemonics; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemPreferencesManager; - -/** - * Tests for {@link SystemPreferencesManager}. - * Test various aspects of mnemonic generation and assignment. - */ -public class MnemonicsTest extends RSECoreTestCase { - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testDefaultGeneration() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - Mnemonics mn = new Mnemonics(); - mn.clear("abcde"); - String result = mn.setUniqueMnemonic("A..."); - assertEquals("A...", result); - result = mn.setUniqueMnemonic("F..."); - assertEquals("&F...", result); - } - - public void testAppendPolicies() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - setLocalePattern(".*"); // match all locales - Mnemonics mn = new Mnemonics(); - mn.clear("abcde"); - String result = mn.setUniqueMnemonic("A..."); - assertEquals("A(&F)...", result); - result = mn.setUniqueMnemonic("F..."); - assertEquals("F(&G)...", result); - result = mn.setUniqueMnemonic("H..."); - assertEquals("&H...", result); - } - - private void setLocalePattern(String pattern) { - RSEUIPlugin.getDefault().getPluginPreferences().setValue(Mnemonics.APPEND_MNEMONICS_PATTERN_PREFERENCE, pattern); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/mnemonics/MnemonicsTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/mnemonics/MnemonicsTestSuite.java deleted file mode 100644 index 89dc526c4..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/mnemonics/MnemonicsTestSuite.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation, and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.ui.mnemonics; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -public class MnemonicsTestSuite extends DelegatingTestSuiteHolder { - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("RSE Mnemonics Test Suite"); //$NON-NLS-1$ - suite.addTestSuite(MnemonicsTest.class); - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)MnemonicsTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTest.java deleted file mode 100644 index 1c36f304e..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation. - * Martin Oberhuber (Wind River) - organize, enable and tag test cases - ********************************************************************************/ - -package org.eclipse.rse.tests.ui.preferences; - -import org.eclipse.core.runtime.Preferences; -import org.eclipse.rse.tests.core.RSECoreTestCase; -import org.eclipse.rse.ui.ISystemPreferencesConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemPreferencesManager; - -/** - * Tests for {@link SystemPreferencesManager}. - * Test various aspects of mnemonic generation and assignment. - */ -public class PreferencesTest extends RSECoreTestCase { - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testShowLists() { - //-test-author-:DavidDykstal - if (isTestDisabled()) - return; - Preferences store = RSEUIPlugin.getDefault().getPluginPreferences(); - boolean showLists = store.getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS); - assertTrue(showLists); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTestSuite.java deleted file mode 100644 index f8abeb8b9..000000000 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTestSuite.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation - *******************************************************************************/ -package org.eclipse.rse.tests.ui.preferences; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder; - -public class PreferencesTestSuite extends DelegatingTestSuiteHolder { - /** - * Standard Java application main method. Allows to launch the test - * suite from outside as part of nightly runs, headless runs or other. - * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as - * it is explicitly supposed to output the test output to the shell the - * test suite has been launched from. - * <p> - * @param args The standard Java application command line parameters passed in. - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - - /** - * Combine all test into a suite and returns the test suite instance. - * <p> - * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise - * the JUnit plug-in test launcher will fail to detect this class!</b> - * <p> - * @return The test suite instance. - */ - public static Test suite() { - TestSuite suite = new TestSuite("UI Preferences Test Suite"); //$NON-NLS-1$ - suite.addTestSuite(PreferencesTest.class); - return suite; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() - */ - public TestSuite getTestSuite() { - return (TestSuite)PreferencesTestSuite.suite(); - } - -} diff --git a/rse/tests/org.eclipse.rse.tests/teamConfig/RSE Combined Test Suite.launch b/rse/tests/org.eclipse.rse.tests/teamConfig/RSE Combined Test Suite.launch deleted file mode 100644 index 0035a2abb..000000000 --- a/rse/tests/org.eclipse.rse.tests/teamConfig/RSE Combined Test Suite.launch +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig"> -<booleanAttribute key="askclear" value="false"/> -<booleanAttribute key="automaticAdd" value="true"/> -<booleanAttribute key="automaticValidate" value="false"/> -<stringAttribute key="bootstrap" value=""/> -<stringAttribute key="checked" value="org.eclipse.ui.workbench"/> -<booleanAttribute key="clearConfig" value="true"/> -<booleanAttribute key="clearws" value="true"/> -<booleanAttribute key="clearwslog" value="false"/> -<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/> -<booleanAttribute key="default" value="true"/> -<booleanAttribute key="includeOptional" value="true"/> -<stringAttribute key="location" value="${workspace_loc}/../junit-test-workspace"/> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> -<listEntry value="/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSECombinedTestSuite.java"/> -</listAttribute> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> -<listEntry value="1"/> -</listAttribute> -<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> -<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/> -<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> -<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> -<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/> -<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.rse.tests.RSECombinedTestSuite"/> -<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -debug -clean -consoleLog"/> -<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.rse.tests"/> -<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -esa -Dcom.sun.management.jmxremote"/> -<stringAttribute key="pde.version" value="3.3"/> -<stringAttribute key="product" value="org.eclipse.sdk.ide"/> -<booleanAttribute key="show_selected_only" value="false"/> -<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/> -<booleanAttribute key="tracing" value="false"/> -<mapAttribute key="tracingOptions"> -<mapEntry key="org.eclipse.ui.workbench/debug" value="true"/> -</mapAttribute> -<booleanAttribute key="useDefaultConfig" value="true"/> -<booleanAttribute key="useDefaultConfigArea" value="false"/> -<booleanAttribute key="useProduct" value="true"/> -</launchConfiguration> diff --git a/rse/tests/org.eclipse.rse.tests/test.data/connectionDefault.properties b/rse/tests/org.eclipse.rse.tests/test.data/connectionDefault.properties deleted file mode 100644 index 9b273a710..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/connectionDefault.properties +++ /dev/null @@ -1,36 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -# Uwe Stieber (Wind River) - refactoring and cleanup. -# Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType -############################################################################### - -# The default RSE host node label/name -name = Local - -# The default RSE profile name to store the connection to. If not set, -# the default system profile is used. -# Default: not set. Uncomment to set! -#profile_name = myprofilename - -# The default test connection system type if not explicitly -# specified different (possible values: Unix, Linux, Local, Windows, SSH Only, FTP Only) -#system_type = Local -system_type_id = org.eclipse.rse.systemtype.local - -# The default remote system ip address or dns name. -address = localhost - -# The default user id to use for connecting to the remote system -# Default: not set. Uncomment to set! -#userid = myuserid - -# The default users password to use for connecting to the remote system -# Default: not set. Uncomment to set! -#password = mypassword diff --git a/rse/tests/org.eclipse.rse.tests/test.data/ftpConnection.properties b/rse/tests/org.eclipse.rse.tests/test.data/ftpConnection.properties deleted file mode 100644 index 23cb2e200..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/ftpConnection.properties +++ /dev/null @@ -1,28 +0,0 @@ -############################################################################### -# Copyright (c) 2008 IBM Corporation and others. All rights reserved. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - -# name/label for this ftp connection -name = test_ftp_only - -# profile name this connection should be created for -profile_name = junit_test_profile - -# FTP system ID -system_type_id = org.eclipse.rse.systemtype.ftp - -# Address of ftp connection -address = unknown - -# userid to connect to ftp connection -#userid = - -# password to connect to ftp connection -#password =
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/test.data/ftpSshConnection.properties b/rse/tests/org.eclipse.rse.tests/test.data/ftpSshConnection.properties deleted file mode 100644 index 9e62a720d..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/ftpSshConnection.properties +++ /dev/null @@ -1,28 +0,0 @@ -############################################################################### -# Copyright (c) 2009 Wind River Systems, Inc. others. All rights reserved. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Martin Oberhuber (Wind River) - initial API and implementation -############################################################################### - -# name/label for this ftp connection -name = test_ftp_with_ssh - -# profile name this connection should be created for -profile_name = junit_test_profile - -# FTP system ID -system_type_id = org.eclipse.rse.tests.systemType.ftpSsh - -# Address of ftp connection -address = unknown - -# userid to connect to ftp connection -userid = unknown - -# password to connect to ftp connection -password = unknown
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/test.data/ftpWindowsConnection.properties b/rse/tests/org.eclipse.rse.tests/test.data/ftpWindowsConnection.properties deleted file mode 100644 index 56a977805..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/ftpWindowsConnection.properties +++ /dev/null @@ -1,28 +0,0 @@ -############################################################################### -# Copyright (c) 2008 IBM Corporation and others. All rights reserved. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - -# name/label for this ftp connection -name = test_ftp_only_windows - -# profile name this connection should be created for -profile_name = junit_test_profile - -# FTP system ID -system_type_id = org.eclipse.rse.tests.systemType.ftp.windows - -# Address of ftp connection -address = 127.0.0.1 - -# userid to connect to ftp connection -userid = d - -# password to connect to ftp connection -password = d
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/test.data/linuxConnection.properties b/rse/tests/org.eclipse.rse.tests/test.data/linuxConnection.properties deleted file mode 100644 index cc22636db..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/linuxConnection.properties +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2009 IBM Corporation and others. All rights reserved. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -# Martin Oberhuber (Wind River) - Support REXEC launch type for dstore -############################################################################### - -# name/label for this linux connection -name = test_linux - -# profile name this connection should be created for -profile_name = junit_test_profile - -# Linux System ID -system_type_id = org.eclipse.rse.systemtype.linux - -# Address of windows connection -address = unknown - -# userid to connect to linux connection -userid = unknown - -# password to connect to linux connection -password = unknown - -# daemon port used for connecting to this linux connection -#daemon_port = - -# REXEC port used in case of REXEC server launcher -#rexec_port = - -# DStore launch type: one of Daemon, Rexec, Running, Telnet, SSH, FTP, HTTP -#launch_type = Rexec - -# Path to the dstore server.sh on the remote host (for REXEC) -#dstore_server_path = /folk/mober/RSETest/I20090806-1212/server-unix - -# Script to use for launching server.sh on the remote host (need to find a JVM!) -#dstore_server_script = sh ./server.sh diff --git a/rse/tests/org.eclipse.rse.tests/test.data/localConnection.properties b/rse/tests/org.eclipse.rse.tests/test.data/localConnection.properties deleted file mode 100644 index 6bcd75c4f..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/localConnection.properties +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################### -# Copyright (c) 2008 IBM Corporation and others. All rights reserved. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - -# name/label for this local connection -name = test_local - -# profile name this connection should be created for -profile_name = junit_test_profile - -# Local System ID -system_type_id = org.eclipse.rse.systemtype.local - -# Address of local system -address = localhost
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/test.data/sshConnection.properties b/rse/tests/org.eclipse.rse.tests/test.data/sshConnection.properties deleted file mode 100644 index 89b9f113d..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/sshConnection.properties +++ /dev/null @@ -1,28 +0,0 @@ -############################################################################### -# Copyright (c) 2008 IBM Corporation and others. All rights reserved. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - -# name/label for this windows connection -name = test_ssh_only - -# profile name this connection should be created for -profile_name = junit_test_profile - -# SSH system ID -system_type_id = org.eclipse.rse.systemtype.ssh - -# Address of ssh connection -address = unknown - -# userid to connect to ssh connection -#userid = - -# password to connect to ssh connection -#password =
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/test.data/sshTerminalConnection.properties b/rse/tests/org.eclipse.rse.tests/test.data/sshTerminalConnection.properties deleted file mode 100644 index 3208d4c66..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/sshTerminalConnection.properties +++ /dev/null @@ -1,28 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2009 IBM Corporation and others. All rights reserved. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - -# name/label for this windows connection -name = test_ssh_terminals_only - -# profile name this connection should be created for -profile_name = junit_test_profile - -# SSH system ID -system_type_id = org.eclipse.rse.tests.systemType.sshTerminal - -# Address of ssh connection -address = unknown - -# userid to connect to ssh connection -userid = unknown - -# password to connect to ssh connection -#password = diff --git a/rse/tests/org.eclipse.rse.tests/test.data/telnetConnection.properties b/rse/tests/org.eclipse.rse.tests/test.data/telnetConnection.properties deleted file mode 100644 index 603f669af..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/telnetConnection.properties +++ /dev/null @@ -1,28 +0,0 @@ -############################################################################### -# Copyright (c) 2008 IBM Corporation and others. All rights reserved. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - -# name/label for this windows connection -name = test_telnet_only - -# profile name this connection should be created for -profile_name = junit_test_profile - -# SSH system ID -system_type_id = org.eclipse.rse.systemtype.telnet - -# Address of ssh connection -address = unknown - -# userid to connect to ssh connection -#userid = - -# password to connect to ssh connection -#password = diff --git a/rse/tests/org.eclipse.rse.tests/test.data/testConnectionManager/connection.properties b/rse/tests/org.eclipse.rse.tests/test.data/testConnectionManager/connection.properties deleted file mode 100644 index b43a5f92d..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/testConnectionManager/connection.properties +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Uwe Stieber (Wind River) - initial contribution. -# Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType -############################################################################### - -# Do not change the properties within this file without changing -# the consuming unittest too! -name = test_windows -profile_name = junit_test_profile -#system_type = Windows -system_type_id = org.eclipse.rse.systemtype.windows -address = 128.0.0.1 -userid = test_user -password = test_passwd diff --git a/rse/tests/org.eclipse.rse.tests/test.data/testFTPReadAccessToRemoteHost/connection.properties b/rse/tests/org.eclipse.rse.tests/test.data/testFTPReadAccessToRemoteHost/connection.properties deleted file mode 100644 index 04c088fc5..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/testFTPReadAccessToRemoteHost/connection.properties +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Uwe Stieber (Wind River) - initial contribution. -# Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType -############################################################################### - -# Do not change the properties within this file without changing -# the consuming unittest too! -name = test_remote_ftp_only -profile_name = junit_test_profile -#system_type = FTP Only -system_type_id = org.eclipse.rse.systemtype.ftp -address = gd.tuwien.ac.at -userid = anonymous -password = rseunittest@eclipse.org diff --git a/rse/tests/org.eclipse.rse.tests/test.data/unixConnection.properties b/rse/tests/org.eclipse.rse.tests/test.data/unixConnection.properties deleted file mode 100644 index 35b20f5ce..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/unixConnection.properties +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2009 IBM Corporation and others. All rights reserved. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -# Martin Oberhuber (Wind River) - adapted from Linux -############################################################################### - -# name/label for this dstore-unix connection -name = test_unix - -# profile name this connection should be created for -profile_name = junit_test_profile - -# UNIX system ID -system_type_id = org.eclipse.rse.systemtype.unix - -# Address of unix connection -address = unknown - -# userid to connect to unix connection -userid = unknown - -# password to connect to unix connection -password = unknown - -# daemon port used for connecting to this unix connection -#daemon_port = - -# REXEC port used in case of REXEC server launcher -#rexec_port = - -# DStore launch type: one of Daemon, Rexec, Running, Telnet, SSH, FTP, HTTP -launch_type = Rexec - -# Path to the dstore server.sh on the remote host (for REXEC) -dstore_server_path = /folk/mober/RSETest/I20090806-1212/server-unix - -# Script to use for launching server.sh on the remote host (need to find a JVM!) -dstore_server_script = sh ./server.sh diff --git a/rse/tests/org.eclipse.rse.tests/test.data/windowsConnection.properties b/rse/tests/org.eclipse.rse.tests/test.data/windowsConnection.properties deleted file mode 100644 index 57cab23f0..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.data/windowsConnection.properties +++ /dev/null @@ -1,31 +0,0 @@ -############################################################################### -# Copyright (c) 2008 IBM Corporation and others. All rights reserved. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - -# name/label for this windows connection -name = test_windows - -# profile name this connection should be created for -profile_name = junit_test_profile - -# Windows system ID -system_type_id = org.eclipse.rse.systemtype.windows - -# Address of windows connection -address = unknown - -# userid to connect to windows connection -#userid = - -# password to connect to windows connection -#password = - -# daemon port used for connecting to this windows connection -#daemon_port =
\ No newline at end of file diff --git a/rse/tests/org.eclipse.rse.tests/test.xml b/rse/tests/org.eclipse.rse.tests/test.xml deleted file mode 100644 index c1abdb9c3..000000000 --- a/rse/tests/org.eclipse.rse.tests/test.xml +++ /dev/null @@ -1,100 +0,0 @@ -<?xml version="1.0"?> -
<!-- - Copyright (c) 2005, 2008 IBM Corporation and others. - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - which accompanies this distribution, and is available at - http://www.eclipse.org/legal/epl-v10.html - - Contributors: - IBM Corporation - initial API and implementation - --> - -<!-- -Run post build tests. -Not yet complete. -Needs to be updated and tested for org.eclipse.rse ---> - -<project name="testsuite" default="run" basedir="."> - <!-- The property ${eclipse-home} should be passed into this script --> - <!-- Set a meaningful default value for when it is not. --> - <property name="eclipse-home" value="${basedir}/../../"/> - - <!-- sets the properties eclipse-home, and library-file --> - <property name="plugin-name" value="org.eclipse.rse.tests"/> - <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/> - - <!-- This target holds all initialization code that needs to be done for --> - <!-- all tests that are to be run. Initialization for individual tests --> - <!-- should be done within the body of the suite target. --> - <target name="init"> - <tstamp/> - <delete> - <fileset dir="${eclipse-home}" includes="org.eclipse.rse.tests.*.xml"/> - </delete> - </target> - - <!-- This target defines the tests that need to be run. --> - <target name="suite"> - <property name="location" value="${eclipse-home}/rse_test_workspace"/> - <delete dir="${location}" quiet="true"/> - <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}"> - <property name="data-dir" value="${location}"/> - <property name="plugin-name" value="${plugin-name}"/> - <property name="classname" value="org.eclipse.rse.tests.RSECombinedTestSuite"/> - </ant> - - <!-- Commented out until source of problem found (not reusing same workspace dir) - <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}"> - <property name="data-dir" value="${session-folder}"/> - <property name="plugin-name" value="${plugin-name}"/> - <property name="classname" - value="org.eclipse.ui.tests.api.SessionRestoreTest"/> - </ant> - --> - - <!-- - <property name="sniff-folder" - value="${eclipse-home}/ui_sniff_folder"/> - <delete dir="${sniff-folder}" quiet="true"/> - <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}"> - <property name="data-dir" value="${sniff-folder}"/> - <property name="plugin-name" value="${plugin-name}"/> - <property name="classname" - value="org.eclipse.ui.tests.UiTestSuite"/> - - </ant> - - <property name="jface-sniff-folder" - value="${eclipse-home}/jface_sniff_folder"/> - <delete dir="${jface-sniff-folder}" quiet="true"/> - <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> - <property name="data-dir" value="${jface-sniff-folder}"/> - <property name="plugin-name" value="${plugin-name}"/> - <property name="classname" - value="org.eclipse.jface.tests.viewers.AllTests"/> - </ant> - --> - - </target> - - <!-- This target holds code to cleanup the testing environment after the tests --> - <!-- have been run. You can use this to delete temporary files that are created. --> - <target name="cleanup"> - </target> - - <!-- This target runs the test suite. Any actions that need to happen after all --> - <!-- the tests have been run should go here. --> - <target name="run" depends="init,suite,cleanup"> - <ant target="collect" antfile="${library-file}" dir="${eclipse-home}"> - <property name="includes" value="org.eclipse.rse.*.xml"/> - <property name="output-file" value="${plugin-name}.xml"/> - </ant> - </target> - - <!-- This target runs the performance test suites. --> - <target name="performance"> - </target> - -</project> |