diff --git a/de.fu_berlin.inf.dpp/.classpath b/.classpath similarity index 55% rename from de.fu_berlin.inf.dpp/.classpath rename to .classpath index 07069877be63678fbc4b34dbb1db04b75fd1dd9f..252e4836c1bd096cfefa19536f03984cab41ca28 100644 --- a/de.fu_berlin.inf.dpp/.classpath +++ b/.classpath @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> + <classpathentry exported="true" kind="lib" path="lib/smack.jar"/> + <classpathentry exported="true" kind="lib" path="lib/smackx.jar"/> + <classpathentry exported="true" kind="lib" path="lib/smackx-debug.jar"/> + <classpathentry exported="true" kind="lib" path="lib/smackx-jingle_3.5.0.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/> - <classpathentry kind="lib" path="lib/smack.jar" sourcepath="/Smack3Jingle/src"/> - <classpathentry kind="lib" path="lib/smackx.jar" sourcepath="/Smack3Jingle/src"/> - <classpathentry kind="lib" path="lib/smackx-debug.jar"/> - <classpathentry kind="lib" path="lib/smackx-jingle.jar"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/de.fu_berlin.inf.dpp/.project b/.project similarity index 100% rename from de.fu_berlin.inf.dpp/.project rename to .project diff --git a/de.fu_berlin.inf.dpp/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs similarity index 100% rename from de.fu_berlin.inf.dpp/.settings/org.eclipse.jdt.ui.prefs rename to .settings/org.eclipse.jdt.ui.prefs diff --git a/de.fu_berlin.inf.dpp/CHANGELOG b/CHANGELOG similarity index 100% rename from de.fu_berlin.inf.dpp/CHANGELOG rename to CHANGELOG diff --git a/de.fu_berlin.inf.dpp/DEV b/DEV similarity index 100% rename from de.fu_berlin.inf.dpp/DEV rename to DEV diff --git a/de.fu_berlin.inf.dpp/LICENSE b/LICENSE similarity index 100% rename from de.fu_berlin.inf.dpp/LICENSE rename to LICENSE diff --git a/de.fu_berlin.inf.dpp/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF similarity index 97% rename from de.fu_berlin.inf.dpp/META-INF/MANIFEST.MF rename to META-INF/MANIFEST.MF index e78f6db5ed46117381aa6f12c7e9e3efebcafaa7..4e92be4a1286440613d2b57e793672ddf47a436a 100644 --- a/de.fu_berlin.inf.dpp/META-INF/MANIFEST.MF +++ b/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Saros Plug-in Bundle-SymbolicName: de.fu_berlin.inf.dpp;singleton:=true -Bundle-Version: 1.0.6 +Bundle-Version: 1.0.7 Bundle-Activator: de.fu_berlin.inf.dpp.Saros Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, @@ -16,12 +16,13 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.ide Eclipse-AutoStart: true Bundle-ClassPath: bin/, + lib/log4j-1.2.15.jar, + ., + de.fu_berlin.inf.dpp_1.0.x.jar, lib/smack.jar, lib/smackx.jar, lib/smackx-debug.jar, - lib/smackx-jingle.jar, - lib/log4j-1.2.15.jar, - . + lib/smackx-jingle_3.5.0.jar Export-Package: com.jcraft.jzlib, de.fu_berlin.inf.dpp, de.fu_berlin.inf.dpp.activities, diff --git a/de.fu_berlin.inf.dpp/META-INF/smack-config.xml b/META-INF/smack-config.xml similarity index 100% rename from de.fu_berlin.inf.dpp/META-INF/smack-config.xml rename to META-INF/smack-config.xml diff --git a/de.fu_berlin.inf.dpp/META-INF/smack.providers b/META-INF/smack.providers similarity index 100% rename from de.fu_berlin.inf.dpp/META-INF/smack.providers rename to META-INF/smack.providers diff --git a/de.fu_berlin.inf.dpp/build.properties b/build.properties similarity index 69% rename from de.fu_berlin.inf.dpp/build.properties rename to build.properties index 58231ce73747a582ef67f6b5016c6a94f8ad672b..f637ce7532288a70a9d17a6d9f4e16cf2c64737a 100644 --- a/de.fu_berlin.inf.dpp/build.properties +++ b/build.properties @@ -4,12 +4,14 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ icons/,\ - lib/smack.jar,\ - lib/smackx-debug.jar,\ bin/,\ lib/log4j-1.2.15.jar,\ - lib/smackx-jingle.jar,\ - lib/smackx.jar + de.fu_berlin.inf.dpp_1.0.x.jar,\ + log4j.properties,\ + lib/smack.jar,\ + lib/smackx.jar,\ + lib/smackx-debug.jar,\ + lib/smackx-jingle_3.5.0.jar src.includes = icons/,\ src/,\ plugin.xml,\ @@ -17,6 +19,7 @@ src.includes = icons/,\ lib/smack.jar,\ lib/smackx-debug.jar,\ lib/smackx.jar,\ - LICENSE + LICENSE,\ + log4j.properties jars.compile.order = .,\ lib/log4j-1.2.15.jar diff --git a/de.fu_berlin.inf.dpp/build.xml b/build.xml similarity index 100% rename from de.fu_berlin.inf.dpp/build.xml rename to build.xml diff --git a/de.fu_berlin.inf.dpp/credits.txt b/credits.txt similarity index 100% rename from de.fu_berlin.inf.dpp/credits.txt rename to credits.txt diff --git a/de.fu_berlin.inf.dpp.ecg.feature/.project b/de.fu_berlin.inf.dpp.ecg.feature/.project deleted file mode 100644 index bc2ac8622b8cabeb1d48918bb51f087bddf88c39..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>SarosECG Feature</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> diff --git a/de.fu_berlin.inf.dpp.ecg.feature/build.properties b/de.fu_berlin.inf.dpp.ecg.feature/build.properties deleted file mode 100644 index 82ab19c62d182db3688b1af6e6f465a74265ac92..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg.feature/build.properties +++ /dev/null @@ -1 +0,0 @@ -bin.includes = feature.xml diff --git a/de.fu_berlin.inf.dpp.ecg.feature/build.xml b/de.fu_berlin.inf.dpp.ecg.feature/build.xml deleted file mode 100644 index 8275fcf3cf78c4ba75a3ed65f189134abc1b293f..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg.feature/build.xml +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="de.fu_berlin.inf.dpp.ecg.feature" default="build.update.jar" basedir="."> - - <target name="init"> - <property name="feature.temp.folder" value="${basedir}/feature.temp.folder"/> - <property name="feature.destination" value="${basedir}"/> - </target> - - <target name="all.plugins" depends="init"> - <ant antfile="build.xml" dir="../ECG" target="${target}"> - <property name="arch" value="x86"/> - <property name="os" value="win32"/> - <property name="ws" value="win32"/> - </ant> - </target> - <target name="all.features" depends="init"> - </target> - <target name="update.feature" depends="init"> - </target> - - <target name="all.children" depends="init,all.features,all.plugins,update.feature"> - </target> - - <target name="children" if="include.children"> - <antcall target="all.children"/> - </target> - - <target name="build.jars" depends="init" description="Build all the jars for the feature: de.fu_berlin.inf.dpp.ecg.feature."> - <antcall target="all.children"> - <param name="target" value="build.jars"/> - </antcall> - </target> - - <target name="build.sources" depends="init"> - <antcall target="all.children"> - <param name="target" value="build.sources"/> - </antcall> - </target> - - <target name="build.zips" depends="init"> - <antcall target="all.children"> - <param name="target" value="build.zips"/> - </antcall> - </target> - - <target name="build.update.jar" depends="init" description="Build the feature jar of: de.fu_berlin.inf.dpp.ecg.feature for an update site."> - <antcall target="all.children"> - <param name="target" value="build.update.jar"/> - </antcall> - <property name="feature.base" value="${feature.temp.folder}"/> - <delete dir="${feature.temp.folder}"/> - <mkdir dir="${feature.temp.folder}"/> - <antcall target="gather.bin.parts" inheritAll="false"> - <param name="arch" value="*"/> - <param name="ws" value="*"/> - <param name="nl" value="*"/> - <param name="os" value="*"/> - <param name="feature.base" value="${feature.temp.folder}"/> - </antcall> - <jar destfile="${feature.destination}/de.fu_berlin.inf.dpp.ecg.feature_0.7.0.jar" basedir="${feature.temp.folder}/features/de.fu_berlin.inf.dpp.ecg.feature_0.7.0"/> - <delete dir="${feature.temp.folder}"/> - </target> - - <target name="gather.bin.parts" depends="init" if="feature.base"> - <mkdir dir="${feature.base}/features/de.fu_berlin.inf.dpp.ecg.feature_0.7.0"/> - <antcall target="children"> - <param name="destination.temp.folder" value="${feature.base}/plugins"/> - <param name="target" value="gather.bin.parts"/> - </antcall> - <copy todir="${feature.base}/features/de.fu_berlin.inf.dpp.ecg.feature_0.7.0" failonerror="true" overwrite="false"> - <fileset dir="${basedir}" includes="feature.xml" /> - </copy> - <eclipse.idReplacer featureFilePath="${feature.base}/features/de.fu_berlin.inf.dpp.ecg.feature_0.7.0/feature.xml" selfVersion="0.7.0" featureIds="" pluginIds="de.fu_berlin.inf.dpp.ecg,0.6.0,"/> - <antcall target="rootFiles${os}_${ws}_${arch}"/> - </target> - <target name="rootFileswin32_win32_x86"> - </target> - <target name="rootFilesgroup_group_group"> - <antcall target="rootFileswin32_win32_x86"/> - </target> - - <target name="zip.distribution" depends="init" description="Create a zip containing all the plug-ins and features for the feature: de.fu_berlin.inf.dpp.ecg.feature."> - <delete dir="${feature.temp.folder}"/> - <mkdir dir="${feature.temp.folder}"/> - <antcall target="gather.bin.parts"> - <param name="arch" value="*"/> - <param name="ws" value="*"/> - <param name="nl" value="*"/> - <param name="include.children" value="true"/> - <param name="feature.base" value="${feature.temp.folder}"/> - <param name="os" value="*"/> - </antcall> - <zip destfile="${feature.destination}/de.fu_berlin.inf.dpp.ecg.feature_0.7.0.bin.dist.zip" basedir="${feature.temp.folder}" filesonly="false" whenempty="skip" update="false"/> - <delete dir="${feature.temp.folder}"/> - </target> - - <target name="zip.sources" depends="init"> - <delete dir="${feature.temp.folder}"/> - <mkdir dir="${feature.temp.folder}"/> - <antcall target="all.children"> - <param name="destination.temp.folder" value="${feature.temp.folder}/plugins/de.fu_berlin.inf.dpp.ecg.feature.source_0.7.0/src"/> - <param name="include.children" value="true"/> - <param name="target" value="gather.sources"/> - </antcall> - <zip destfile="${feature.destination}/de.fu_berlin.inf.dpp.ecg.feature_0.7.0.src.zip" basedir="${feature.temp.folder}" filesonly="true" whenempty="skip" update="false"/> - <delete dir="${feature.temp.folder}"/> - </target> - - <target name="zip.logs" depends="init"> - <delete dir="${feature.temp.folder}"/> - <mkdir dir="${feature.temp.folder}"/> - <antcall target="all.children" inheritAll="false"> - <param name="destination.temp.folder" value="${feature.temp.folder}/plugins"/> - <param name="include.children" value="true"/> - <param name="target" value="gather.logs"/> - </antcall> - <zip destfile="${feature.destination}/de.fu_berlin.inf.dpp.ecg.feature_0.7.0.log.zip" basedir="${feature.temp.folder}" filesonly="true" whenempty="skip" update="false"/> - <delete dir="${feature.temp.folder}"/> - </target> - - <target name="clean" depends="init" description="Clean the feature: de.fu_berlin.inf.dpp.ecg.feature of all the zips, jars and logs created."> - <delete file="${feature.destination}/de.fu_berlin.inf.dpp.ecg.feature_0.7.0.jar"/> - <delete file="${feature.destination}/de.fu_berlin.inf.dpp.ecg.feature_0.7.0.bin.dist.zip"/> - <delete file="${feature.destination}/de.fu_berlin.inf.dpp.ecg.feature_0.7.0.log.zip"/> - <delete file="${feature.destination}/de.fu_berlin.inf.dpp.ecg.feature_0.7.0.src.zip"/> - <delete dir="${feature.temp.folder}"/> - <antcall target="all.children"> - <param name="target" value="clean"/> - </antcall> - </target> - - <target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder."> - <eclipse.convertPath fileSystemPath="D:/Coding/Java/Saros/ECG Feature/" property="resourcePath"/> - <eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/> - <antcall target="all.children"> - <param name="target" value="refresh"/> - </antcall> - </target> - <target name="gather.sources"> - <antcall target="children"> - <param name="destination.temp.folder" value="${feature.temp.folder}/plugins/de.fu_berlin.inf.dpp.ecg.feature.source_0.7.0/src"/> - <param name="target" value="gather.sources"/> - </antcall> - </target> - - <target name="gather.logs" depends="init"> - <mkdir dir="${feature.temp.folder}"/> - <antcall target="all.children" inheritAll="false"> - <param name="destination.temp.folder" value="${feature.temp.folder}/plugins"/> - <param name="target" value="gather.logs"/> - </antcall> - </target> - -</project> diff --git a/de.fu_berlin.inf.dpp.ecg.feature/feature.xml b/de.fu_berlin.inf.dpp.ecg.feature/feature.xml deleted file mode 100644 index bb57df314f20f07f3aa1197ea7c1590a6babec77..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg.feature/feature.xml +++ /dev/null @@ -1,475 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="de.fu_berlin.inf.dpp.ecg.feature" - label="SarosECG Feature" - version="0.8.1"> - - <description> - ECG-Sensor for Saros-related micro activities. - </description> - - <copyright url="http://www.example.com/copyright"> - Riad Djemili & Freie Universität Berlin, Germany - </copyright> - - <license url="http://www.example.com/license"> - GNU GENERAL PUBLIC LICENSE -Version 2, June 1991 -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -Preamble -The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General -Public -License is intended to guarantee your freedom to share and change -free -software--to make sure the software is free for all its users. -This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors -commit to -using it. (Some other Free Software Foundation software is covered -by -the GNU Library General Public License instead.) You can apply -it to -your programs, too. -When we speak of free software, we are referring to freedom, -not -price. Our General Public Licenses are designed to make sure -that you -have the freedom to distribute copies of free software (and charge -for -this service if you wish), that you receive source code or can -get it -if you want it, that you can change the software or use pieces -of it -in new free programs; and that you know you can do these things. -To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the -rights. -These restrictions translate to certain responsibilities for -you if you -distribute copies of the software, or if you modify it. -For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights -that -you have. You must make sure that they, too, receive or can -get the -source code. And you must show them these terms so they know -their -rights. -We protect your rights with two steps: (1) copyright the software, -and -(2) offer you this license which gives you legal permission to -copy, -distribute and/or modify the software. -Also, for each author's protection and ours, we want to make -certain -that everyone understands that there is no warranty for this -free -software. If the software is modified by someone else and passed -on, we -want its recipients to know that what they have is not the original, -so -that any problems introduced by others will not reflect on the -original -authors' reputations. -Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of -a free -program will individually obtain patent licenses, in effect making -the -program proprietary. To prevent this, we have made it clear -that any -patent must be licensed for everyone's free use or not licensed -at all. -The precise terms and conditions for copying, distribution and -modification follow. -GNU GENERAL PUBLIC LICENSE -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", -below, -refers to any such program or work, and a "work based on the -Program" -means either the Program or any derivative work under copyright -law: -that is to say, a work containing the Program or a portion of -it, -either verbatim or with modifications and/or translated into -another -language. (Hereinafter, translation is included without limitation -in -the term "modification".) Each licensee is addressed as "you". -Activities other than copying, distribution and modification -are not -covered by this License; they are outside its scope. The act -of -running the Program is not restricted, and the output from the -Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. -1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all -the -notices that refer to this License and to the absence of any -warranty; -and give any other recipients of the Program a copy of this License -along with the Program. -You may charge a fee for the physical act of transferring a copy, -and -you may at your option offer warranty protection in exchange -for a fee. -2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section -1 -above, provided that you also meet all of these conditions: -a) You must cause the modified files to carry prominent notices -stating that you changed the files and the date of any change. -b) You must cause any work that you distribute or publish, that -in -whole or in part contains or is derived from the Program or any -part thereof, to be licensed as a whole at no charge to all third -parties under the terms of this License. -c) If the modified program normally reads commands interactively -when run, you must cause it, when started running for such -interactive use in the most ordinary way, to print or display -an -announcement including an appropriate copyright notice and a -notice that there is no warranty (or else, saying that you provide -a warranty) and that users may redistribute the program under -these conditions, and telling the user how to view a copy of -this -License. (Exception: if the Program itself is interactive but -does not normally print such an announcement, your work based -on -the Program is not required to print an announcement.) -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works -in -themselves, then this License, and its terms, do not apply to -those -sections when you distribute them as separate works. But when -you -distribute the same sections as part of a whole which is a work -based -on the Program, the distribution of the whole must be on the -terms of -this License, whose permissions for other licensees extend to -the -entire whole, and thus to each and every part regardless of who -wrote it. -Thus, it is not the intent of this section to claim rights or -contest -your rights to work written entirely by you; rather, the intent -is to -exercise the right to control the distribution of derivative -or -collective works based on the Program. -In addition, mere aggregation of another work not based on the -Program -with the Program (or with a work based on the Program) on a volume -of -a storage or distribution medium does not bring the other work -under -the scope of this License. -3. You may copy and distribute the Program (or a work based on -it, -under Section 2) in object code or executable form under the -terms of -Sections 1 and 2 above provided that you also do one of the following: -a) Accompany it with the complete corresponding machine-readable -source code, which must be distributed under the terms of Sections -1 and 2 above on a medium customarily used for software interchange; -or, -b) Accompany it with a written offer, valid for at least three -years, to give any third party, for a charge no more than your -cost of physically performing source distribution, a complete -machine-readable copy of the corresponding source code, to be -distributed under the terms of Sections 1 and 2 above on a medium -customarily used for software interchange; or, -c) Accompany it with the information you received as to the offer -to distribute corresponding source code. (This alternative is -allowed only for noncommercial distribution and only if you -received the program in object code or executable form with such -an offer, in accord with Subsection b above.) -The source code for a work means the preferred form of the work -for -making modifications to it. For an executable work, complete -source -code means all the source code for all modules it contains, plus -any -associated interface definition files, plus the scripts used -to -control compilation and installation of the executable. However, -as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) -of the -operating system on which the executable runs, unless that component -itself accompanies the executable. -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are -not -compelled to copy the source along with the object code. -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program -is -void, and will automatically terminate your rights under this -License. -However, parties who have received copies, or rights, from you -under -this License will not have their licenses terminated so long -as such -parties remain in full compliance. -5. You are not required to accept this License, since you have -not -signed it. However, nothing else grants you permission to modify -or -distribute the Program or its derivative works. These actions -are -prohibited by law if you do not accept this License. Therefore, -by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do -so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. -6. Each time you redistribute the Program (or any work based -on the -Program), the recipient automatically receives a license from -the -original licensor to copy, distribute or modify the Program subject -to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted -herein. -You are not responsible for enforcing compliance by third parties -to -this License. -7. If, as a consequence of a court judgment or allegation of -patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement -or -otherwise) that contradict the conditions of this License, they -do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under -this -License and any other pertinent obligations, then as a consequence -you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program -by -all those who receive copies directly or indirectly through you, -then -the only way you could satisfy both it and this License would -be to -refrain entirely from distribution of the Program. -If any portion of this section is held invalid or unenforceable -under -any particular circumstance, the balance of the section is intended -to -apply and the section as a whole is intended to apply in other -circumstances. -It is not the purpose of this section to induce you to infringe -any -patents or other property right claims or to contest validity -of any -such claims; this section has the sole purpose of protecting -the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of -that -system; it is up to the author/donor to decide if he or she is -willing -to distribute software through any other system and a licensee -cannot -impose that choice. -This section is intended to make thoroughly clear what is believed -to -be a consequence of the rest of this License. -8. If the distribution and/or use of the Program is restricted -in -certain countries either by patents or by copyrighted interfaces, -the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or -among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. -9. The Free Software Foundation may publish revised and/or new -versions -of the General Public License from time to time. Such new versions -will -be similar in spirit to the present version, but may differ in -detail to -address new problems or concerns. -Each version is given a distinguishing version number. If the -Program -specifies a version number of this License which applies to it -and "any -later version", you have the option of following the terms and -conditions -either of that version or of any later version published by the -Free -Software Foundation. If the Program does not specify a version -number of -this License, you may choose any version ever published by the -Free Software -Foundation. -10. If you wish to incorporate parts of the Program into other -free -programs whose distribution conditions are different, write to -the author -to ask for permission. For software which is copyrighted by -the Free -Software Foundation, write to the Free Software Foundation; we -sometimes -make exceptions for this. Our decision will be guided by the -two goals -of preserving the free status of all derivatives of our free -software and -of promoting the sharing and reuse of software generally. -NO WARRANTY -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS -NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE -RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD -THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY -SERVICING, -REPAIR OR CORRECTION. -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO -IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES -ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT -NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED -BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH -ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED -OF THE -POSSIBILITY OF SUCH DAMAGES. -END OF TERMS AND CONDITIONS -How to Apply These Terms to Your New Programs -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to -make it -free software which everyone can redistribute and change under -these terms. -To do so, attach the following notices to the program. It is -safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at -least -the "copyright" line and a pointer to where the full notice is -found. -<one line to give the program's name and a brief idea of what -it does.> -Copyright (C) <year> <name of author> -This program is free software; you can redistribute it and/or -modify -it under the terms of the GNU General Public License as published -by -the Free Software Foundation; either version 2 of the License, -or -(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -USA -Also add information on how to contact you by electronic and -paper mail. -If the program is interactive, make it output a short notice -like this -when it starts in an interactive mode: -Gnomovision version 69, Copyright (C) year name of author -Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type -`show w'. -This is free software, and you are welcome to redistribute it -under certain conditions; type `show c' for details. -The hypothetical commands `show w' and `show c' should show the -appropriate -parts of the General Public License. Of course, the commands -you use may -be called something other than `show w' and `show c'; they could -even be -mouse-clicks or menu items--whatever suits your program. -You should also get your employer (if you work as a programmer) -or your -school, if any, to sign a "copyright disclaimer" for the program, -if -necessary. Here is a sample; alter the names: -Yoyodyne, Inc., hereby disclaims all copyright interest in the -program -`Gnomovision' (which makes passes at compilers) written by James -Hacker. -<signature of Ty Coon>, 1 April 1989 -Ty Coon, President of Vice -This General Public License does not permit incorporating your -program into -proprietary programs. If your program is a subroutine library, -you may -consider it more useful to permit linking proprietary applications -with the -library. If this is what you want to do, use the GNU Library -General -Public License instead of this License. - </license> - - <url> - <update label="http://riad.de/thesis/update/" url="http://riad.de/thesis/update/"/> - </url> - - <requires> - <import plugin="de.fu_berlin.inf.dpp"/> - <import plugin="org.electrocodeogram.sensor.eclipse"/> - <import plugin="org.eclipse.ui"/> - <import plugin="org.eclipse.core.runtime"/> - <import plugin="org.eclipse.core.resources"/> - </requires> - - <plugin - id="de.fu_berlin.inf.dpp.ecg" - download-size="0" - install-size="0" - version="0.8.1" - unpack="false"/> - -</feature> diff --git a/de.fu_berlin.inf.dpp.ecg/.classpath b/de.fu_berlin.inf.dpp.ecg/.classpath deleted file mode 100644 index 02159672985953c1c52ca50277e7bb40c98ea757..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/.classpath +++ /dev/null @@ -1,7 +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"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/de.fu_berlin.inf.dpp.ecg/.project b/de.fu_berlin.inf.dpp.ecg/.project deleted file mode 100644 index 26e06cf171aeb1a77efa6f288b71f576f3b7d956..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>SarosECG</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/de.fu_berlin.inf.dpp.ecg/META-INF/MANIFEST.MF b/de.fu_berlin.inf.dpp.ecg/META-INF/MANIFEST.MF deleted file mode 100644 index 4f1d6fbdf1194ec82a6a3798dcfd7608a12a7faf..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/META-INF/MANIFEST.MF +++ /dev/null @@ -1,13 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Saros-ECG Plug-in -Bundle-SymbolicName: de.fu_berlin.inf.dpp.ecg; singleton:=true -Bundle-Version: 0.8.1 -Bundle-Activator: de.fu_berlin.inf.dpp.ecg.Activator -Bundle-Localization: plugin -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - de.fu_berlin.inf.dpp, - org.electrocodeogram.sensor.eclipse, - org.eclipse.core.resources -Eclipse-AutoStart: true diff --git a/de.fu_berlin.inf.dpp.ecg/build.properties b/de.fu_berlin.inf.dpp.ecg/build.properties deleted file mode 100644 index b94a58f458168e71aa46c5991b878a21151082a3..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - icons/,\ - bin/ diff --git a/de.fu_berlin.inf.dpp.ecg/build.xml b/de.fu_berlin.inf.dpp.ecg/build.xml deleted file mode 100644 index 91b3c5ccef1f370d217e4a9818ff987f891241bd..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/build.xml +++ /dev/null @@ -1,241 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="de.fu_berlin.inf.dpp.ecg" default="build.jars" basedir="."> - - <property name="basews" value="${ws}"/> - <property name="baseos" value="${os}"/> - <property name="basearch" value="${arch}"/> - <property name="basenl" value="${nl}"/> - - <!-- Compiler settings. --> - <property name="javacFailOnError" value="false"/> - <property name="javacDebugInfo" value="on"/> - <property name="javacVerbose" value="false"/> - <property name="logExtension" value=".log"/> - <property name="compilerArg" value=""/> - <property name="javacSource" value="1.3"/> - <property name="javacTarget" value="1.2"/> - <path id="path_bootclasspath"> - <fileset dir="${java.home}/lib"> - <include name="*.jar"/> - </fileset> - </path> - <property name="bootclasspath" refid="path_bootclasspath"/> - <property name="bundleJavacSource" value="${javacSource}"/> - <property name="bundleJavacTarget" value="${javacTarget}"/> - <property name="bundleBootClasspath" value="${bootclasspath}"/> - - <target name="init" depends="properties"> - <condition property="pluginTemp" value="${buildTempFolder}/plugins"> - <isset property="buildTempFolder"/> - </condition> - <property name="pluginTemp" value="${basedir}"/> - <condition property="build.result.folder" value="${pluginTemp}/ECG"> - <isset property="buildTempFolder"/> - </condition> - <property name="build.result.folder" value="${basedir}"/> - <property name="temp.folder" value="${basedir}/temp.folder"/> - <property name="plugin.destination" value="${basedir}"/> - </target> - - <target name="properties" if="eclipse.running"> - <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> - - </target> - - <target name="build.update.jar" depends="init" description="Build the plug-in: de.fu_berlin.inf.dpp.ecg for an update site."> - <delete dir="${temp.folder}"/> - <mkdir dir="${temp.folder}"/> - <antcall target="build.jars"/> - <antcall target="gather.bin.parts"> - <param name="destination.temp.folder" value="${temp.folder}/"/> - </antcall> - <zip destfile="${plugin.destination}/de.fu_berlin.inf.dpp.ecg_0.6.0.jar" basedir="${temp.folder}/de.fu_berlin.inf.dpp.ecg_0.6.0" filesonly="false" whenempty="skip" update="false"/> - <delete dir="${temp.folder}"/> - </target> - - <target name="@dot" depends="init" unless="@dot" description="Create jar: de.fu_berlin.inf.dpp.ecg @dot."> - <delete dir="${temp.folder}/@dot.bin"/> - <mkdir dir="${temp.folder}/@dot.bin"/> - <path id="@dot.classpath"> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui_3.2.0.I20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.runtime_3.2.0.v20060601b.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.osgi_3.2.0.v20060601.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.equinox.common_3.2.0.v20060601a.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.jobs_3.2.0.v20060601a.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060602/runtime_registry_compatibility.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060602/@dot"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.equinox.registry_3.2.0.v20060601.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.equinox.preferences_3.2.0.v20060601.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.contenttype_3.2.0.v20060601a.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.v20060601.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.swt_3.2.0.v3232l.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.swt.win32.win32.x86_3.2.0.v3232l.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jface_3.2.0.I20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.commands_3.2.0.I20060511-0800a.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.workbench_3.2.0.I20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.workbench.compatibility_3.2.0.I20060511-2000/@dot"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.workbench.compatibility_3.2.0.I20060511-2000/compatibility.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/com.ibm.icu_3.4.4.1.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.help_3.2.0.v20060518.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.expressions_3.2.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.resources_3.2.0.v20060601a.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.resources.compatibility_3.2.0.v20060601a.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.resources.win32_3.2.0.v20060601a.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.runtime.compatibility_3.1.100.v20060601a.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.update.configurator_3.2.0.v20060511.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ant.core_3.1.100.v20060531.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.variables_3.1.100.v20060517.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.filesystem_1.0.0.v20060601a.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.filesystem.win32.x86_1.0.0.v20060601a.jar"/> - <pathelement path="${build.result.folder}/../Plugin/bin"/> - <pathelement path="${build.result.folder}/../de.fu_berlin.inf.dpp/bin"/> - <pathelement path="${build.result.folder}/../Plugin/lib/smackx.jar"/> - <pathelement path="${build.result.folder}/../de.fu_berlin.inf.dpp/lib/smackx.jar"/> - <pathelement path="${build.result.folder}/../Plugin/lib/smackx-debug.jar"/> - <pathelement path="${build.result.folder}/../de.fu_berlin.inf.dpp/lib/smackx-debug.jar"/> - <pathelement path="${build.result.folder}/../Plugin/lib/smack.jar"/> - <pathelement path="${build.result.folder}/../de.fu_berlin.inf.dpp/lib/smack.jar"/> - <pathelement path="../Plugin/bin/"/> - <pathelement path="${build.result.folder}/../de.fu_berlin.inf.dpp/bin/"/> - <pathelement path="../Plugin/lib/smack.jar"/> - <pathelement path="../Plugin/lib/smackx.jar"/> - <pathelement path="../Plugin/lib/smackx-debug.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.ui_3.2.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.console_3.1.100.v20060518.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jface.text_3.2.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.text_3.2.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.workbench.texteditor_3.2.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.core_3.2.0.v_670.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.team.core_3.2.0.I200605181830.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.search_3.2.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.core.filebuffers_3.2.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.ide_3.2.0.I20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.win32_3.2.0.I20060511-2000.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.views_3.2.0.I20060511-2000.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.update.core_3.2.0.v20060602.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.update.core.win32_3.2.0.v20060511.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.update.ui_3.2.0.v20060601.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.forms_3.2.0.v20060530.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.debug.core_3.2.0.v20060601.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.debug.ui_3.2.0.v20060601.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.editors_3.2.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.launching_3.2.0.v20060525.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.debug_3.2.0.v20060601/jdi.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.debug_3.2.0.v20060601/jdimodel.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.debug_3.2.0.v20060601/tools.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.compare_3.2.0.v20060525.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.team.ui_3.2.0.I200606011710.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.navigator_3.2.0.I20060526-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.navigator.resources_3.2.0.I20060511-2000.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.views.properties.tabbed_3.2.0.I20060511-0800a.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ltk.core.refactoring_3.2.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ltk.ui.refactoring_3.2.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.core.manipulation_1.0.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt_3.2.0.v20060602-0010.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.intro_3.2.0.v20060601.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.apache.lucene_1.4.103.v20060601/lucene-1.4.3.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.apache.lucene_1.4.103.v20060601/parser.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.help.base_3.2.0.v20060601.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.help.appserver_3.1.100.v20060510b.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.ui.cheatsheets_3.2.0.v20060516.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.help.ui_3.2.0.v20060510b.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.debug.ui_3.2.0.v20060517.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.doc.isv_3.2.0.v20060602-1130.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.doc.user_3.2.0.v20060602-1130.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.junit_3.2.0.v20060602-0010/junitsupport.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.junit.runtime_3.2.0.v20060602-0010/junitruntime.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.junit_3.8.1/junit.jar"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.eclipse.jdt.source_3.2.0.v20060602-0010-F7snq0fulF-UQcP/@dot"/> - <pathelement path="C:/Dev/Eclipse/eclipse-3.2rc7/plugins/org.electrocodeogram.sensor.eclipse_1.1.2.jar"/> - </path> - <!-- compile the source code --> - <javac destdir="${temp.folder}/@dot.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}" > - <compilerarg line="${compilerArg}" compiler="${build.compiler}"/> - <classpath refid="@dot.classpath" /> - <src path="src/" /> - <compilerarg value="@${basedir}/javaCompiler...args" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/> - <compilerarg line="-log '${temp.folder}/@dot.bin${logExtension}'" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/> - </javac> - <!-- Copy necessary resources --> - <copy todir="${temp.folder}/@dot.bin" failonerror="true" overwrite="false"> - <fileset dir="src/" excludes="**/*.java, **/package.htm*" /> - </copy> - <mkdir dir="${build.result.folder}"/> - <copy todir="${build.result.folder}/@dot" failonerror="true" overwrite="false"> - <fileset dir="${temp.folder}/@dot.bin" /> - </copy> - <delete dir="${temp.folder}/@dot.bin"/> - </target> - - <target name="src.zip" depends="init" unless="src.zip"> - <mkdir dir="${build.result.folder}"/> - <zip destfile="${build.result.folder}/src.zip" filesonly="false" whenempty="skip" update="false"> - <fileset dir="src/" includes="**/*.java" /> - </zip> - </target> - - <target name="build.jars" depends="init" description="Build all the jars for the plug-in: de.fu_berlin.inf.dpp.ecg."> - <available property="@dot" file="${build.result.folder}/@dot"/> - <antcall target="@dot"/> - </target> - - <target name="build.sources" depends="init"> - <available property="src.zip" file="${build.result.folder}/src.zip"/> - <antcall target="src.zip"/> - </target> - - <target name="gather.bin.parts" depends="init" if="destination.temp.folder"> - <mkdir dir="${destination.temp.folder}/de.fu_berlin.inf.dpp.ecg_0.6.0"/> - <copy todir="${destination.temp.folder}/de.fu_berlin.inf.dpp.ecg_0.6.0" failonerror="true" overwrite="false"> - <fileset dir="${build.result.folder}/@dot" includes="**" /> - </copy> - <copy todir="${destination.temp.folder}/de.fu_berlin.inf.dpp.ecg_0.6.0" failonerror="true" overwrite="false"> - <fileset dir="${basedir}" includes="plugin.xml,META-INF/,icons/" /> - </copy> - </target> - - <target name="build.zips" depends="init"> - </target> - - <target name="gather.sources" depends="init" if="destination.temp.folder"> - <mkdir dir="${destination.temp.folder}/de.fu_berlin.inf.dpp.ecg_0.6.0"/> - <copy file="${build.result.folder}/src.zip" todir="${destination.temp.folder}/de.fu_berlin.inf.dpp.ecg_0.6.0" failonerror="false" overwrite="false"/> - </target> - - <target name="gather.logs" depends="init" if="destination.temp.folder"> - <mkdir dir="${destination.temp.folder}/de.fu_berlin.inf.dpp.ecg_0.6.0"/> - <copy file="${temp.folder}/@dot.bin${logExtension}" todir="${destination.temp.folder}/de.fu_berlin.inf.dpp.ecg_0.6.0" failonerror="false" overwrite="false"/> - </target> - - <target name="clean" depends="init" description="Clean the plug-in: de.fu_berlin.inf.dpp.ecg of all the zips, jars and logs created."> - <delete dir="${build.result.folder}/@dot"/> - <delete file="${build.result.folder}/src.zip"/> - <delete file="${plugin.destination}/de.fu_berlin.inf.dpp.ecg_0.6.0.jar"/> - <delete file="${plugin.destination}/de.fu_berlin.inf.dpp.ecg_0.6.0.zip"/> - <delete dir="${temp.folder}"/> - </target> - - <target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder."> - <eclipse.convertPath fileSystemPath="D:/Coding/Java/Saros/ECG" property="resourcePath"/> - <eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/> - </target> - - <target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: de.fu_berlin.inf.dpp.ecg."> - <delete dir="${temp.folder}"/> - <mkdir dir="${temp.folder}"/> - <antcall target="build.jars"/> - <antcall target="build.sources"/> - <antcall target="gather.bin.parts"> - <param name="destination.temp.folder" value="${temp.folder}/"/> - </antcall> - <antcall target="gather.sources"> - <param name="destination.temp.folder" value="${temp.folder}/"/> - </antcall> - <delete> - <fileset dir="${temp.folder}" includes="**/*.bin${logExtension}" /> - </delete> - <zip destfile="${plugin.destination}/de.fu_berlin.inf.dpp.ecg_0.6.0.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/> - <delete dir="${temp.folder}"/> - </target> - -</project> diff --git a/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppchat.xsd b/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppchat.xsd deleted file mode 100644 index 0ab54a165adf90e632c140ef04ceee125fb3d755..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppchat.xsd +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - -<xs:annotation> - <xs:documentation> - This XML schema defines the structure of the "ddpChat" - MicroSensorDataType. The instance documents, the XML documents - using this schema, are actual "ddpChat" MicroActivities. - </xs:documentation> -</xs:annotation> - -<xs:include schemaLocation="msdt.common.xsd"/> - -<xs:element name="microActivity"> - <xs:complexType> - <xs:sequence> - <xs:element name="commonData" type="commonDataType"/> - <xs:element name="dppChat"> - <xs:complexType> - <xs:sequence> - - <xs:element name="user" type="xs:string"/> - <xs:element name="message" type="xs:string"/> - - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> -</xs:element> -</xs:schema> \ No newline at end of file diff --git a/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppeditor.xsd b/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppeditor.xsd deleted file mode 100644 index f0d47d857b1c24939a7c11fd4343b95ad4ebef53..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppeditor.xsd +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - -<xs:annotation> - <xs:documentation> - This XML schema defines the structure of the "dppEditor" - MicroSensorDataType. The instance documents, the XML documents - using this schema, are actual "dppEditor" MicroActivities. - </xs:documentation> -</xs:annotation> - -<xs:include schemaLocation="msdt.common.xsd"/> - -<xs:element name="microActivity"> - <xs:complexType> - <xs:sequence> - <xs:element name="commonData" type="commonDataType"/> - <xs:element name="dppEditor"> - <xs:complexType> - <xs:sequence> - <xs:element name="activity"> - <xs:simpleType> - <xs:restriction base="xs:string"> - - <xs:annotation> - <xs:documentation> - The "activity" element of the "dppEditor" - MicroActivity can have one of the following values. - </xs:documentation> - </xs:annotation> - - <xs:enumeration value="activated"/> - <xs:enumeration value="closed"/> - <xs:enumeration value="followActivated"/> - <xs:enumeration value="followDeactivated"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="path" type="xs:string"/> - - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> -</xs:element> -</xs:schema> \ No newline at end of file diff --git a/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppparticipant.xsd b/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppparticipant.xsd deleted file mode 100644 index daea74e7a7f5da0c858c1c24260742a2d7f054b5..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppparticipant.xsd +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - -<xs:annotation> - <xs:documentation> - This XML schema defines the structure of the "dppParticipant" - MicroSensorDataType. The instance documents, the XML documents - using this schema, are actual "dppParticipant" MicroActivities. - </xs:documentation> -</xs:annotation> - -<xs:include schemaLocation="msdt.common.xsd"/> - -<xs:element name="microActivity"> - <xs:complexType> - <xs:sequence> - <xs:element name="commonData" type="commonDataType"/> - <xs:element name="dppParticipant"> - <xs:complexType> - <xs:sequence> - <xs:element name="activity"> - <xs:simpleType> - <xs:restriction base="xs:string"> - - <xs:annotation> - <xs:documentation> - The "activity" element of the "dppParticipant" - MicroActivity can have one of the following values. - </xs:documentation> - </xs:annotation> - - <xs:enumeration value="joined"/> - <xs:enumeration value="left"/> - <xs:enumeration value="driverChanged"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="user" type="xs:string"/> - - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> -</xs:element> -</xs:schema> \ No newline at end of file diff --git a/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppsession.xsd b/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppsession.xsd deleted file mode 100644 index 9076382a590696edc4d4beab0d31685424e3c0b4..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/msdt/msdt.dppsession.xsd +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - -<xs:annotation> - <xs:documentation> - This XML schema defines the structure of the "dppSession" - MicroSensorDataType. The instance documents, the XML documents - using this schema, are actual "dppSession" MicroActivities. - </xs:documentation> -</xs:annotation> - -<xs:include schemaLocation="msdt.common.xsd"/> - -<xs:element name="microActivity"> - <xs:complexType> - <xs:sequence> - <xs:element name="commonData" type="commonDataType"/> - <xs:element name="dppSession"> - <xs:complexType> - <xs:sequence> - <xs:element name="activity"> - <xs:simpleType> - <xs:restriction base="xs:string"> - - <xs:annotation> - <xs:documentation> - The "activity" element of the "dppSession" - MicroActivity can have one of the following values. - </xs:documentation> - </xs:annotation> - - <xs:enumeration value="started"/> - <xs:enumeration value="ended"/> - <xs:enumeration value="invited"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> -</xs:element> -</xs:schema> \ No newline at end of file diff --git a/de.fu_berlin.inf.dpp.ecg/plugin.xml b/de.fu_berlin.inf.dpp.ecg/plugin.xml deleted file mode 100644 index 89e3cedec0ff2bdbdb5054035feb1701e1e2652f..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/plugin.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> -<plugin> - <extension - point="org.eclipse.ui.startup"> - <startup class="de.fu_berlin.inf.dpp.ecg.Activator"/> - </extension> - - -</plugin> diff --git a/de.fu_berlin.inf.dpp.ecg/src/de/fu_berlin/inf/dpp/ecg/Activator.java b/de.fu_berlin.inf.dpp.ecg/src/de/fu_berlin/inf/dpp/ecg/Activator.java deleted file mode 100644 index 5a620cd1373fd8678cb4fb766f2cbbc185c8ad67..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/src/de/fu_berlin/inf/dpp/ecg/Activator.java +++ /dev/null @@ -1,69 +0,0 @@ -package de.fu_berlin.inf.dpp.ecg; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.IStartup; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin implements IStartup { - - // The plug-in ID - public static final String PLUGIN_ID = "de.fu_berlin.inf.dpp.ecg"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given - * plug-in relative path - * - * @param path the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IStartup#earlyStartup() - */ - public void earlyStartup() { - new SarosSensor(); - } -} diff --git a/de.fu_berlin.inf.dpp.ecg/src/de/fu_berlin/inf/dpp/ecg/SarosSensor.java b/de.fu_berlin.inf.dpp.ecg/src/de/fu_berlin/inf/dpp/ecg/SarosSensor.java deleted file mode 100644 index 5cd67687bad40bb09ea50f1c7bc28e33537cdd5d..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.ecg/src/de/fu_berlin/inf/dpp/ecg/SarosSensor.java +++ /dev/null @@ -1,178 +0,0 @@ -package de.fu_berlin.inf.dpp.ecg; - -import org.eclipse.core.runtime.IPath; -import org.electrocodeogram.sensor.eclipse.ECGEclipseSensor; - -import de.fu_berlin.inf.dpp.Saros; -import de.fu_berlin.inf.dpp.MessagingManager.IChatListener; -import de.fu_berlin.inf.dpp.editor.EditorManager; -import de.fu_berlin.inf.dpp.editor.ISharedEditorListener; -import de.fu_berlin.inf.dpp.invitation.IIncomingInvitationProcess; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.project.ISessionListener; -import de.fu_berlin.inf.dpp.project.ISharedProject; -import de.fu_berlin.inf.dpp.project.ISharedProjectListener; - -/** - * This sensor listens for all distributed pair programming related events. The - * supported events are: - * - * <ul> - * <li>Starting/ending dpp sessions</li> - * <li>Inviting/receiving invitations to dpp session</li> - * <li>Give driver role</li> - * <li>Activate/deactivate follow mode</li> - * <li>Sending/reciving instant messages</li> - * <li>User arrivales/departments</li> - * </ul> - * - * @author rdjemili - */ -public class SarosSensor implements ISessionListener, ISharedProjectListener, - IChatListener, ISharedEditorListener { - - private static final String MSDT_DPP_SESSION = "msdt.dppsession.xsd"; - private static final String MSDT_DPP_PARTICIPANT = "msdt.dppparticipant.xsd"; - private static final String MSDT_DPP_CHAT = "msdt.dppchat.xsd"; - private static final String MSDT_EDITOR = "msdt.dppeditor.xsd"; - - private ISharedProject sharedProject; - - public SarosSensor() { - Saros saros = Saros.getDefault(); - saros.getSessionManager().addSessionListener(this); - saros.getMessagingManager().addChatListener(this); - } - - /* (non-Javadoc) - * @see de.fu_berlin.inf.dpp.project.ISessionListener - */ - public void sessionStarted(ISharedProject session) { - sharedProject = session; - session.addListener(this); - EditorManager.getDefault().addSharedEditorListener(this); - - processSession("started"); - } - - /* (non-Javadoc) - * @see de.fu_berlin.inf.dpp.project.ISessionListener - */ - public void sessionEnded(ISharedProject session) { - processSession("ended"); - - sharedProject = null; - session.removeListener(this); - EditorManager.getDefault().removeSharedEditorListener(this); - } - - /* (non-Javadoc) - * @see de.fu_berlin.inf.dpp.project.ISessionListener - */ - public void invitationReceived(IIncomingInvitationProcess invitation) { - processSession("invited"); - } - - /* (non-Javadoc) - * @see de.fu_berlin.inf.dpp.project.ISharedProjectListener - */ - public void driverChanged(JID driver, boolean replicated) { - processParticipant("driverChanged", driver.toString()); - } - - /* (non-Javadoc) - * @see de.fu_berlin.inf.dpp.project.ISharedProjectListener - */ - public void userJoined(JID user) { - processParticipant("joined", user.toString()); - } - - /* (non-Javadoc) - * @see de.fu_berlin.inf.dpp.project.ISharedProjectListener - */ - public void userLeft(JID user) { - processParticipant("left", user.toString()); - } - - /* (non-Javadoc) - * @see de.fu_berlin.inf.dpp.MessagingManager.IChatListener - */ - public void chatMessageAdded(String sender, String message) { - processChat(sender, message); - } - - /* (non-Javadoc) - * @see de.fu_berlin.inf.dpp.editor.ISharedEditorListener - */ - public void followModeChanged(boolean enabled) { - String text = enabled ? "followActivated" : "followDeactivated"; - processEditor(text, null); - } - - /* (non-Javadoc) - * @see de.fu_berlin.inf.dpp.editor.ISharedEditorListener - */ - public void activeDriverEditorChanged(IPath path, boolean replicated) { - if (replicated) - processEditor("activated", path); - } - - /* (non-Javadoc) - * @see de.fu_berlin.inf.dpp.editor.ISharedEditorListener - */ - public void driverEditorRemoved(IPath path, boolean replicated) { - if (replicated) - processEditor("closed", path); - } - - public void driverEditorSaved(IPath path, boolean replicated) { - // ignore - } - - private void processEditor(String activity, IPath path) { - String xml = "<dppEditor><activity>"+activity+"</activity>" + - "<path>"+path+"</path></dppEditor>"; - process(MSDT_EDITOR, xml); - } - - private void processSession(String activity) { - String xml = "<dppSession><activity>"+activity+"</activity></dppSession>"; - process(MSDT_DPP_SESSION, xml); - } - - private void processParticipant(String activity, String user) { - String xml = "<dppParticipant><activity>"+activity+"</activity>" + - "<user>"+user+"</user></dppParticipant>"; - process(MSDT_DPP_PARTICIPANT, xml); - } - - private void processChat(String sender, String message) { - String xml = "<dppChat><user>"+sender+"</user>" + - "<message>"+message+"</message></dppChat>"; - process(MSDT_DPP_CHAT, xml); - } - - private void process(String namespace, String xml) { - ECGEclipseSensor.getInstance().processActivity(namespace, wrap(xml)); - } - - private String wrap(String text) { - String username = System.getenv("username"); - - String project = (sharedProject != null) ? - sharedProject.getProject().getName() : null; - - StringBuffer full = new StringBuffer(); - full.append("<?xml version=\"1.0\"?><microActivity>"); - full.append("<commonData><username>"); - full.append(username); - full.append("</username><projectname>"); - full.append(project); - full.append("</projectname></commonData>"); - - full.append(text); - - full.append("</microActivity>"); - return full.toString(); - } -} diff --git a/de.fu_berlin.inf.dpp.feature/.project b/de.fu_berlin.inf.dpp.feature/.project deleted file mode 100644 index 4d370076ffbb4394a8b396e73213400be182d8f9..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>Saros Feature</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> diff --git a/de.fu_berlin.inf.dpp.feature/build.properties b/de.fu_berlin.inf.dpp.feature/build.properties deleted file mode 100644 index 82ab19c62d182db3688b1af6e6f465a74265ac92..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.feature/build.properties +++ /dev/null @@ -1 +0,0 @@ -bin.includes = feature.xml diff --git a/de.fu_berlin.inf.dpp.feature/build.xml b/de.fu_berlin.inf.dpp.feature/build.xml deleted file mode 100644 index 6f9c25a7dd1fc47649a4e0e027b99c69976348d7..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.feature/build.xml +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="de.fu_berlin.inf.dpp.feature" default="build.update.jar" basedir="."> - - <target name="init"> - <property name="feature.temp.folder" value="${basedir}/feature.temp.folder"/> - <property name="feature.destination" value="${basedir}"/> - </target> - - <target name="all.plugins" depends="init"> - <ant antfile="build.xml" dir="../Plugin" target="${target}"> - <property name="arch" value="x86"/> - <property name="os" value="win32"/> - <property name="ws" value="win32"/> - </ant> - </target> - <target name="all.features" depends="init"> - </target> - <target name="update.feature" depends="init"> - </target> - - <target name="all.children" depends="init,all.features,all.plugins,update.feature"> - </target> - - <target name="children" if="include.children"> - <antcall target="all.children"/> - </target> - - <target name="build.jars" depends="init" description="Build all the jars for the feature: de.fu_berlin.inf.dpp.feature."> - <antcall target="all.children"> - <param name="target" value="build.jars"/> - </antcall> - </target> - - <target name="build.sources" depends="init"> - <antcall target="all.children"> - <param name="target" value="build.sources"/> - </antcall> - </target> - - <target name="build.zips" depends="init"> - <antcall target="all.children"> - <param name="target" value="build.zips"/> - </antcall> - </target> - - <target name="build.update.jar" depends="init" description="Build the feature jar of: de.fu_berlin.inf.dpp.feature for an update site."> - <antcall target="all.children"> - <param name="target" value="build.update.jar"/> - </antcall> - <property name="feature.base" value="${feature.temp.folder}"/> - <delete dir="${feature.temp.folder}"/> - <mkdir dir="${feature.temp.folder}"/> - <antcall target="gather.bin.parts" inheritAll="false"> - <param name="arch" value="*"/> - <param name="ws" value="*"/> - <param name="nl" value="*"/> - <param name="os" value="*"/> - <param name="feature.base" value="${feature.temp.folder}"/> - </antcall> - <jar destfile="${feature.destination}/de.fu_berlin.inf.dpp.feature_0.7.0.jar" basedir="${feature.temp.folder}/features/de.fu_berlin.inf.dpp.feature_0.7.0"/> - <delete dir="${feature.temp.folder}"/> - </target> - - <target name="gather.bin.parts" depends="init" if="feature.base"> - <mkdir dir="${feature.base}/features/de.fu_berlin.inf.dpp.feature_0.7.0"/> - <antcall target="children"> - <param name="destination.temp.folder" value="${feature.base}/plugins"/> - <param name="target" value="gather.bin.parts"/> - </antcall> - <copy todir="${feature.base}/features/de.fu_berlin.inf.dpp.feature_0.7.0" failonerror="true" overwrite="false"> - <fileset dir="${basedir}" includes="feature.xml" /> - </copy> - <eclipse.idReplacer featureFilePath="${feature.base}/features/de.fu_berlin.inf.dpp.feature_0.7.0/feature.xml" selfVersion="0.7.0" featureIds="" pluginIds="de.fu_berlin.inf.dpp,0.7.0,"/> - <antcall target="rootFiles${os}_${ws}_${arch}"/> - </target> - <target name="rootFileswin32_win32_x86"> - </target> - <target name="rootFilesgroup_group_group"> - <antcall target="rootFileswin32_win32_x86"/> - </target> - - <target name="zip.distribution" depends="init" description="Create a zip containing all the plug-ins and features for the feature: de.fu_berlin.inf.dpp.feature."> - <delete dir="${feature.temp.folder}"/> - <mkdir dir="${feature.temp.folder}"/> - <antcall target="gather.bin.parts"> - <param name="arch" value="*"/> - <param name="ws" value="*"/> - <param name="nl" value="*"/> - <param name="include.children" value="true"/> - <param name="feature.base" value="${feature.temp.folder}"/> - <param name="os" value="*"/> - </antcall> - <zip destfile="${feature.destination}/de.fu_berlin.inf.dpp.feature_0.7.0.bin.dist.zip" basedir="${feature.temp.folder}" filesonly="false" whenempty="skip" update="false"/> - <delete dir="${feature.temp.folder}"/> - </target> - - <target name="zip.sources" depends="init"> - <delete dir="${feature.temp.folder}"/> - <mkdir dir="${feature.temp.folder}"/> - <antcall target="all.children"> - <param name="destination.temp.folder" value="${feature.temp.folder}/plugins/de.fu_berlin.inf.dpp.feature.source_0.7.0/src"/> - <param name="include.children" value="true"/> - <param name="target" value="gather.sources"/> - </antcall> - <zip destfile="${feature.destination}/de.fu_berlin.inf.dpp.feature_0.7.0.src.zip" basedir="${feature.temp.folder}" filesonly="true" whenempty="skip" update="false"/> - <delete dir="${feature.temp.folder}"/> - </target> - - <target name="zip.logs" depends="init"> - <delete dir="${feature.temp.folder}"/> - <mkdir dir="${feature.temp.folder}"/> - <antcall target="all.children" inheritAll="false"> - <param name="destination.temp.folder" value="${feature.temp.folder}/plugins"/> - <param name="include.children" value="true"/> - <param name="target" value="gather.logs"/> - </antcall> - <zip destfile="${feature.destination}/de.fu_berlin.inf.dpp.feature_0.7.0.log.zip" basedir="${feature.temp.folder}" filesonly="true" whenempty="skip" update="false"/> - <delete dir="${feature.temp.folder}"/> - </target> - - <target name="clean" depends="init" description="Clean the feature: de.fu_berlin.inf.dpp.feature of all the zips, jars and logs created."> - <delete file="${feature.destination}/de.fu_berlin.inf.dpp.feature_0.7.0.jar"/> - <delete file="${feature.destination}/de.fu_berlin.inf.dpp.feature_0.7.0.bin.dist.zip"/> - <delete file="${feature.destination}/de.fu_berlin.inf.dpp.feature_0.7.0.log.zip"/> - <delete file="${feature.destination}/de.fu_berlin.inf.dpp.feature_0.7.0.src.zip"/> - <delete dir="${feature.temp.folder}"/> - <antcall target="all.children"> - <param name="target" value="clean"/> - </antcall> - </target> - - <target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder."> - <eclipse.convertPath fileSystemPath="D:/Coding/Java/Saros/Feature/" property="resourcePath"/> - <eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/> - <antcall target="all.children"> - <param name="target" value="refresh"/> - </antcall> - </target> - <target name="gather.sources"> - <antcall target="children"> - <param name="destination.temp.folder" value="${feature.temp.folder}/plugins/de.fu_berlin.inf.dpp.feature.source_0.7.0/src"/> - <param name="target" value="gather.sources"/> - </antcall> - </target> - - <target name="gather.logs" depends="init"> - <mkdir dir="${feature.temp.folder}"/> - <antcall target="all.children" inheritAll="false"> - <param name="destination.temp.folder" value="${feature.temp.folder}/plugins"/> - <param name="target" value="gather.logs"/> - </antcall> - </target> - -</project> diff --git a/de.fu_berlin.inf.dpp.feature/feature.xml b/de.fu_berlin.inf.dpp.feature/feature.xml deleted file mode 100644 index ce1ea2e410fa3b335856af2cab04ad91681b015a..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.feature/feature.xml +++ /dev/null @@ -1,386 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="de.fu_berlin.inf.dpp.feature" - label="Saros Feature" - version="1.0.0"> - - <description> - Distributed Pair Programming for Eclipse. - </description> - - <copyright> - Code: Riad Djemili & Freie Universität Berlin, Germany -Icons: Mark James (http://famfamfam.com) - </copyright> - - <license> - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - </license> - - <requires> - <import plugin="org.eclipse.ui"/> - <import plugin="org.eclipse.core.runtime"/> - <import plugin="org.eclipse.jdt.ui"/> - <import plugin="org.eclipse.jdt"/> - <import plugin="org.eclipse.jdt.core"/> - <import plugin="org.eclipse.jdt.debug"/> - <import plugin="org.eclipse.jdt.debug.ui"/> - <import plugin="org.eclipse.jdt.doc.isv"/> - <import plugin="org.eclipse.jdt.doc.user"/> - <import plugin="org.eclipse.jdt.junit"/> - <import plugin="org.eclipse.jdt.junit.runtime"/> - <import plugin="org.eclipse.jdt.launching"/> - <import plugin="org.eclipse.jdt.source"/> - <import plugin="org.eclipse.ui.workbench.texteditor"/> - <import plugin="org.eclipse.jface.text"/> - <import plugin="org.eclipse.ui.editors"/> - <import plugin="org.eclipse.core.resources"/> - <import plugin="org.eclipse.ui.ide"/> - </requires> - - <plugin - id="de.fu_berlin.inf.dpp" - download-size="0" - install-size="0" - version="1.0"/> - -</feature> diff --git a/de.fu_berlin.inf.dpp.test/.classpath b/de.fu_berlin.inf.dpp.test/.classpath deleted file mode 100644 index 92fd513a29ea3a26dbe74ab865e71a78bb95fb2f..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/.classpath +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.15.jar"/> - <classpathentry exported="true" kind="lib" path="lib/de.fu_berlin.inf.dpp_1.0.x.jar" sourcepath="/Saros/src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="lib" path="/Saros/lib/log4j-1.2.15.jar"/> - <classpathentry kind="lib" path="lib/easymock.jar"/> - <classpathentry kind="lib" path="lib/junit.jar"/> - <classpathentry kind="lib" path="lib/smackx-debug.jar"/> - <classpathentry kind="lib" path="lib/smackx-jingle.jar"/> - <classpathentry kind="lib" path="lib/xpp.jar"/> - <classpathentry kind="lib" path="lib/smack.jar"/> - <classpathentry kind="lib" path="lib/smackx.jar"/> - <classpathentry kind="lib" path="lib/swing-layout-1.0.3.jar"/> - <classpathentry kind="lib" path="lib/appframework-1.0.3.jar"/> - <classpathentry kind="lib" path="lib/swing-worker-1.1.jar"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/de.fu_berlin.inf.dpp.test/.project b/de.fu_berlin.inf.dpp.test/.project deleted file mode 100644 index 46533b47bbcc82ecb229cd7bf63332dae11623a6..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/.project +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>Saros Test</name> - <comment></comment> - <projects> - <project>Saros Update Site</project> - </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/de.fu_berlin.inf.dpp.test/META-INF/MANIFEST.MF b/de.fu_berlin.inf.dpp.test/META-INF/MANIFEST.MF deleted file mode 100644 index c52ee0da62978cbcc14d661d4da46b89c3e3b0a9..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/META-INF/MANIFEST.MF +++ /dev/null @@ -1,73 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: SarosTest Plug-in -Bundle-SymbolicName: de.fu_berlin.inf.dpp.test -Bundle-Version: 0.7 -Bundle-Localization: plugin -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.pde.junit.runtime, - org.junit, - org.eclipse.jdt.junit, - org.eclipse.jdt.junit.runtime, - org.eclipse.core.resources, - org.eclipse.jface.text, - org.eclipse.text, - org.eclipse.ui.workbench.texteditor, - org.eclipse.ui.editors, - org.apache.commons.logging, - org.apache.commons.logging.source, - org.tigris.subversion.subclipse.core, - org.tigris.subversion.subclipse.doc, - org.tigris.subversion.subclipse.ui, - de.fu_berlin.inf.dpp -Export-Package: de.fu_berlin.inf.dpp.test;uses:="org.jivesoftware.smackx.filetransfer,org.jivesoftware.smack,junit.framework", - de.fu_berlin.inf.dpp.test.actions;uses:="org.eclipse.jface.action", - de.fu_berlin.inf.dpp.test.invitation.internal;x-internal:=true, - de.fu_berlin.inf.dpp.test.net; - uses:="org.jivesoftware.smack.packet, - de.fu_berlin.inf.dpp.net, - org.jivesoftware.smack, - org.eclipse.core.resources, - org.jivesoftware.smackx.filetransfer, - de.fu_berlin.inf.dpp.invitation, - de.fu_berlin.inf.dpp.project, - de.fu_berlin.inf.dpp.activities, - de.fu_berlin.inf.dpp, - junit.framework, - org.eclipse.core.runtime", - de.fu_berlin.inf.dpp.test.net.mock; - uses:="org.jivesoftware.smackx.filetransfer, - de.fu_berlin.inf.dpp.net, - de.fu_berlin.inf.dpp.invitation, - de.fu_berlin.inf.dpp.project, - de.fu_berlin.inf.dpp.activities, - org.jivesoftware.smack, - de.fu_berlin.inf.dpp, - org.eclipse.core.resources, - org.eclipse.core.runtime", - de.fu_berlin.inf.dpp.test.project.svn;uses:="junit.framework", - de.fu_berlin.inf.dpp.test.stubs; - uses:="de.fu_berlin.inf.dpp.editor, - org.eclipse.swt.graphics, - org.eclipse.jface.text, - org.eclipse.core.runtime.content, - de.fu_berlin.inf.dpp.editor.internal, - org.eclipse.core.resources, - org.eclipse.ui, - org.eclipse.jface.text.source, - org.eclipse.ui.texteditor, - org.eclipse.swt.widgets, - org.eclipse.core.runtime, - org.eclipse.core.runtime.jobs", - de.fu_berlin.inf.dpp.test.util;uses:="de.fu_berlin.inf.dpp,org.eclipse.core.resources" -Import-Package: org.eclipse.ui.part -Bundle-ClassPath: ., - lib/easymock.jar, - lib/junit.jar, - lib/smack.jar, - lib/smackx.jar, - lib/smackx-debug.jar, - lib/smackx-jingle.jar, - lib/de.fu_berlin.inf.dpp_1.0.x.jar, - lib/log4j-1.2.15.jar diff --git a/de.fu_berlin.inf.dpp.test/build.properties b/de.fu_berlin.inf.dpp.test/build.properties deleted file mode 100644 index 12b115384812d76aa5666c3ab6659f945e8ebe15..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/build.properties +++ /dev/null @@ -1,13 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - lib/easymock.jar,\ - lib/junit.jar,\ - lib/smack.jar,\ - lib/smackx.jar,\ - lib/smackx-debug.jar,\ - lib/smackx-jingle.jar,\ - lib/de.fu_berlin.inf.dpp_1.0.x.jar,\ - lib/log4j-1.2.15.jar -jars.compile.order = . diff --git a/de.fu_berlin.inf.dpp.test/lib/appframework-1.0.3.jar b/de.fu_berlin.inf.dpp.test/lib/appframework-1.0.3.jar deleted file mode 100644 index 9f5cdbf7b82bfe7b23f6168ab24a3d00207188de..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp.test/lib/appframework-1.0.3.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp.test/lib/de.fu_berlin.inf.dpp_1.0.x.jar b/de.fu_berlin.inf.dpp.test/lib/de.fu_berlin.inf.dpp_1.0.x.jar deleted file mode 100644 index 54b31ae853203a9fa8598e2abecdc00d2c2f5979..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp.test/lib/de.fu_berlin.inf.dpp_1.0.x.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp.test/lib/smackx-debug.jar b/de.fu_berlin.inf.dpp.test/lib/smackx-debug.jar deleted file mode 100644 index 5cf179038a37f90be50673c6e9918926f72092c1..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp.test/lib/smackx-debug.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp.test/lib/smackx.jar b/de.fu_berlin.inf.dpp.test/lib/smackx.jar deleted file mode 100644 index 3b093ff99e99db8b4fe59f006099b3efa64b742a..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp.test/lib/smackx.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp.test/lib/swing-layout-1.0.3.jar b/de.fu_berlin.inf.dpp.test/lib/swing-layout-1.0.3.jar deleted file mode 100644 index 6e1b43b36fb8b5e90d7f6971b8cab80b8a9a7e3e..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp.test/lib/swing-layout-1.0.3.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp.test/lib/swing-worker-1.1.jar b/de.fu_berlin.inf.dpp.test/lib/swing-worker-1.1.jar deleted file mode 100644 index 02f23a3a1ee05dfe48f77b7372878b06a2b040b0..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp.test/lib/swing-worker-1.1.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp.test/lib/xpp.jar b/de.fu_berlin.inf.dpp.test/lib/xpp.jar deleted file mode 100644 index 80f659ca22cc5e3af038f32346310ee3c6fce0b6..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp.test/lib/xpp.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp.test/log4j.properties b/de.fu_berlin.inf.dpp.test/log4j.properties deleted file mode 100644 index 4198139e3305119e02fb86a1bad1aeb527e8f291..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/log4j.properties +++ /dev/null @@ -1,26 +0,0 @@ -log4j.rootLogger=DEBUG, MeinConsoleAppender - -log4j.appender.MeinConsoleAppender=org.apache.log4j.ConsoleAppender -log4j.appender.MeinConsoleAppender.layout=org.apache.log4j.PatternLayout - -log4j.appender.MeinConsoleAppender.layout.ConversionPattern=%-5p %d{HH:mm:ss} (%F:%L) : %m%n -#log4j.appender.MeinConsoleAppender.layout.ConversionPattern=%-5p %d{yyyy-MM-dd : HH:mm:ss} %l %n%m%n - -#log4j.appender.MeinConsoleAppender.layout.ConversionPattern=%-5p %d %l:%n%m%n -#log4j.appender.MeinConsoleAppender.layout.ConversionPattern=%d{MM-dd@HH:mm:ss} %-5p (%13F:%L) %3x - %m%n - -log4j.appender.MeinDaRoFiAppender=org.apache.log4j.FileAppender -log4j.appender.MeinDaRoFiAppender.datePattern='.'yyyy-MM-dd_HH-mm -log4j.appender.MeinDaRoFiAppender.file=Log.log -log4j.appender.MeinDaRoFiAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.MeinDaRoFiAppender.layout.ConversionPattern=%-5p %d %l: %n%m%n - -log4j.logger.de.fu_berlin.inf.dpp=DEBUG -log4j.logger.de.fu_berlin.inf.dpp.jupiter=DEBUG -log4j.logger.de.fu_berlin.inf.dpp.net.internal=DEBUG -log4j.logger.de.fu_berlin.inf.dpp.test=ERROR -log4j.logger.de.fu_berlin.inf.dpp.test.jupiter.text=DEBUG -log4j.logger.de.fu_berlin.inf.dpp.test.jupiter.text.network=INFO -log4j.logger.de.fu_berlin.inf.dpp.test.jupiter.text.ServerSynchronizedDocument=INFO -log4j.logger.de.fu_berlin.inf.dpp.test.jupiter.text.ProxySynchronizedQueue=INFO -log4j.logger.de.fu_berlin.inf.dpp.test.jupiter.text.ClientSynchronizedDocument=INFO \ No newline at end of file diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ActivitiesExtensionProviderTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ActivitiesExtensionProviderTest.java deleted file mode 100644 index 016384fa91acb57e527a8458b4774794228b0470..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ActivitiesExtensionProviderTest.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * DPP - Serious Distributed Pair Programming - * (c) Freie Universit�t Berlin - Fachbereich Mathematik und Informatik - 2006 - * (c) Riad Djemili - 2006 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package de.fu_berlin.inf.dpp.test; - -import java.io.IOException; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.core.runtime.Path; -import org.xmlpull.mxp1.MXParser; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import de.fu_berlin.inf.dpp.activities.TextSelectionActivity; -import de.fu_berlin.inf.dpp.activities.EditorActivity; -import de.fu_berlin.inf.dpp.activities.FileActivity; -import de.fu_berlin.inf.dpp.activities.IActivity; -import de.fu_berlin.inf.dpp.activities.TextEditActivity; -import de.fu_berlin.inf.dpp.activities.EditorActivity.Type; -import de.fu_berlin.inf.dpp.net.TimedActivity; -import de.fu_berlin.inf.dpp.net.internal.ActivitiesPacketExtension; -import de.fu_berlin.inf.dpp.net.internal.ActivitiesProvider; - -public class ActivitiesExtensionProviderTest extends TestCase { - private ArrayList<IActivity> activities; - private MXParser parser; - - @Override - protected void setUp() throws Exception { - activities = new ArrayList<IActivity>(); - } - - public void testParsingStopsOnActivitiesEndTag() - throws XmlPullParserException, IOException { - activities.add(new TextEditActivity(5, "abc", 1)); - assertCreateAndParseActivities(); - - assertTrue(parser.next() == XmlPullParser.END_DOCUMENT); - } - - public void testCreateAndParseSingleTextEditActivity() - throws XmlPullParserException, IOException { - activities.add(new TextEditActivity(5, "abc", 1)); - - assertCreateAndParseActivities(); - } - - public void testCreateAndParseMultipleTextEditActivity() - throws XmlPullParserException, IOException { - activities.add(new TextEditActivity(5, "abc", 1)); - activities.add(new TextEditActivity(15, "", 0)); - activities.add(new TextEditActivity(50, "xy", 15)); - - assertCreateAndParseActivities(); - } - - public void testCreateAndParsePreservesNewLines() - throws XmlPullParserException, IOException { - activities.add(new TextEditActivity(5, "\nab\n\n\nc\n", 1)); - - assertCreateAndParseActivities(); - } - - // TODO - public void testCreateAndParseHandlesAngleBrackets() - throws XmlPullParserException, IOException { - activities.add(new TextEditActivity(5, "<<<>>>", 1)); - - assertCreateAndParseActivities(); - } -// -// // TODO -// public void testCreateAndParsePreservesNewLinesAndCarriageReturns() -// throws XmlPullParserException, IOException { -// activities.add(new TextEditActivity(5, "abc\r\n", 1)); -// -// assertCreateAndParseActivities(); -// } - - public void testSingleEditorActivatedActivity() - throws XmlPullParserException, IOException { - - activities.add( - new EditorActivity(Type.Activated, - new Path("/foo/text.txt"))); - - assertCreateAndParseActivities(); - } - - public void testSingleTextSelectionActivity() - throws XmlPullParserException, IOException { - activities.add(new TextSelectionActivity(2, 23)); - - assertCreateAndParseActivities(); - } - -// public void testResourceAddActivity() -// throws XmlPullParserException, IOException { -// -// activities.add(new ResourceAddActivity(new Path("/saros/unittest.txt"))); -// -// assertCreateAndParseActivities(); -// } - -// public void testResourceAddActivityWithContent() -// throws XmlPullParserException, IOException { -// -// activities.add(new ResourceAddActivity( -// new Path("/saros/unittest.txt"), "test content")); -// -// assertCreateAndParseActivities(); -// } -// -// public void testResourceAddActivityWithContentAndAngledBrackets() -// throws XmlPullParserException, IOException { -// -// activities.add(new ResourceAddActivity( -// new Path("/saros/unittest.txt"), "test<<<>>>content")); -// -// -// assertCreateAndParseActivities(); -// } -// -// public void testResourceAddActivityWithContentAndPreserveNewLines() -// throws XmlPullParserException, IOException { -// -// activities.add(new ResourceAddActivity( -// new Path("/saros/unittest.txt"), "test\ncontent")); -// -// assertCreateAndParseActivities(); -// } -// -// public void testResourceAddActivityWithContentAndPreserveCarriageReturns() -// throws XmlPullParserException, IOException { -// -// activities.add(new ResourceAddActivity( -// new Path("/saros/unittest.txt"), "test\rcontent")); -// -// assertCreateAndParseActivities(); -// } - - public void testFileAddedActivity() - throws XmlPullParserException, IOException { - - activities.add(new FileActivity(FileActivity.Type.Created, - new Path("/saros/unittest.txt"))); - - assertCreateAndParseActivities(); - } - - /** - * Create a ActivitiesExtension from given parameter, convert it to XML, - * process it through the ActivitiesProvider back into an - * ActivitiesExtension and check if its activities equal the param given. - * @throws IOException - */ - private void assertCreateAndParseActivities() - throws XmlPullParserException, IOException { - - List<TimedActivity> timedActivities = new ArrayList<TimedActivity>(); - int time = 0; - for (IActivity activity : activities) { - timedActivities.add(new TimedActivity(activity, time++)); - } - - ActivitiesPacketExtension activitiesPacket = - new ActivitiesPacketExtension(timedActivities); - - ActivitiesProvider provider = new ActivitiesProvider(); - - parser = new MXParser(); - parser.setInput(new StringReader(activitiesPacket.toXML())); - ActivitiesPacketExtension activitiesExtension = provider.parseExtension(parser); - - assertEquals(timedActivities, activitiesExtension.getActivities()); - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ActivityCollectorTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ActivityCollectorTest.java deleted file mode 100644 index 9073012b9536d8cb67bb4bbb86154884a8805900..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ActivityCollectorTest.java +++ /dev/null @@ -1,319 +0,0 @@ -///* -// * DPP - Serious Distributed Pair Programming -// * (c) Freie Universit�t Berlin - Fachbereich Mathematik und Informatik - 2006 -// * (c) Riad Djemili - 2006 -// * -// * This program is free software; you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation; either version 1, or (at your option) -// * any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program; if not, write to the Free Software -// * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// */ -//package de.fu_berlin.inf.dpp.test; -// -//import java.util.List; -// -//import junit.framework.TestCase; -// -//import org.eclipse.core.runtime.Path; -// -//import de.fu_berlin.inf.dpp.ActivityCollector; -//import de.fu_berlin.inf.dpp.activities.CursorLineActivity; -//import de.fu_berlin.inf.dpp.activities.TextSelectionActivity; -//import de.fu_berlin.inf.dpp.activities.IActivity; -//import de.fu_berlin.inf.dpp.activities.RoleActivity; -//import de.fu_berlin.inf.dpp.activities.TextEditActivity; -//import de.fu_berlin.inf.dpp.activities.EditorActivity; -//import de.fu_berlin.inf.dpp.test.stubs.TextSelectionStub; -//import de.fu_berlin.inf.dpp.net.JID; -// -//public class ActivityCollectorTest extends TestCase { -// -// private ActivityCollector collector; -// -// @Override -// protected void setUp() throws Exception { -// collector = new ActivityCollector(); -// } -// -// public void testHasSimpleTextChange() { -// collector.textChanged(5, "a", 0, 1); -// -// assertFlush(new IActivity[]{ -// new TextEditActivity(5, "a", 0)}); -// } -// -// public void testJoinConsecutiveTextChanges() { -// collector.textChanged(5, "a", 0, 1); -// collector.textChanged(6, "bc", 0, 1); -// -// assertFlush(new IActivity[]{ -// new TextEditActivity(5, "abc", 0)}); -// } -// -// public void testJoinConsecutiveAndContinueTextChanges() { -// collector.textChanged(5, "a", 0, 1); -// collector.textChanged(6, "bc", 0, 1); -// -// assertFlush(new IActivity[]{ -// new TextEditActivity(5, "abc", 0)}); -// -// collector.textChanged(8, "d", 0, 1); -// -// assertFlush(new IActivity[]{ -// new TextEditActivity(8, "d", 0)}); -// } -// -// public void testHasDriverChange() { -// collector.textChanged(5, "abc", 0, 1); -// collector.driverChanged(new JID("riad@jabber.org"), false); -// -// assertFlush(new IActivity[]{ -// new TextEditActivity(5, "abc", 0), -// new RoleActivity(new JID("riad@jabber.org"))}); -// } -// -// public void testHasTextLoadActivity() { -// collector.driverPathChanged(new Path("/ju/test.txt"), false); -// -// assertFlush(new IActivity[]{ -// new EditorActivity("/ju/test.txt")}); -// } -// -// public void testDontResendSameTextLoad() { -// collector.driverPathChanged(new Path("/ju/test.txt"), false); -// -// assertFlush(new IActivity[]{ -// new EditorActivity("/ju/test.txt")}); -// -// collector.driverPathChanged(new Path("/ju/test.txt"), false); -// assertNull(collector.flush()); -// } -// -// public void testCursorLineCreatedOnLowControllerLoD() { -// collector.setLevelOfDetail(1); -// collector.cursorChanged(new TextSelectionStub(5, 30, 1, 3)); -// -// assertFlush(new IActivity[]{ -// new CursorLineActivity(1, 3)}); -// } -// -// public void testCursorOffsetCreatedOnHighControllerLoD() { -// collector.setLevelOfDetail(10); -// collector.cursorChanged(new TextSelectionStub(5, 30, 1, 3)); -// -// assertFlush(new IActivity[]{ -// new TextSelectionActivity(5, 30)}); -// } -// -// public void testCursorLineMultipleSimpleFlushes() { -// collector.setLevelOfDetail(1); -// collector.cursorChanged(new TextSelectionStub(5, 30, 1, 3)); -// assertFlush(new IActivity[]{ -// new CursorLineActivity(1, 3)}); -// -// collector.cursorChanged(new TextSelectionStub(50, 10, 4, 5)); -// assertFlush(new IActivity[]{ -// new CursorLineActivity(4, 5)}); -// } -// -// public void testCursorOffsetMultipleSimpleFlushes() { -// collector.setLevelOfDetail(10); -// collector.cursorChanged(new TextSelectionStub(5, 30, 1, 3)); -// assertFlush(new IActivity[]{ -// new TextSelectionActivity(5, 30)}); -// -// collector.cursorChanged(new TextSelectionStub(50, 10, 4, 5)); -// assertFlush(new IActivity[]{ -// new TextSelectionActivity(50, 10)}); -// } -// -// public void testCursorLineIgnorePriorCursorEventsUntilFlush() { -// collector.setLevelOfDetail(1); -// collector.cursorChanged(new TextSelectionStub(5, 0, 1, 1)); -// collector.cursorChanged(new TextSelectionStub(6, 0, 1, 1)); -// -// assertFlush(new IActivity[]{ -// new CursorLineActivity(1, 1)}); -// } -// -// public void testCursorOffsetIgnorePriorCursorEventsUntilFlush() { -// collector.setLevelOfDetail(10); -// collector.cursorChanged(new TextSelectionStub(5, 0, 1, 1)); -// collector.cursorChanged(new TextSelectionStub(6, 0, 1, 1)); -// -// assertFlush(new IActivity[]{ -// new TextSelectionActivity(6, 0)}); -// } -// -// public void testCursorLineIsReplacedByTextEdit() { -// collector.setLevelOfDetail(1); -// collector.textChanged(5, "abc", 1, 1); -// collector.cursorChanged(new TextSelectionStub(18, 0, 1, 1)); -// collector.cursorChanged(new TextSelectionStub( 8, 0, 1, 1)); -// -// assertFlush(new IActivity[]{ -// new TextEditActivity(5, "abc", 1)}); -// } -// -// public void testCursorOffsetIsReplacedByTextEdit() { -// collector.setLevelOfDetail(10); -// collector.textChanged(5, "abc", 1, 1); -// collector.cursorChanged(new TextSelectionStub(18, 0, 1, 1)); -// collector.cursorChanged(new TextSelectionStub( 8, 0, 1, 1)); -// -// assertFlush(new IActivity[]{ -// new TextEditActivity(5, "abc", 1)}); -// } -// -// public void testCursorLineDontResendUnneededCursorEventAfterFlush() { -// collector.setLevelOfDetail(1); -// collector.cursorChanged(new TextSelectionStub( 5, 0, 1, 1)); -// collector.flush(); -// -// collector.cursorChanged(new TextSelectionStub( 5, 0, 1, 1)); -// assertNull(collector.flush()); -// } -// -// public void testCursorOffsetDontResendUnneededCursorEventAfterFlush() { -// collector.setLevelOfDetail(1); -// collector.cursorChanged(new TextSelectionStub( 5, 0, 1, 1)); -// collector.flush(); -// -// collector.cursorChanged(new TextSelectionStub( 5, 0, 1, 1)); -// assertNull(collector.flush()); -// } -// -// /** -// * Helper method that flushes the activitity controller and compares its -// * returned activities list with the given parameter <code>expected</code>. -// */ -// private void assertFlush(IActivity[] expected) { -// List<IActivity> activities = collector.flush(); -// -// for (int i = 0; i < expected.length; i++) { -// assertEquals(expected[i], activities.get(i)); -// } -// -// assertEquals(expected.length, activities.size()); -// } -// -///* tests for real diff engine - currently not functional */ -// -// -// public void testJoinIntermingledTextChanges() { -// collector.textChanged(5, 0, "ade"); -// collector.textChanged(6, 0, "bc"); -// -// assertMessage("textChange(5,0,abcde) "); -// } -// -// public void testNonJoinableTextChange() { -// collector.textChanged(5, 0, "abc"); -// collector.textChanged(50, 0, "def"); -// -// assertMessage("textChange(5,0,abc) textChange(50,0,def) "); -// } -// -// public void testJoiningTextChangesIncrementsLaterChanges() { -// collector.textChanged(5, 0, "abc"); -// collector.textChanged(25, 0, "xyz"); -// collector.textChanged(8, 0, "def"); -// -// assertMessage("textChange(5,0,abcdef) textChange(28,0,xyz) "); -// } -// -// public void testJoinTextChangePartlyDeleted() { -// collector.textChanged(5, 0, "abcde"); -// collector.textChanged(6, 3, ""); -// -// assertMessage("textChange(5,0,ae) "); -// } -// -// public void testJoinTextChangeDeletedAndAppend() { -// collector.textChanged(5, 0, "axy"); -// collector.textChanged(6, 2, "bcde"); -// -// assertMessage("textChange(5,0,abcde) "); -// } -// -// public void testTextChangeReplacedByOtherTextChange() { -// collector.textChanged(5, 0, "abc"); -// collector.textChanged(5, 3, "xyz"); -// -// assertMessage("textChange(5,0,xyz) "); -// } -// -// public void testJoinDeletingTextChanges() { -// collector.textChanged(3, 2, ""); -// collector.textChanged(3, 3, ""); -// -// assertMessage("textChange(3,5,) "); -// } -// -// public void testJoinDeletingTextChangesReversed() { -// collector.textChanged(5, 3, ""); -// collector.textChanged(3, 2, ""); -// -// assertMessage("textChange(3,5,) "); -// } -// -// public void testJoinIntermingledDeletingTextChanges() { -// collector.textChanged(5, 2, ""); -// collector.textChanged(4, 3, ""); -// -// assertMessage("textChange(4,5,) "); -// } -// -// public void testJoinDeleteAndInsertedTextChanges() { -// collector.textChanged(5, 5, ""); -// collector.textChanged(5, 0, "abc"); -// -// assertMessage("textChange(5,5,abc) "); -// } -// -// public void testJoinDeleteAndInsertedTextChangesReversed() { -// collector.textChanged(5, 0, "abc"); -// collector.textChanged(8, 5, ""); -// -// assertMessage("textChange(5,5,abc) "); -// } -// -// public void testNonJoinableDeleteAndInsertedTextChanges() { -// collector.textChanged(5, 5, ""); -// collector.textChanged(6, 0, "abc"); -// -// assertMessage("textChange(5,5,) textChange(6,0,abc) "); -// } -// -// public void testJoinOverflowingDeleteOfInsertedTextChange() { -// collector.textChanged(5, 0, "abc"); -// collector.textChanged(5, 5, ""); -// -// assertMessage("textChange(5,2,) "); -// } -// -// public void testIncrementLaterTextChanges() { -// collector.textChanged(25, 0, "abc"); -// collector.textChanged( 5, 0, "xyz"); -// collector.textChanged(27, 0, "de"); -// -// assertMessage("textChange(5,0,xyz) textChange(27,0,de) textChange(30,0,abc) "); -// } -// -// public void testMergeThreeTextChanges() { -// collector.textChanged( 5, 0, "abc"); -// collector.textChanged( 9, 0, "efg"); -// collector.textChanged( 8, 1, "d"); -// -// assertMessage("textChange(5,1,abcdefg) "); -// } -//} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ActivitySequencerTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ActivitySequencerTest.java deleted file mode 100644 index 090ba834da36e0a2650e5f39764e79f15df2d9ca..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ActivitySequencerTest.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * DPP - Serious Distributed Pair Programming - * (c) Freie Universit�t Berlin - Fachbereich Mathematik und Informatik - 2006 - * (c) Riad Djemili - 2006 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package de.fu_berlin.inf.dpp.test; - -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.reset; -import static org.easymock.EasyMock.verify; - -import java.util.List; - -import org.eclipse.core.runtime.Path; - -import junit.framework.TestCase; -import de.fu_berlin.inf.dpp.User; -import de.fu_berlin.inf.dpp.activities.TextSelectionActivity; -import de.fu_berlin.inf.dpp.activities.IActivity; -import de.fu_berlin.inf.dpp.activities.TextEditActivity; -import de.fu_berlin.inf.dpp.activities.EditorActivity; -import de.fu_berlin.inf.dpp.concurrent.ConcurrentManager; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.net.TimedActivity; -import de.fu_berlin.inf.dpp.net.internal.ActivitySequencer; -import de.fu_berlin.inf.dpp.project.IActivityProvider; - -public class ActivitySequencerTest extends TestCase { - private ActivitySequencer sequencer; - private IActivityProvider providerMock; - - private TextEditActivity textEditActivity1; - private TextEditActivity textEditActivity2; - private TextEditActivity textEditActivity3; - - @Override - protected void setUp() throws Exception { - sequencer = new ActivitySequencer(); - sequencer.initConcurrentManager(ConcurrentManager.Side.CLIENT_SIDE, new User(new JID("host@jabber.com")), new JID("user@jabber.com")); - - providerMock = createMock(IActivityProvider.class); - sequencer.addProvider(providerMock); - reset(providerMock); - - textEditActivity1 = new TextEditActivity(0, "a", 0); - textEditActivity2 = new TextEditActivity(5, "b", 0); - textEditActivity3 = new TextEditActivity(8, "c", 0); - } - - public void testTwoConsecutive() { - providerMock.exec(textEditActivity1); - providerMock.exec(textEditActivity2); - replay(providerMock); - - sequencer.exec(new TimedActivity(textEditActivity1, 0)); - sequencer.exec(new TimedActivity(textEditActivity2, 1)); - verify(providerMock); - } - - public void testTwoReversedConsecutive() { - providerMock.exec(textEditActivity1); - providerMock.exec(textEditActivity2); - replay(providerMock); - - sequencer.exec(new TimedActivity(textEditActivity2, 1)); - sequencer.exec(new TimedActivity(textEditActivity1, 0)); - verify(providerMock); - } - - public void testThreeMixedConsecutive() { - providerMock.exec(textEditActivity1); - providerMock.exec(textEditActivity2); - providerMock.exec(textEditActivity3); - replay(providerMock); - - sequencer.exec(new TimedActivity(textEditActivity2, 1)); - sequencer.exec(new TimedActivity(textEditActivity1, 0)); - sequencer.exec(new TimedActivity(textEditActivity3, 2)); - verify(providerMock); - } - - public void testLogFlushedActivities() { - sequencer.activityCreated(textEditActivity1); - sequencer.activityCreated(textEditActivity2); - sequencer.flush(); - - assertActivities(new IActivity[]{ - textEditActivity1, textEditActivity2}, - sequencer.getLog()); - } - - public void testIncomingActivitiesIncTime() { - sequencer.exec(new TimedActivity(textEditActivity1, 0)); - sequencer.exec(new TimedActivity(textEditActivity2, 1)); - assertEquals(2, sequencer.getTimestamp()); - } - - public void testHasSimpleTextChange() { - sequencer.activityCreated(new TextEditActivity(5, "a", 0)); - - assertFlush(new IActivity[]{ - new TextEditActivity(5, "a", 0)}); - } - - public void testJoinConsecutiveTextChanges() { - sequencer.activityCreated(new TextEditActivity(5, "a", 0)); - sequencer.activityCreated(new TextEditActivity(6, "bc", 0)); - sequencer.activityCreated(new TextEditActivity(8, "de", 0)); - - assertFlush(new IActivity[]{ - new TextEditActivity(5, "abcde", 0)}); - } - - public void testDontJoinConsecutiveTextChangesInDifferentFiles() { - sequencer.activityCreated(new TextEditActivity(5, "a", 0)); - sequencer.activityCreated(new EditorActivity( - EditorActivity.Type.Activated, new Path("/bla"))); - sequencer.activityCreated(new TextEditActivity(8, "de", 0)); - - assertFlush(new IActivity[]{ - new TextEditActivity(5, "a", 0), - new EditorActivity(EditorActivity.Type.Activated, new Path("/bla")), - new TextEditActivity(8, "de", 0)}); - } - - public void testSimpleStripRedundantTextOffsets() { - sequencer.activityCreated(new TextEditActivity(5, "a", 0)); - sequencer.activityCreated(new TextSelectionActivity(6, 0)); - - assertFlush( - new IActivity[]{new TextEditActivity(5, "a", 0)}); - } - - public void testStripReverseRedundantTextOffsets() { - sequencer.activityCreated(new TextSelectionActivity(5, 0)); - sequencer.activityCreated(new TextEditActivity(5, "a", 0)); - - assertFlush( - new IActivity[]{new TextEditActivity(5, "a", 0)}); - } - - public void testStripTextOffsetsWhenNoOtherActivitiesInBetween() { - sequencer.activityCreated(new TextSelectionActivity(5, 0)); - sequencer.activityCreated(new TextSelectionActivity(15, 0)); - sequencer.activityCreated(new TextSelectionActivity(16, 0)); - - assertFlush( - new IActivity[]{new TextSelectionActivity(16, 0)}); - } - - public void testStripRedundantTextOffsetsAndConsiderStartOffset() { - sequencer.activityCreated(new TextSelectionActivity(3, 2)); - sequencer.activityCreated(new TextEditActivity(5, "a", 0)); - sequencer.activityCreated(new TextSelectionActivity(6, 0)); - - assertFlush( - new IActivity[]{new TextEditActivity(5, "a", 0)}); - } - - private void assertFlush(IActivity[] expected) { - TestHelper.assertList(expected, sequencer.flush()); - } - - private void assertActivities(IActivity[] expected, List<IActivity> actual) { - TestHelper.assertList(expected, actual); - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/AllTests.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/AllTests.java deleted file mode 100644 index a4b5a349c74fab62801980cfe7e5c2d92ae68575..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/AllTests.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * DPP - Serious Distributed Pair Programming - * (c) Freie Universit�t Berlin - Fachbereich Mathematik und Informatik - 2006 - * (c) Riad Djemili - 2006 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package de.fu_berlin.inf.dpp.test; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite("Test for de.fu_berlin.inf.dpp.test"); - //$JUnit-BEGIN$ - suite.addTestSuite(ActivitiesExtensionProviderTest.class); -// suite.addTestSuite(ActivityCollectorTest.class); - suite.addTestSuite(JIDTest.class); - suite.addTestSuite(FileListTest.class); - suite.addTestSuite(ActivitySequencerTest.class); - suite.addTestSuite(EditorManagerTest2.class); - //$JUnit-END$ - return suite; - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ContributionAnnotationTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ContributionAnnotationTest.java deleted file mode 100644 index c52d6b13198db05695d5f73b36df0cf1fa45ef9b..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/ContributionAnnotationTest.java +++ /dev/null @@ -1,170 +0,0 @@ -package de.fu_berlin.inf.dpp.test; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import junit.framework.TestCase; - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jface.text.source.AnnotationModel; - -import de.fu_berlin.inf.dpp.editor.annotations.ContributionAnnotation; -import de.fu_berlin.inf.dpp.editor.internal.ContributionHelper; - -/** - * Unit tests for contribution annotation insertions. - * - * @author rdjemili - */ -public class ContributionAnnotationTest extends TestCase { - - /** - * A simple Position class extension that overwrites the toString method. - */ - private class PositionPrint extends Position { - public PositionPrint(int offset, int length) { - super(offset, length); - } - - public PositionPrint(Position position) { - super(position.offset, position.length); - } - - @Override - public String toString() { - return "("+offset+", "+length+")"; - } - } - - - private AnnotationModel annotationModel; - private Document document; - - @Override - protected void setUp() throws Exception { - document = new Document("abcdefghijklmnopqrstuvwxyz"); - - annotationModel = new AnnotationModel(); - annotationModel.connect(document); - } - - @Override - protected void tearDown() throws Exception { - annotationModel.disconnect(document); - } - - /* 0123456789 - * xxx - */ - public void testInsertSimpleAnnotation() throws BadLocationException { - document.replace(5, 0, "abc"); - ContributionHelper.insertAnnotation(annotationModel, 5, 3); - assertPositions(annotationModel, new int[]{5,3}); - } - - /* 0123456789 - * xx---x - */ - public void testExpandAnnotationAtCenter() throws BadLocationException { - Position pos = new Position(3, 3); - annotationModel.addAnnotation(new ContributionAnnotation(), pos); - - document.replace(5, 0, "abc"); - ContributionHelper.insertAnnotation(annotationModel, 5, 3); - assertPositions(annotationModel, new int[]{3,6}); - } - - /* 0123456789 - * xxx--- - */ - public void testExpandAnnotationAtEnd() throws BadLocationException { - Position pos = new Position(3, 3); - annotationModel.addAnnotation(new ContributionAnnotation(), pos); - - document.replace(6, 0, "abc"); - ContributionHelper.insertAnnotation(annotationModel, 6, 3); - assertPositions(annotationModel, new int[]{3,3, 6,3}); - } - - /* 0123456789 - * ---xxx - */ - public void testExpandAnnotationAtBegin() throws BadLocationException { - Position pos = new Position(3, 3); - annotationModel.addAnnotation(new ContributionAnnotation(), pos); - - document.replace(3, 0, "abc"); - ContributionHelper.insertAnnotation(annotationModel, 3, 3); - assertPositions(annotationModel, new int[]{3,3, 6,3}); - } - - /* 0123456789 - * xx___xxx - */ - public void testSplitAnnotationAtCenter() throws BadLocationException { - Position pos = new Position(1, 5); - annotationModel.addAnnotation(new ContributionAnnotation(), pos); - - ContributionHelper.splitAnnotation(annotationModel, 3); - document.replace(3, 0, "___"); - - assertPositions(annotationModel, new int[]{1,2, 6,3}); - } - - /* 0123456789 - * ___xxxxx - */ - public void testDontExpandAnnotationAtBegin() throws BadLocationException { - Position pos = new Position(1, 5); - annotationModel.addAnnotation(new ContributionAnnotation(), pos); - - ContributionHelper.splitAnnotation(annotationModel, 1); - document.replace(1, 0, "___"); - - assertPositions(annotationModel, new int[]{4,5}); - } - - /* 0123456789 - * xxxxx___ - */ - public void testDontExpandAnnotationAtEnd() throws BadLocationException { - Position pos = new Position(1, 5); - annotationModel.addAnnotation(new ContributionAnnotation(), pos); - - ContributionHelper.splitAnnotation(annotationModel, 6); - document.replace(6, 0, "___"); - - assertPositions(annotationModel, new int[]{1,5}); - } - - /** - * Asserts if given annotation model contains annotations with given - * positions. - * - * @param model the annotation model. - * @param posArray the positions of the annotations in (offset, length) - * format. Each two integers make up one positions. The positions can be - * given in any order. - */ - private void assertPositions(AnnotationModel model, int[]posArray) { - // convert array format to set of positions - Set<PositionPrint> positions = new HashSet<PositionPrint>(); - for (int i = 0; i < posArray.length/2; i++) { - positions.add(new PositionPrint(posArray[i*2], posArray[i*2+1])); - } - - // check if positions are equal - Set<PositionPrint> positions2 = new HashSet<PositionPrint>(); - for (Iterator it = model.getAnnotationIterator(); it.hasNext();) { - Annotation annotation = (Annotation)it.next(); - - positions2.add(new PositionPrint(model.getPosition(annotation))); - } - - assertEquals(positions, positions2); - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/EditorAPITest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/EditorAPITest.java deleted file mode 100644 index c48012e42b52cbd227be0ed57bce1d0e7a72bb0c..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/EditorAPITest.java +++ /dev/null @@ -1,102 +0,0 @@ - -package de.fu_berlin.inf.dpp.test; - -import java.util.Set; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.text.TextSelection; -import org.eclipse.ui.IEditorPart; - -import de.fu_berlin.inf.dpp.editor.EditorManager; -import de.fu_berlin.inf.dpp.editor.internal.EditorAPI; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.project.internal.SharedProject; -import de.fu_berlin.inf.dpp.test.util.ResourceHelper; - -/** - * JUnit Plug-in Test for the EditorAPI. - * - * @author rdjemili - */ -public class EditorAPITest extends TestCase { - private IProject project; - private IFile file; - private EditorAPI editorAPI; - private EditorManager editorManager; - - @Override - protected void setUp() throws Exception { - project = ResourceHelper.createProject("testProject"); - file = ResourceHelper.createFile(project, "foo.txt", "test content"); - - editorAPI = new EditorAPI(); - -// SharedProject sharedProject = -// new SharedProject(null, project, new JID("riad@jabber.org")); - - editorManager = EditorManager.getDefault(); - } - - @Override - protected void tearDown() throws Exception { - project.delete(true, null); - } - - public void testOpenEditor() { - IEditorPart part = editorAPI.openEditor(file); - assertNotNull(part); - assertEquals(file, part.getEditorInput().getAdapter(IFile.class)); - } - - public void testGetOpenEditors() { - IEditorPart part = editorAPI.openEditor(file); - - Set<IEditorPart> editors = editorAPI.getOpenEditors(); - assertEquals(1, editors.size()); - assertTrue(editors.contains(part)); - } - - public void testCloseEditor() { - IEditorPart part = editorAPI.openEditor(file); - editorAPI.closeEditor(part); - assertEquals(0, editorAPI.getOpenEditors().size()); - } - - public void testGetActiveEditor() { - IEditorPart part = editorAPI.openEditor(file); - assertEquals(part, editorAPI.getActiveEditor()); - } - - public void testSetGetSelection() { - IEditorPart part = editorAPI.openEditor(file); - TextSelection selection = new TextSelection(1, 3); - editorAPI.setSelection(part, selection,file.getName()); - - ITextSelection selection2 = editorAPI.getSelection(part); - assertEquals(selection.getOffset(), selection2.getOffset()); - assertEquals(selection.getLength(), selection2.getLength()); - } - -// public void testSetGetViewport() { -// IEditorPart part = editorAPI.openEditor(file); -// ILineRange viewport = new LineRange(1, 2); -// editorAPI.setSelection(part, selection); -// -// ITextSelection selection2 = editorAPI.getSelection(part); -// assertEquals(selection.getOffset(), selection2.getOffset()); -// assertEquals(selection.getLength(), selection2.getLength()); -// } - - public void testName() { - editorManager.driverChanged(new JID("riad@jabber.org"), false); - IEditorPart part = editorAPI.openEditor(file); - - // assertEquals(file.getProjectRelativePath(), - assertEquals(file.getProjectRelativePath(), editorManager.getActiveDriverEditor()); - } - -} \ No newline at end of file diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/EditorManagerTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/EditorManagerTest.java deleted file mode 100644 index b0b6607d5209660470d3450b610dd42799074d14..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/EditorManagerTest.java +++ /dev/null @@ -1,95 +0,0 @@ - -package de.fu_berlin.inf.dpp.test; - -import java.util.Set; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.ui.IEditorPart; - -import de.fu_berlin.inf.dpp.Saros; -import de.fu_berlin.inf.dpp.User; -import de.fu_berlin.inf.dpp.editor.EditorManager; -import de.fu_berlin.inf.dpp.editor.internal.EditorAPI; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.project.SessionManager; -import de.fu_berlin.inf.dpp.project.internal.SharedProject; -import de.fu_berlin.inf.dpp.test.util.ResourceHelper; - -public class EditorManagerTest extends TestCase { - private static final JID MY_JID = new JID("riad@jabber.org"); - private static final JID OTHER_JID = new JID("bob@jabber.org"); - - private IProject project; - private IFile file1; - private IFile file2; - private EditorManager editorManager; - - private EditorAPI editorAPI; - private SharedProject sharedProject; - private SessionManager sessionManager; - - @Override - protected void setUp() throws Exception { - project = ResourceHelper.createProject("testProject"); - file1 = ResourceHelper.createFile(project, "foo.txt", "test content"); - file2 = ResourceHelper.createFile(project, "bar.java", "public class Test{}"); - - sharedProject = new SharedProject(null, project, MY_JID); - editorManager = EditorManager.getDefault(); - editorAPI = new EditorAPI(); - - sessionManager = Saros.getDefault().getSessionManager(); - } - - @Override - protected void tearDown() throws Exception { - sessionManager.leaveSession(); - project.delete(true, null); - closeOpenEditors(); - } - - public void testSetActivateDriverEditorIfDriver() { - editorAPI.openEditor(file1); - assertEquals(file1.getProjectRelativePath(), editorManager.getActiveDriverEditor()); - } - - public void testDontSetActivateDriverEditorIfNotDriver() { - User user = new User(OTHER_JID); - sharedProject.addUser(user); - sharedProject.setDriver(user, true); - editorAPI.openEditor(file1); - - assertFalse(file1.getProjectRelativePath().equals(editorManager.getActiveDriverEditor())); - } - - public void testSetDriverEditorOnStartIfActiveEditorAndDriver() throws Exception { - editorAPI.openEditor(file1); - editorAPI.openEditor(file2); - - sessionManager.leaveSession(); - sharedProject = new SharedProject(null, project, MY_JID); - editorManager = EditorManager.getDefault(); - - assertEquals(file2.getProjectRelativePath(), editorManager.getActiveDriverEditor()); - } - - public void testDontSetDriverPathOnStartIfNotDriver() { - editorAPI.openEditor(file1); - - sessionManager.leaveSession(); - sharedProject = new SharedProject(null, project, OTHER_JID); - editorManager = EditorManager.getDefault(); - - assertNull(editorManager.getActiveDriverEditor()); - } - - private void closeOpenEditors() { - Set<IEditorPart> openEditors = editorAPI.getOpenEditors(); - for (IEditorPart part : openEditors) { - editorAPI.closeEditor(part); - } - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/EditorManagerTest2.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/EditorManagerTest2.java deleted file mode 100644 index 05aae33949288d18d199d3628801b6a7ccb29f13..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/EditorManagerTest2.java +++ /dev/null @@ -1,303 +0,0 @@ - -package de.fu_berlin.inf.dpp.test; - -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.createNiceMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.isA; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.util.HashSet; -import java.util.Set; - -import junit.framework.TestCase; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.text.TextSelection; -import org.eclipse.jface.text.source.LineRange; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.fieldassist.*; - -import de.fu_berlin.inf.dpp.editor.EditorManager; -import de.fu_berlin.inf.dpp.editor.internal.IEditorAPI; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.project.ISharedProject; -import de.fu_berlin.inf.dpp.test.stubs.EditorAPIStub; -import de.fu_berlin.inf.dpp.test.stubs.FileStub; - -public class EditorManagerTest2 extends TestCase { - private IEditorPart editorMock1; - private IEditorPart editorMock2; - - private Path path1; - private Path path2; - - private IEditorAPI editorAPIMock; - private ISharedProject sharedProjectMock; - - @Override - protected void setUp() throws Exception { - editorMock1 = createMock(IEditorPart.class); - editorMock2 = createMock(IEditorPart.class); - - editorAPIMock = new EditorAPIStub(); - sharedProjectMock = createNiceMock(ISharedProject.class); - -// Set<IEditorPart> editorParts = new HashSet<IEditorPart>(2); -// editorParts.add(editorPartMock1); -// editorParts.add(editorPartMock2); -// expect(humbleEditorMock.getOpenEditors()).andStubReturn(editorParts); -// -// path1 = new Path("foo"); -// path2 = new Path("bar"); -// expect(humbleEditorMock.getEditorResource(editorPartMock1)).andStubReturn(path1); -// expect(humbleEditorMock.getEditorResource(editorPartMock2)).andStubReturn(path2); - } - - public void testActivateDriverEditor() { - IPath path = new Path("/foo/test"); -// FileStub fileStub = new FileStub("/foo/test", "test content"); -// -// expect(editorAPIMock.getEditorResource(isA(IEditorPart.class))) -// .andStubReturn(fileStub); -// -// expect(editorAPIMock.getSelection(isA(IEditorPart.class))) -// .andStubReturn(new TextSelection(1,5)); -// -// expect(editorAPIMock.getViewport(isA(IEditorPart.class))) -// .andStubReturn(new LineRange(1,5)); -// -// Set<IEditorPart> editors = new HashSet<IEditorPart>(); -// editors.add(editorMock1); -// editors.add(editorMock2); -// expect(editorAPIMock.getOpenEditors()) -// .andStubReturn(editors); -// -// expect(editorMock1.getEditorInput()) -// .andStubReturn(new FileEditorInput(fileStub)); -// -// expect(sharedProjectMock.isDriver()) -// .andStubReturn(true); - -// replayMocks(); - -// EditorManager editorManager = EditorManager.getDefault(); -// new EditorManager(sharedProjectMock, editorAPIMock); -// editorManager.driverChanged(new JID("riad@jabber.org"), false); -// -// editorManager.partActivated(editorMock1); -// assertEquals(path, editorManager.getActiveDriverEditor()); - - -// expect(sharedProjectMock.isDriver()).andStubReturn(true); -// -// sharedProjectMock.setActiveDriverEditor(path1, false); -// replayMocks(); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.partActivated(editorPartMock1); -// verifyMocks(); - } - -// public void testSetDriverPathOnStartIfActiveEditorAndDriver() { -// expect(sharedProjectMock.isDriver()).andReturn(true); -// expect(humbleEditorMock.getActiveEditor()).andReturn(editorPartMock1); -// replayMocks(); -// -// createEditorManager(); -// verifyMocks(); -// } -// -// public void testDontSetDriverPathOnStartIfNotDriver() { -// expect(humbleEditorMock.getActiveEditor()).andStubReturn(editorPartMock1); -// replayMocks(); -// -// createEditorManager(); -// verifyMocks(); -// } -// -// public void testSetDriverPathOnActivationAndDriver() { -// expect(sharedProjectMock.isDriver()).andStubReturn(true); -// -// sharedProjectMock.setActiveDriverEditor(path1, false); -// replayMocks(); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.partActivated(editorPartMock1); -// verifyMocks(); -// } -// -// public void testDontSetDriverPathOnActivationIfNotDriver() { -// replayMocks(); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.partActivated(editorPartMock1); -// verifyMocks(); -// } -// -// // TODO fix -// public void testSetText() { -// IFile fileMock = createMock(IFile.class); -// IProject projectMock = createMock(IProject.class); -// -// expect(sharedProjectMock.getActiveDriverEditor()).andStubReturn(path1); -// expect(sharedProjectMock.getProject()).andStubReturn(projectMock); -// expect(projectMock.getFile(path1)).andStubReturn(fileMock); -// -// humbleEditorMock.setText(fileMock, 5, 3, "abc"); -// replayMocks(); -// replay(projectMock); -// replay(fileMock); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.exec(new TextEditActivity(5, "abc", 3)); -// verifyMocks(); -// verify(projectMock); -// verify(fileMock); -// } -// -// public void testUpdateSelectionAfterSetText() { -// IProject projectMock = createMock(IProject.class); -// IFile file = createMock(IFile.class); -// -// expect(sharedProjectMock.getProject()).andStubReturn(projectMock); -// expect(projectMock.getFile(path1)).andStubReturn(file); -// expect(sharedProjectMock.getActiveDriverEditor()).andStubReturn(path1); -// humbleEditorMock.setSelection(editorPartMock1, new TextSelection(5, 0)); -// replayMocks(); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.exec(new TextEditActivity(5, "abc", 3)); -// verifyMocks(); -// } -// -// public void testSetSelection() { -// expect(sharedProjectMock.getActiveDriverEditor()).andStubReturn(path1); -// humbleEditorMock.setSelection(editorPartMock1, new TextSelection(15, 2)); -// replayMocks(); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.exec(new TextSelectionActivity(15, 2)); -// verifyMocks(); -// } -// -// public void testAttachListenerToActivatedEditorIfDriver() { -// expect(sharedProjectMock.isDriver()).andStubReturn(true); -// -// humbleEditorMock.addSharedEditorListener(editorPartMock1); -// replayMocks(); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.partActivated(editorPartMock1); -// verifyMocks(); -// } -// -// public void testSetAllEditorsToEditable() { -// expect(sharedProjectMock.isDriver()).andStubReturn(true); -// humbleEditorMock.setEditable(editorPartMock1, true); -// humbleEditorMock.setEditable(editorPartMock2, true); -// replayMocks(); -// -// createEditorManager(); -// verifyMocks(); -// } -// -// public void testSetSelectionAfterActivatingDriverEditor() { -// expect(sharedProjectMock.getActiveDriverEditor()).andStubReturn(path1); -// expect(sharedProjectMock.getDriverTextSelection()).andStubReturn(new TextSelection(23, 42)); -// humbleEditorMock.setSelection(editorPartMock1, new TextSelection(23, 42)); -// replayMocks(); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.partActivated(editorPartMock1); -// verifyMocks(); -// } -// -// public void testOpenEditorIfFollowMode() { -// IProject projectMock = createMock(IProject.class); -// IFile fileMock = createMock(IFile.class); -// -// expect(sharedProjectMock.getActiveDriverEditor()).andStubReturn(path1); -// expect(sharedProjectMock.getProject()).andStubReturn(projectMock); -// expect(projectMock.getFile(path1)).andStubReturn(fileMock); -// humbleEditorMock.openEditor(fileMock); -// replayMocks(); -// replay(projectMock, fileMock); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.setEnableFollowing(true); -// editorManager.exec(new TextEditActivity(5, "abc", 3)); -// verifyMocks(); -// verify(projectMock, fileMock); -// } -// -// public void testFireTextLoadActivity() { -// IActivityListener activityListenerMock = createMock(IActivityListener.class); -// activityListenerMock.activityCreated(new TextEditActivity(5, "test", 1)); -// replayMocks(); -// replay(activityListenerMock); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.addActivityListener(activityListenerMock); -// editorManager.textChanged(5, "test", 1); -// verifyMocks(); -// verify(activityListenerMock); -// } -// -// public void testSendTextSelectionsAfterBecomingDriver() { -// expect(humbleEditorMock.getActiveEditor()).andStubReturn(editorPartMock2); -// expect(sharedProjectMock.isDriver()).andReturn(false).times(3).andReturn(true); -// IActivityListener activityListenerMock = createMock(IActivityListener.class); -// -// activityListenerMock.activityCreated(new TextSelectionActivity(5, 10)); -// replayMocks(); -// replay(activityListenerMock); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.addActivityListener(activityListenerMock); -// -// editorManager.driverChanged(new JID("dummy"), true); -// editorManager.selectionChanged(new TextSelection(5, 10)); -// -// verifyMocks(); -// verify(activityListenerMock); -// } -// -// public void testSendTextLoadAfterBecomingDriver() { -// expect(humbleEditorMock.getActiveEditor()).andStubReturn(editorPartMock2); -// expect(sharedProjectMock.isDriver()).andReturn(false).times(2).andStubReturn(true); -// sharedProjectMock.setActiveDriverEditor(path2, false); -// replayMocks(); -// -// EditorManager editorManager = createEditorManager(); -// editorManager.driverChanged(new JID("dummy"), true); -// verifyMocks(); -// } -// -// public void testDontConnectMultipleTimesWhileEditorOpen() { -// expect(sharedProjectMock.isDriver()).andStubReturn(true); -// humbleEditorMock.addSharedEditorListener(editorPartMock1); -// humbleEditorMock.addSharedEditorListener(editorPartMock2); -// replayMocks(); // HACK -// -// EditorManager editorManager = createEditorManager(); -// editorManager.partActivated(editorPartMock1); -// editorManager.partActivated(editorPartMock2); -// editorManager.partActivated(editorPartMock1); -// verifyMocks(); -// } -// -// private EditorManager createEditorManager() { -// return new EditorManager(sharedProjectMock, editorAPIMock); -// } - - private void replayMocks() { - replay(sharedProjectMock, editorAPIMock, editorMock1, editorMock2); - } - - private void verifyMocks() { - verify(sharedProjectMock, editorAPIMock, editorMock1, editorMock2); - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/FileListTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/FileListTest.java deleted file mode 100644 index 17089a9f7b392de36e2b4886cf5c458b6e801823..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/FileListTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * DPP - Serious Distributed Pair Programming - * (c) Freie Universit�t Berlin - Fachbereich Mathematik und Informatik - 2006 - * (c) Riad Djemili - 2006 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package de.fu_berlin.inf.dpp.test; - -import java.io.IOException; -import java.util.Collection; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.xmlpull.v1.XmlPullParserException; - -import de.fu_berlin.inf.dpp.FileList; -import de.fu_berlin.inf.dpp.test.stubs.FileStub; - -public class FileListTest extends TestCase { - private IFile[] files; - private IFile[] otherFiles; - - private FileList fileList; - private FileList otherFileList; - - @Override - protected void setUp() throws Exception { - files = new IFile[] { - new FileStub("root.txt", "this in the root"), - new FileStub("foo/bar/unit.java", "class Test {}"), - new FileStub("foo/bar/test.txt", "") - }; - fileList = new FileList(files); - - otherFiles = new IFile[] { - new FileStub("root.txt", "this in the root"), - new FileStub("foo/bar/unit.java", "class Test {void foo(){}}"), - new FileStub("foo/test.txt", "another test content") - }; - otherFileList = new FileList(otherFiles); - } - - @Override - protected void tearDown() throws Exception { - } - - public void testGetFilePaths() { - List<IPath> paths = fileList.getPaths(); - - assertPaths(new String[]{"root.txt", "foo/bar/unit.java", "foo/bar/test.txt"}, paths); - } - - public void testGetFileUnalteredPaths() { - Collection<IPath> paths = fileList.getUnalteredPaths(); - - assertPaths(new String[]{"root.txt", "foo/bar/unit.java", "foo/bar/test.txt"}, paths); - } - - public void testDiffGetAddedFilePaths() { - Collection<IPath> paths = fileList.diff(otherFileList).getAddedPaths(); - - assertPaths(new String[]{"foo/test.txt"}, paths); - } - - public void testReversedDiffGetAddedFilePaths() { - Collection<IPath> paths = otherFileList.diff(fileList).getAddedPaths(); - - assertPaths(new String[]{"foo/bar/test.txt"}, paths); - } - - public void testDiffGetRemovedFilePaths() { - Collection<IPath> paths = fileList.diff(otherFileList).getRemovedPaths(); - - assertPaths(new String[]{"foo/bar/test.txt"}, paths); - } - - public void testReversedDiffGetRemovedFilePaths() { - Collection<IPath> paths = otherFileList.diff(fileList).getRemovedPaths(); - - assertPaths(new String[]{"foo/test.txt"}, paths); - } - - public void testDiffGetAlteredFilePaths() { - Collection<IPath> paths = fileList.diff(otherFileList).getAlteredPaths(); - - assertPaths(new String[]{"foo/bar/unit.java"}, paths); - } - - public void testReversedDiffGetAlteredFilePaths() { - Collection<IPath> paths = otherFileList.diff(fileList).getAlteredPaths(); - - assertPaths(new String[]{"foo/bar/unit.java"}, paths); - } - - public void testDiffGetUnalteredFilePaths() { - Collection<IPath> paths = fileList.diff(otherFileList).getUnalteredPaths(); - - assertPaths(new String[]{"root.txt"}, paths); - } - - public void testReversedDiffGetUnalteredFilePaths() { - Collection<IPath> paths = otherFileList.diff(fileList).getUnalteredPaths(); - - assertPaths(new String[]{"root.txt"}, paths); - } - - public void testDiffGetFilePaths() { - Collection<IPath> paths = fileList.diff(otherFileList).getPaths(); - - assertPaths(new String[]{"root.txt", "foo/bar/unit.java", "foo/test.txt"}, paths); - } - - public void testMatch() { - assertEquals(33, fileList.match(otherFileList)); - assertEquals(33, otherFileList.match(fileList)); - assertEquals(100, fileList.match(fileList)); - } - - public void testEquals() throws CoreException { - FileList sameFileList = new FileList(files); - assertEquals(fileList, sameFileList); - - assertFalse(fileList.equals(otherFileList)); - } - - public void testRoundtripSerialization() throws XmlPullParserException, IOException { - FileList replicated = new FileList(fileList.toXML()); - assertEquals(fileList, replicated); - } - - private void assertPaths(String[] expected, Collection<IPath> actual) { - for (int i = 0; i < expected.length; i++) { - Path path = new Path(expected[i]); - assertTrue(actual.contains(path)); - } - - assertEquals(expected.length, actual.size()); - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/JIDTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/JIDTest.java deleted file mode 100644 index a0c8c418b602ff7d5daae96d068dc132c7c49fc9..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/JIDTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * DPP - Serious Distributed Pair Programming - * (c) Freie Universit�t Berlin - Fachbereich Mathematik und Informatik - 2006 - * (c) Riad Djemili - 2006 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package de.fu_berlin.inf.dpp.test; - -import de.fu_berlin.inf.dpp.net.JID; -import junit.framework.TestCase; - -public class JIDTest extends TestCase { - private JID id; - private JID idWithResource; - - @Override - protected void setUp() throws Exception { - id = new JID("riad@jabber.org"); - idWithResource = new JID("riad@jabber.org/saros"); - } - - public void testMalformatedJID() { - try { - new JID("riad"); - fail(); - } catch (IllegalArgumentException e) { - // okay - } - } - - public void testGetUser() { - assertEquals("riad", id.getName()); - assertEquals("riad", idWithResource.getName()); - } - - public void testGetHost() { - assertEquals("jabber.org", id.getDomain()); - assertEquals("jabber.org", idWithResource.getDomain()); - } - - public void testGetResource() { - assertEquals("", id.getResource()); - assertEquals("saros", idWithResource.getResource()); - } - - public void testGetBase() { - assertEquals("riad@jabber.org", id.getBase()); - assertEquals("riad@jabber.org", idWithResource.getBase()); - } - - public void testEquals() { - assertEquals(id, id); - assertEquals(idWithResource, idWithResource); - assertEquals(id, idWithResource); - - assert !id.equals(new JID("bob@jabber.org")); - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/RequestExtensionProviderTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/RequestExtensionProviderTest.java deleted file mode 100644 index 394cd65de8a44ff13f6bb23a2cf6fd55896b9ea5..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/RequestExtensionProviderTest.java +++ /dev/null @@ -1,117 +0,0 @@ -package de.fu_berlin.inf.dpp.test; - -import java.io.IOException; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.Path; -import org.xmlpull.mxp1.MXParser; -import org.xmlpull.v1.XmlPullParserException; - -import de.fu_berlin.inf.dpp.activities.IActivity; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.concurrent.jupiter.VectorTime; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.JupiterVectorTime; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.RequestImpl; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.NoOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.SplitOperation; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.net.internal.RequestExtensionProvider; -import de.fu_berlin.inf.dpp.net.internal.RequestPacketExtension; - - -import junit.framework.TestCase; - -public class RequestExtensionProviderTest extends TestCase{ - private MXParser parser; - - - - public void testInsertRequest() throws XmlPullParserException, IOException{ - Request req = new RequestImpl(1,new JupiterVectorTime(1,3),new InsertOperation(34,"insert text")); - req.setEditorPath(new Path("hello")); - req.setJID(new JID("ori79@jabber.cc")); - RequestPacketExtension requestPacket = new RequestPacketExtension(req); - RequestExtensionProvider provider = new RequestExtensionProvider(); - - parser = new MXParser(); - parser.setInput(new StringReader(requestPacket.toXML())); - - RequestPacketExtension requestExtension = (RequestPacketExtension)provider.parseExtension(parser); - assertEquals(req,requestExtension.getRequest()); - } - - public void testDeleteRequest() throws XmlPullParserException, IOException{ - Request req = new RequestImpl(1,new JupiterVectorTime(1,3),new DeleteOperation(34,"insert text")); - req.setEditorPath(new Path("hello")); - req.setJID(new JID("ori79@jabber.cc")); - RequestPacketExtension requestPacket = new RequestPacketExtension(req); - RequestExtensionProvider provider = new RequestExtensionProvider(); - - parser = new MXParser(); - parser.setInput(new StringReader(requestPacket.toXML())); - - RequestPacketExtension requestExtension = (RequestPacketExtension)provider.parseExtension(parser); - assertEquals(req,requestExtension.getRequest()); - } - - public void testNoOPRequest() throws XmlPullParserException, IOException{ - Request req = new RequestImpl(1,new JupiterVectorTime(1,3),new NoOperation()); - req.setEditorPath(new Path("hello")); - req.setJID(new JID("ori79@jabber.cc")); - RequestPacketExtension requestPacket = new RequestPacketExtension(req); - RequestExtensionProvider provider = new RequestExtensionProvider(); - - parser = new MXParser(); - parser.setInput(new StringReader(requestPacket.toXML())); - - RequestPacketExtension requestExtension = (RequestPacketExtension)provider.parseExtension(parser); - assertEquals(req,requestExtension.getRequest()); - } - - public void testSplitRequest() throws XmlPullParserException, IOException{ - Request req = new RequestImpl(1,new JupiterVectorTime(1,3),new SplitOperation(new InsertOperation(34,"insert text"),new DeleteOperation(34,"insert text"))); - req.setEditorPath(new Path("hello")); - req.setJID(new JID("ori79@jabber.cc")); - RequestPacketExtension requestPacket = new RequestPacketExtension(req); - RequestExtensionProvider provider = new RequestExtensionProvider(); - - parser = new MXParser(); - parser.setInput(new StringReader(requestPacket.toXML())); - - RequestPacketExtension requestExtension = (RequestPacketExtension)provider.parseExtension(parser); - assertEquals(req,requestExtension.getRequest()); - } - - public void testSplitRequest2() throws XmlPullParserException, IOException{ - Request req = new RequestImpl(1,new JupiterVectorTime(1,3),new SplitOperation(new DeleteOperation(34,"insert text"),new DeleteOperation(37,"insert text"))); - req.setEditorPath(new Path("hello")); - req.setJID(new JID("ori79@jabber.cc")); - RequestPacketExtension requestPacket = new RequestPacketExtension(req); - RequestExtensionProvider provider = new RequestExtensionProvider(); - - parser = new MXParser(); - parser.setInput(new StringReader(requestPacket.toXML())); - - RequestPacketExtension requestExtension = (RequestPacketExtension)provider.parseExtension(parser); - assertEquals(req,requestExtension.getRequest()); - } - - public void testSplitRequest3() throws XmlPullParserException, IOException{ - Request req = new RequestImpl(1,new JupiterVectorTime(1,3),new SplitOperation(new DeleteOperation(34,"insert text"),new NoOperation())); - req.setEditorPath(new Path("hello")); - req.setJID(new JID("ori79@jabber.cc")); - RequestPacketExtension requestPacket = new RequestPacketExtension(req); - RequestExtensionProvider provider = new RequestExtensionProvider(); - - parser = new MXParser(); - parser.setInput(new StringReader(requestPacket.toXML())); - - RequestPacketExtension requestExtension = (RequestPacketExtension)provider.parseExtension(parser); - assertEquals(req,requestExtension.getRequest()); - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/SarosTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/SarosTest.java deleted file mode 100644 index 912c09f0020a65c1379269fac79354ca2ed993a9..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/SarosTest.java +++ /dev/null @@ -1,254 +0,0 @@ -package de.fu_berlin.inf.dpp.test; - -import java.util.Collection; -import java.util.Iterator; -import java.util.logging.Logger; - -import junit.framework.TestCase; - -import org.jivesoftware.smack.ConnectionConfiguration; -import org.jivesoftware.smack.PacketListener; -import org.jivesoftware.smack.Roster; -import org.jivesoftware.smack.RosterEntry; -import org.jivesoftware.smack.RosterGroup; -import org.jivesoftware.smack.RosterListener; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.Roster.SubscriptionMode; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.Presence; -import org.jivesoftware.smack.packet.RosterPacket; -import org.jivesoftware.smack.packet.RosterPacket.ItemType; -import org.jivesoftware.smackx.filetransfer.FileTransferManager; - -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.invitation.internal.XMPPChatTransmitterFileTransferTest; -import de.fu_berlin.inf.dpp.test.net.RosterListenerImpl; - -public class SarosTest extends TestCase { - - static { - XMPPConnection.DEBUG_ENABLED = true; - Roster.setDefaultSubscriptionMode(SubscriptionMode.accept_all); - } - - private static Logger logger = Logger.getLogger(XMPPTestCase.class - .toString()); - - public XMPPConnection connection = null; - public XMPPConnection received_connection = null; - - - public static String server = "jabber.org"; - public static String User1 = "ori78@"+server; - public static String User2 = "ori79@"+server; - - - // public FileTransferManager transferManager1 = null; - - public SarosTest() { - // super("jabber.org"); - } - - @Override - public void setUp() throws XMPPException { - ConnectionConfiguration conConfig = new ConnectionConfiguration( - "jabber.cc"); - // conConfig.setSocketFactory(SocketFactory.getDefault()); - - conConfig.setReconnectionAllowed(true); - // try{ - connection = new XMPPConnection(server); - received_connection = new XMPPConnection(server); - - // connection1 = new XMPPConnection(conConfig); - - // while (!connection1.isAuthenticated()) { - // System.out.println("connecting user1"); - connection.connect(); - received_connection.connect(); - - connection.login("ori78", "123456"); - received_connection.login("ori79", "123456"); - logger.info("connection established."); - } - - @Override - public void tearDown() { - connection.disconnect(); - received_connection.disconnect(); - } - - - /** - * 1. Löschen der Entry Listen - * 2. Hinzufügen von RosterListener zu B - * 3. A.CreateEntry(B) - * - * B hat Presence von A. - * @throws XMPPException - * @throws InterruptedException - */ - public void xtestCreateEntryA() throws XMPPException, InterruptedException{ - Roster re_roster = received_connection.getRoster(); - RosterListenerImpl list2 = new RosterListenerImpl(received_connection, - re_roster); - received_connection.addPacketListener(list2, null); - - - Roster roster = connection.getRoster(); - RosterListenerImpl list1 = new RosterListenerImpl(connection, - roster); - connection.addPacketListener(list1, null); - - /* delete lists.*/ - emptyUserList(roster); - Thread.sleep(1000); - emptyUserList(re_roster); - - - - roster.addRosterListener(list1); - roster.reload(); - re_roster.addRosterListener(list2); - re_roster.reload(); - - Thread.sleep(1000); -// Presence presence = new Presence( -// Presence.Type.subscribe); -// presence.setTo(received_connection.getUser()); -// presence.setFrom(connection.getUser()); -// connection.sendPacket(presence); - - /*2. neue Verbindung erstellen. */ - roster.createEntry(User2, User2, null); - - Thread.sleep(2000); - - roster.reload(); - re_roster.reload(); - - Thread.sleep(2000); - Collection<RosterEntry> entries = re_roster.getEntries(); - for(RosterEntry entry : entries){ - - Presence p = re_roster.getPresence(entry.getUser()); - if(p != null){ - System.out.println(p.getType()); - } - } - - entries = re_roster.getEntries(); - for(RosterEntry entry : entries){ - - Presence p = roster.getPresence(entry.getUser()); - if(p != null){ - System.out.println(p.getType()); - } - } - -// Thread.sleep(500); -// assertEquals(1, roster.getEntryCount()); -// assertEquals(1,re_roster.getEntryCount()); - - } - - public void xtestCreateAccount() throws XMPPException, InterruptedException{ - XMPPConnection connection = new XMPPConnection(server); - connection.connect(); - connection.getAccountManager().createAccount("ori78", "123456"); - Thread.sleep(1000); - connection.getAccountManager().createAccount("ori79", "123456"); - } - - public void xtestDeleteAccount() throws XMPPException{ - connection.getAccountManager().deleteAccount(); - received_connection.getAccountManager().deleteAccount(); - } - - public void testDeleteAllEntries() throws XMPPException, InterruptedException { - Roster re_roster = received_connection.getRoster(); - RosterListenerImpl list2 = new RosterListenerImpl(received_connection, - re_roster); - received_connection.addPacketListener(list2, null); - - - Roster roster = connection.getRoster(); - RosterListenerImpl list1 = new RosterListenerImpl(connection, - roster); - connection.addPacketListener(list1, null); - - /* delete lists.*/ - emptyUserList(roster); - Thread.sleep(1000); - emptyUserList(re_roster); - - - - } - - public void xtestPresence() throws InterruptedException, XMPPException{ - Roster re_roster = received_connection.getRoster(); - RosterListenerImpl list2 = new RosterListenerImpl(received_connection, - re_roster); - re_roster.addRosterListener(list2); - received_connection.addPacketListener(list2, null); - re_roster.reload(); - - Roster roster = connection.getRoster(); - RosterListenerImpl list1 = new RosterListenerImpl(connection, - roster); - roster.addRosterListener(list1); - connection.addPacketListener(list1, null); - roster.reload(); - - Thread.sleep(2000); - Collection<RosterEntry> entries = roster.getEntries(); - for(RosterEntry entry : entries){ - - System.out.println("entry : "+entry.getUser()); - Presence p = roster.getPresence(entry.getUser()); - if(p != null){ - System.out.println(p.getType()); - } - } - - entries = re_roster.getEntries(); - for(RosterEntry entry : entries){ - - Presence p = re_roster.getPresence(entry.getUser()); - if(p != null){ - System.out.println(p.getType()); - } - } - - } - - - private void emptyUserList(Roster roster) throws XMPPException { - logger.info("empty list"); - - System.out.println("count before : " + roster.getEntryCount()); - Collection<RosterEntry> entries = roster.getEntries(); - try { - for (RosterEntry entry : entries) { - System.out.println(""+entry.getName()+" "+entry.getUser()+" "+entry.getStatus()+" "+entry.getType()); - roster.removeEntry(entry); - Thread.sleep(500); - } - - Thread.sleep(500); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - System.out.println("count after: " + roster.getEntryCount()); -// assertEquals(0, roster.getEntryCount()); - - } - - - - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/SmackFileTransferTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/SmackFileTransferTest.java deleted file mode 100644 index 4efeba583fa690f830701ed1e3874306470471b0..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/SmackFileTransferTest.java +++ /dev/null @@ -1,430 +0,0 @@ -package de.fu_berlin.inf.dpp.test; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.PrintWriter; - -import junit.framework.TestCase; - -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smackx.filetransfer.FileTransferListener; -import org.jivesoftware.smackx.filetransfer.FileTransferManager; -import org.jivesoftware.smackx.filetransfer.FileTransferRequest; -import org.jivesoftware.smackx.filetransfer.IncomingFileTransfer; -import org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer; -import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; - -import de.fu_berlin.inf.dpp.FileList; -import de.fu_berlin.inf.dpp.Saros; - -public class SmackFileTransferTest extends TestCase { - static { - XMPPConnection.DEBUG_ENABLED = true; - } - - private static Logger logger = Logger - .getLogger(SmackFileTransferTest.class); - - private static final int MAX_TRANSFER_RETRIES = 5; - - protected class FileTransferListenerImpl implements FileTransferListener { - - - public void fileTransferRequest(FileTransferRequest request) { - // Check to see if the request should be accepted - // if(shouldAccept(request)) { - // Accept it - - logger.info("Incomming file "+request.getRequestor()); - IncomingFileTransfer transfer = request.accept(); - String filename = request.getFileName()+"."+request.getRequestor().substring(0, request.getRequestor().indexOf("@")); - try { - - transfer.recieveFile(new File(filename)); - } catch (XMPPException e) { - // TODO Auto-generated catch block - logger.error(e); - } - - if (new File(filename).exists()) { -// new File("Testfile2.txt").deleteOnExit(); - logger.debug("File exists and will delete."); - } - // } else { - // // Reject it - // request.reject(); - // } - - } - - } - - private XMPPConnection connection1; - private FileTransferManager transferManager1; - - private XMPPConnection connection2; - private FileTransferManager transferManager2; - - protected void setUp() throws Exception { - PropertyConfigurator.configureAndWatch("log4j.properties", 60 * 1000); - Logger logger = Logger.getLogger("de.fu_berlin.inf.dpp"); - - connection1 = new XMPPConnection("jabber.cc"); - // while (!connection1.isAuthenticated()) { - // System.out.println("connecting user1"); - connection1.connect(); - connection1.login("ori79", "123456"); - // } - transferManager1 = new FileTransferManager(connection1); - logger.info("connection 1 established."); - Thread.sleep(1000); - - connection2 = new XMPPConnection("jabber.cc"); - // while (!connection2.isAuthenticated()) { - - connection2.connect(); - connection2.login("ori78", "123456"); - // } - logger.info("connection 1 established."); - transferManager2 = new FileTransferManager(connection2); - Thread.sleep(1000); - } - - protected void tearDown() throws Exception { - connection1.disconnect(); - connection2.disconnect(); - } - - public void XtestFileTransferWithStrings() { - transferManager2 - .addFileTransferListener(new FileTransferListenerImpl()); - - // Create the outgoing file transfer - OutgoingFileTransfer transfer = transferManager1 - .createOutgoingFileTransfer(connection2.getUser()); - - // Send the file - try { - transfer.sendFile(new File("Testfile.txt"), - "You won't believe this!"); - - while (!transfer.isDone()) { - if (transfer.getStatus().equals(Status.error)) { - logger.error("ERROR!!! " + transfer.getError()); - } else { - logger.debug("Status : " + transfer.getStatus()); - logger.debug("Progress : " + transfer.getProgress()); - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - if (transfer.getStatus().equals(Status.complete)) { - logger.debug("transfer complete"); - } - } catch (XMPPException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - public void testWithViceVersaFileTransfer() throws Exception{ - transferManager2.addFileTransferListener(new FileTransferListenerImpl()); - transferManager1.addFileTransferListener(new FileTransferListenerImpl()); - - sendFile("Testfile.txt",transferManager1,connection2.getUser() ); - Thread.sleep(1000); - sendFile("Testfile.txt",transferManager2,connection1.getUser() ); - } - -// public void testFileTransferWithPeers() { -// transferManager2 -// .addFileTransferListener(new FileTransferListenerImpl()); -// -// // Create the outgoing file transfer -// OutgoingFileTransfer transfer = transferManager1 -// .createOutgoingFileTransfer(connection2.getUser()); -// -// // Send the file -// try { -// OutputStream out = transfer.sendFile("Testfile.txt", new File( -// "Testfile.txt").length(), "You won't believe this!"); -// try { -// out -// .write(new String( -// "Der Inhalt der zu übertragenen Testdatei") -// .getBytes()); -// } catch (IOException e1) { -// // TODO Auto-generated catch block -// e1.printStackTrace(); -// } -// while (!transfer.isDone()) { -// if (transfer.getStatus().equals(Status.error)) { -// logger.error("ERROR!!! " + transfer.getError()); -// } else { -// logger.debug("Status : " + transfer.getStatus()); -// logger.debug("Progress : " + transfer.getProgress()); -// } -// try { -// Thread.sleep(1000); -// } catch (InterruptedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } -// -// if (transfer.getStatus().equals(Status.complete)) { -// logger.debug("transfer complete"); -// } -// } catch (XMPPException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// -// } - - private void sendFile(String file, FileTransferManager manager, String user ) { - - // Create the outgoing file transfer - OutgoingFileTransfer transfer = manager - .createOutgoingFileTransfer(user); - - // Send the file - try { - File sendFile = new File(file); - if(!sendFile.exists()){ - return; - } - transfer.sendFile(new File(file), - "You won't believe this!"); - - while (!transfer.isDone()) { - if (transfer.getStatus().equals(Status.error)) { - logger.error("ERROR!!! " + transfer.getError()); - } else { - logger.debug("Status : " + transfer.getStatus()); - logger.debug("Progress : " + transfer.getProgress()); - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - logger.error(e); - } - } - - if (transfer.getStatus().equals(Status.complete)) { - logger.debug("transfer complete"); - } - } catch (XMPPException e) { - // TODO Auto-generated catch block - logger.error(e); - } - } - - public void XtestWriteStringIntoFileAndTranfer() { - transferManager2 - .addFileTransferListener(new FileTransferListenerImpl()); - - // Create the outgoing file transfer - OutgoingFileTransfer transfer = transferManager1 - .createOutgoingFileTransfer(connection2.getUser()); - - try { - if (new File("WriteTestfile.txt").exists()) { - new File("WriteTestfile.txt").delete(); - } - - FileWriter writer = new FileWriter("WriteTestfile.txt"); - writer.append("Dies ist der inhalt des File" + '\n' - + "Mal Schauen, wie der ankommt."); - writer.close(); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - // Send the file - try { - transfer.sendFile(new File("WriteTestfile.txt"), - "You won't believe this!"); - - while (!transfer.isDone()) { - if (transfer.getStatus().equals(Status.error)) { - logger.error("ERROR!!! " + transfer.getError()); - } else { - logger.debug("Status : " + transfer.getStatus()); - logger.debug("Progress : " + transfer.getProgress()); - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } catch (XMPPException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - // public void testSingleFileTransfer() throws XMPPException, IOException { - // System.out.println("=== testSingleFileTransfer ==="); - // - // transferManager2.addFileTransferListener(new FileTransferListener() { - // public void fileTransferRequest(FileTransferRequest request) { - // receiveText(request); - // } - // }); - // - // sendText(transferManager1, "saros3@jabber.org/Smack", "HEHE"); - // } - // - // public void testViceVersaFileTransfer() throws XMPPException, IOException - // { - // System.out.println("=== testViceVersaFileTransfer ==="); - // - // transferManager2.addFileTransferListener(new FileTransferListener() { - // public void fileTransferRequest(FileTransferRequest request) { - // try { - // receiveText(request); - // sendText(transferManager2, "saros1@jabber.org/Smack", "TETE"); - // } catch (Exception e) { - // e.printStackTrace(); - // } - // } - // }); - // - // transferManager1.addFileTransferListener(new FileTransferListener() { - // public void fileTransferRequest(FileTransferRequest request) { - // try { - // receiveText(request); - // } catch (Exception e) { - // e.printStackTrace(); - // } - // } - // }); - // - // sendText(transferManager1, "saros3@jabber.org/Smack", "HEHE"); - // } - // - // public void testConcurrentFileTransfers() throws XMPPException, - // IOException { - // System.out.println("=== testViceVersaFileTransfer ==="); - // - // transferManager2.addFileTransferListener(new FileTransferListener() { - // public void fileTransferRequest(FileTransferRequest request) { - // try { - // receiveText(request); - // } catch (Exception e) { - // e.printStackTrace(); - // } - // } - // }); - // - // asyncSendText(transferManager1, "saros3@jabber.org/Smack", "HEHE1"); - // asyncSendText(transferManager1, "saros3@jabber.org/Smack", "HEHE2"); - // asyncSendText(transferManager1, "saros3@jabber.org/Smack", "HEHE3"); - // } - // - // public static void main(String[] args) { - // try { - // SmackFileTransferTest test = new SmackFileTransferTest(); - // test.setUp(); - // test.testConcurrentFileTransfers(); - // - // } catch (Exception e) { - // // TODO Auto-generated catch block - // e.printStackTrace(); - // } - // } - // - // private void sendText(FileTransferManager transferManager, String to, - // String text) throws XMPPException, IOException { - // - // System.out.println("Sending text("+text+") to "+to); - // - // OutgoingFileTransfer transfer = - // transferManager.createOutgoingFileTransfer(to); - // - // OutputStream out = transfer.sendFile("test file", - // text.getBytes().length, "test desc"); - // - // BufferedWriter writer = new BufferedWriter(new PrintWriter(out)); - // writer.write(text); - // writer.flush(); - // writer.close(); - // - // System.out.println("Sent text("+text+") to "+to); - // } - // - // private String receiveText(FileTransferRequest request) { - // String text = null; - // - // System.out.println("Receiving text from "+request.getRequestor()); - // - // final IncomingFileTransfer transfer = request.accept(); - // - // try { - // InputStream in = transfer.recieveFile(); - // BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - // StringBuffer sb = new StringBuffer(); - // - // try { - // String line = null; - // - // while((line=reader.readLine()) != null) { - // sb.append(line); - // } - // } catch(Throwable e) { - // e.printStackTrace(); - // - // } finally { - // reader.close(); - // } - // - // text = sb.toString(); - // - // System.out.println("Received text("+text+") from - // "+request.getRequestor()); - // - // } catch (Throwable e) { - // e.printStackTrace(); - // } - // - // return text; - // } - // - // private void asyncSendText(final FileTransferManager transferManager, - // final String to, final String text) { - // - // new Thread(new Runnable() { - // public void run() { - // try { - // sendText(transferManager, to, text); - // } catch (XMPPException e) { - // // TODO Auto-generated catch block - // e.printStackTrace(); - // } catch (IOException e) { - // // TODO Auto-generated catch block - // e.printStackTrace(); - // } - // } - // }).start(); - // } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/TestHelper.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/TestHelper.java deleted file mode 100644 index 1e3a8316eb3bdadfef4d0c1d173ba98c62ed09a4..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/TestHelper.java +++ /dev/null @@ -1,33 +0,0 @@ - -package de.fu_berlin.inf.dpp.test; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.AssertionFailedError; - -public class TestHelper { - - public static void assertList(Object[] expected, List actual) { - boolean equals = expected.length == actual.size(); - - if (equals) { - for (int i = 0; i < expected.length; i++) { - if (!expected[i].equals(actual.get(i))) { - equals = false; - break; - } - } - } - - if (!equals) { - List<Object> expectedList = new ArrayList<Object>(expected.length); - for (int i = 0; i < expected.length; i++) { - expectedList.add(expected[i]); - } - - throw new AssertionFailedError( - "expected:" + expectedList + " but was " + actual); - } - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/XMPPTestCase.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/XMPPTestCase.java deleted file mode 100644 index f3c5652336092bd48dded884f1ee62a6820d48d8..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/XMPPTestCase.java +++ /dev/null @@ -1,81 +0,0 @@ -package de.fu_berlin.inf.dpp.test; - -import java.util.logging.Logger; - -import org.jivesoftware.smack.ConnectionConfiguration; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smackx.filetransfer.FileTransferManager; - -import de.fu_berlin.inf.dpp.test.invitation.internal.XMPPChatTransmitterFileTransferTest; -import junit.framework.TestCase; - -public abstract class XMPPTestCase extends TestCase{ - - static { - XMPPConnection.DEBUG_ENABLED = true; - } - - private static Logger logger = Logger.getLogger(XMPPChatTransmitterFileTransferTest.class.toString()); - - protected XMPPConnection connection1 = null; - protected FileTransferManager transferManager1 = null; - - protected XMPPConnection connection2 = null; - protected FileTransferManager transferManager2 = null; - - private String server; - - public XMPPTestCase(){ - this.server = "jabber.cc"; - } - - public XMPPTestCase(String server){ - this.server = server; - } - - public void setUp() throws Exception { -// PropertyConfigurator.configureAndWatch("log4j.properties", 60 * 1000); -// Logger logger = Logger.getLogger("de.fu_berlin.inf.dpp"); - - ConnectionConfiguration conConfig = new ConnectionConfiguration("jabber.org"); -// conConfig.setSocketFactory(SocketFactory.getDefault()); - - conConfig.setReconnectionAllowed(true); -// try{ - connection1 = new XMPPConnection(server); -// connection1 = new XMPPConnection(conConfig); - - // while (!connection1.isAuthenticated()) { - // System.out.println("connecting user1"); - connection1.connect(); - - connection1.login("ori79", "123456"); - // } -// } catch(Exception e){ -// e.printStackTrace(); -// XMPPConnection connection = new XMPPConnection("jabber.org"); -// connection.connect(); -// connection.getAccountManager().createAccount("ori78", "123456"); -// } - transferManager1 = new FileTransferManager(connection1); - logger.info("connection 1 established."); - Thread.sleep(1000); - - connection2 = new XMPPConnection(server); - // while (!connection2.isAuthenticated()) { - - connection2.connect(); - connection2.login("ori78", "123456"); - // } - logger.info("connection 1 established."); - transferManager2 = new FileTransferManager(connection2); - - Thread.sleep(1000); - - } - - public void tearDown() { - connection1.disconnect(); - connection2.disconnect(); - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/actions/TestJoinWizardAction.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/actions/TestJoinWizardAction.java deleted file mode 100644 index bc4f646e8669c189db7239186528841ef761fb39..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/actions/TestJoinWizardAction.java +++ /dev/null @@ -1,27 +0,0 @@ -package de.fu_berlin.inf.dpp.test.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -import de.fu_berlin.inf.dpp.test.invitation.internal.mock.IncomingInvitationProcessStub; -import de.fu_berlin.inf.dpp.ui.wizards.JoinSessionWizard; - -public class TestJoinWizardAction extends Action { - - public TestJoinWizardAction() { - setText("test join wizard"); - } - - @Override - public void run() { - try { - Shell shell = Display.getDefault().getActiveShell(); - IncomingInvitationProcessStub processStub = new IncomingInvitationProcessStub(5); - new WizardDialog(shell, new JoinSessionWizard(processStub)).open(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/IncommingInvitationTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/IncommingInvitationTest.java deleted file mode 100644 index e23586954c4630b7bcc6ab47a713cacff78d3a73..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/IncommingInvitationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package de.fu_berlin.inf.dpp.test.invitation.internal; - -import de.fu_berlin.inf.dpp.test.XMPPTestCase; - -/** - * this class simulate and check the function of incoming invitation process. - * - * @author orieger - * - */ - -public class IncommingInvitationTest extends XMPPTestCase{ - - public void testIncommingTest(){ - - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/InvitationProcessTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/InvitationProcessTest.java deleted file mode 100644 index 5ed3e8d864d88659dedc2be8a1e095e32a5ba695..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/InvitationProcessTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package de.fu_berlin.inf.dpp.test.invitation.internal; - - -public class InvitationProcessTest { - - /* Der Invitation process wird vom xmpptransmitter aufgerufen, die logik - * der fortlaufenden prozesses in innerhalb des invitation process gekapselt. - * - * 1. Testen der Einzelfunktionalität. - * 1.1 Testen des empfangen einer Datei durch einen inputstream - * */ - - public void testRessourceReceived(){ -// IIncomingInvitationProcess process = new IncomingInvitationProcess(transmitter, from, -// projectName, description); - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/OutgoingInvitationTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/OutgoingInvitationTest.java deleted file mode 100644 index 7cc3c63e233035d398f81ca555cfcdbb8968925d..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/OutgoingInvitationTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package de.fu_berlin.inf.dpp.test.invitation.internal; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.jivesoftware.smack.XMPPException; - -import de.fu_berlin.inf.dpp.FileList; -import de.fu_berlin.inf.dpp.net.ITransmitter; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.net.internal.XMPPChatTransmitter; -import de.fu_berlin.inf.dpp.test.XMPPTestCase; -import de.fu_berlin.inf.dpp.test.invitation.internal.mock.MockOutgoingInvitationProcess; -import de.fu_berlin.inf.dpp.test.util.FileListHelper; -import de.fu_berlin.inf.dpp.test.util.ResourceHelper; - -public class OutgoingInvitationTest extends TestCase{ - - - - public void testSendMissingfile() throws CoreException, XMPPException { - IProject project = ResourceHelper.getProject("SmalProject"); - FileList list = FileListHelper.createFielListForProject("SmalProject"); - System.out.println(list.toXML()); - - - - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/XMPPChatTransmitterFileTransferTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/XMPPChatTransmitterFileTransferTest.java deleted file mode 100644 index f2946b86a5415431a7209cdb548eab9f584fb182..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/XMPPChatTransmitterFileTransferTest.java +++ /dev/null @@ -1,115 +0,0 @@ -package de.fu_berlin.inf.dpp.test.invitation.internal; - -import java.util.logging.Logger; - -import javax.net.SocketFactory; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.jivesoftware.smack.ConnectionConfiguration; -import org.jivesoftware.smack.SASLAuthentication; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smackx.filetransfer.FileTransferManager; - -import de.fu_berlin.inf.dpp.FileList; -import de.fu_berlin.inf.dpp.invitation.internal.OutgoingInvitationProcess; -import de.fu_berlin.inf.dpp.net.ITransmitter; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.net.internal.XMPPChatTransmitter; -import de.fu_berlin.inf.dpp.test.invitation.internal.mock.MockOutgoingInvitationProcess; -import de.fu_berlin.inf.dpp.test.util.FileListHelper; -import de.fu_berlin.inf.dpp.test.util.ResourceHelper; -import junit.framework.TestCase; - -/** - * this testclass simulate the behavior of file transfer activities of the - * XMPPChatTransmitter. - * @author troll - * - */ -public class XMPPChatTransmitterFileTransferTest extends TestCase{ - - static { - XMPPConnection.DEBUG_ENABLED = true; - } - - private static Logger logger = Logger.getLogger(XMPPChatTransmitterFileTransferTest.class.toString()); - - private XMPPConnection connection1; - private FileTransferManager transferManager1; - - private XMPPConnection connection2; - private FileTransferManager transferManager2; - - public void setUp() throws Exception { -// PropertyConfigurator.configureAndWatch("log4j.properties", 60 * 1000); -// Logger logger = Logger.getLogger("de.fu_berlin.inf.dpp"); - - ConnectionConfiguration conConfig = new ConnectionConfiguration("jabber.org"); -// conConfig.setSocketFactory(SocketFactory.getDefault()); - - conConfig.setReconnectionAllowed(true); - try{ - connection1 = new XMPPConnection("jabber.cc"); -// connection1 = new XMPPConnection(conConfig); - - // while (!connection1.isAuthenticated()) { - // System.out.println("connecting user1"); - connection1.connect(); - - connection1.login("ori79", "123456"); - // } - } catch(Exception e){ - e.printStackTrace(); - XMPPConnection connection = new XMPPConnection("jabber.org"); - connection.connect(); - connection.getAccountManager().createAccount("ori78", "123456"); - } - transferManager1 = new FileTransferManager(connection1); - logger.info("connection 1 established."); - Thread.sleep(1000); - - connection2 = new XMPPConnection("jabber.cc"); - // while (!connection2.isAuthenticated()) { - - connection2.connect(); - connection2.login("ori78", "123456"); - // } - logger.info("connection 1 established."); - transferManager2 = new FileTransferManager(connection2); - - Thread.sleep(1000); - - } - - public void tearDown() { - connection1.disconnect(); - connection2.disconnect(); - } - - /** - * this method test the incomming file transfer of a file list for - * an outgoing invitation process. - * @throws CoreException - * @throws XMPPException - */ - public void testIncommingFileListForOutgoingInvitationProcess() throws CoreException, XMPPException{ - - - -// connection1 = new XMPPConnection(conConfig); - - IProject project = ResourceHelper.getDefaultProject(); - ITransmitter transmitter = new XMPPChatTransmitter(connection1); - - MockOutgoingInvitationProcess out = new MockOutgoingInvitationProcess(transmitter, new JID(connection2.getUser()),"TestFileList",project); -// transmitter.addInvitationProcess(out); - - /* send filelist to outgoing process*/ - FileList list = FileListHelper.createFielListForProject(ResourceHelper.RECEIVED_TEST_PROJECT); - ITransmitter transmitter2 = new XMPPChatTransmitter(connection2); - transmitter2.sendFileList(new JID(connection1.getUser()), list); - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/mock/IncomingInvitationProcessStub.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/mock/IncomingInvitationProcessStub.java deleted file mode 100644 index b6d672ff67c0578b5acffb2b0ee60d88a7ea1a78..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/mock/IncomingInvitationProcessStub.java +++ /dev/null @@ -1,138 +0,0 @@ -package de.fu_berlin.inf.dpp.test.invitation.internal.mock; - -import java.io.InputStream; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; - -import de.fu_berlin.inf.dpp.FileList; -import de.fu_berlin.inf.dpp.invitation.IIncomingInvitationProcess; -import de.fu_berlin.inf.dpp.net.JID; - -public class IncomingInvitationProcessStub implements IIncomingInvitationProcess { - private int seconds; - - public IncomingInvitationProcessStub() { - } - - public IncomingInvitationProcessStub(int seconds) { - this.seconds = seconds; - } - - public FileList requestRemoteFileList(IProgressMonitor monitor) { - if (seconds > 0) - waitWithProgressMonitor(monitor); - - return new FileList(); - } - - public void accept(IProject localProject, String newProjectName, - IProgressMonitor monitor) { - - if (seconds > 0) - waitWithProgressMonitor(monitor); - } - - public FileList getRemoteFileList() { - return new FileList(); - } - - public Exception getException() { - return null; - } - - public State getState() { - return null; - } - - public JID getPeer() { - return new JID("jid@test.org"); - } - - public String getDescription() { - return "test description"; - } - - public void fileListReceived(JID from, FileList fileList) { - } - - public void fileListRequested(JID from) { - } - - public void joinReceived(JID from) { - } - - public void resourceSent(IPath path) { - } - - public void resourceReceived(JID from, IPath path, InputStream input) { - } - - public void cancel(String errorMsg, boolean replicated) { - } - - private void waitWithProgressMonitor(IProgressMonitor monitor) { - monitor.beginTask("test wait", IProgressMonitor.UNKNOWN); - - long start = System.currentTimeMillis(); - while (System.currentTimeMillis() < start + seconds * 1000 ) { - try { - Thread.sleep(200); - monitor.worked(1); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - monitor.done(); - } - - public void setInvitationUI(IInvitationUI inviteUI) { - // TODO Auto-generated method stub - - } - - - public String getProjectName() { - // TODO Auto-generated method stub - return null; - } - - - public void invitationAccepted(JID from) { - // TODO Auto-generated method stub - - } - - - public TransferMode getTransferMode() { - // TODO Auto-generated method stub - return null; - } - - public void jingleFallback() { - // TODO Auto-generated method stub - - } - - public void fileSent(IPath path) { - // TODO Auto-generated method stub - - } - - public void fileTransferFailed(IPath path, Exception e) { - // TODO Auto-generated method stub - - } - - public void transferProgress(int transfered) { - // TODO Auto-generated method stub - - } - - public void setTransferMode(TransferMode mode) { - // TODO Auto-generated method stub - - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/mock/MockOutgoingInvitationProcess.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/mock/MockOutgoingInvitationProcess.java deleted file mode 100644 index 4214dcdc9b0d8bf8a92da8289fd2ad74066bc05a..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/invitation/internal/mock/MockOutgoingInvitationProcess.java +++ /dev/null @@ -1,170 +0,0 @@ -package de.fu_berlin.inf.dpp.test.invitation.internal.mock; - -import java.io.InputStream; - - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; - -import java.util.List; -import java.util.logging.Logger; -import de.fu_berlin.inf.dpp.FileList; -import de.fu_berlin.inf.dpp.invitation.IOutgoingInvitationProcess; -import de.fu_berlin.inf.dpp.invitation.internal.InvitationProcess; -import de.fu_berlin.inf.dpp.net.IFileTransferCallback; -import de.fu_berlin.inf.dpp.net.ITransmitter; -import de.fu_berlin.inf.dpp.net.JID; - - -public class MockOutgoingInvitationProcess extends InvitationProcess implements -IOutgoingInvitationProcess, IFileTransferCallback { - - IProject project; - - private static Logger logger = Logger.getLogger(MockOutgoingInvitationProcess.class.toString()); - - private FileList remoteFileList; - - public MockOutgoingInvitationProcess(ITransmitter transmitter, JID peer, - String description, IProject project) { - super(transmitter, peer, description); - this.project = project; - // TODO Auto-generated constructor stub - } - - - public int getProgressCurrent() { - // TODO Auto-generated method stub - return 0; - } - - public String getProgressInfo() { - // TODO Auto-generated method stub - return null; - } - - - public int getProgressMax() { - // TODO Auto-generated method stub - return 0; - } - - - public void startSynchronization() { - assertState(State.GUEST_FILELIST_SENT); - - setState(State.SYNCHRONIZING); - - try { - FileList local = new FileList(project); - FileList diff = remoteFileList.diff(local); - - List<IPath> added = diff.getAddedPaths(); - List<IPath> altered = diff.getAlteredPaths(); - System.out.println(""); -// toSend = new ArrayList<IPath>(added.size() + altered.size()); -// toSend.addAll(added); -// toSend.addAll(altered); -// -// progress_max = toSend.size(); -// progress_done= 0; -// -// sendNext(); -// -// if (!blockUntilFilesSent() || !blockUntilJoinReceived()) -// cancel(null, false); - - } catch (CoreException e) { - failed(e); - - } - - } - - - public void fileListReceived(JID from, FileList fileList) { - logger.info("file list received."); - setState(State.HOST_FILELIST_SENT); - - assertState(State.HOST_FILELIST_SENT); - - remoteFileList = fileList; - setState(State.GUEST_FILELIST_SENT); - - final IOutgoingInvitationProcess process = this; - - /* start synchronisation .*/ - new Thread(new Runnable(){ - - - public void run() { - logger.info("start sync."); - process.startSynchronization(); - - } - - }).start(); - } - - - public String getProjectName() { - // TODO Auto-generated method stub - return null; - } - - - public void invitationAccepted(JID from) { - // TODO Auto-generated method stub - - } - - - public void joinReceived(JID from) { - // TODO Auto-generated method stub - - } - - - public void resourceReceived(JID from, IPath path, InputStream input) { - logger.info("resource received."); - - } - - public void fileSent(IPath path) { - // TODO Auto-generated method stub - - } - - - public void fileTransferFailed(IPath path, Exception e) { - // TODO Auto-generated method stub - - } - - - public TransferMode getTransferMode() { - // TODO Auto-generated method stub - return null; - } - - - public void jingleFallback() { - // TODO Auto-generated method stub - - } - - - public void transferProgress(int transfered) { - // TODO Auto-generated method stub - - } - - - public void setTransferMode(TransferMode mode) { - // TODO Auto-generated method stub - - } - - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/SynchronizedQueue.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/SynchronizedQueue.java deleted file mode 100644 index 0ba75e2e883407dfaabf94b83aedc2c74af6d860..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/SynchronizedQueue.java +++ /dev/null @@ -1,24 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Algorithm; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.net.JID; - -public interface SynchronizedQueue { - - public JID getJID(); - - public void sendOperation(Operation op); - - public Operation receiveOperation(Request req); - - /** - * send a transformed operation to client side. - * @param op operation has transformed and only send to - * client side. - */ - public void sendTransformedOperation(Operation op, JID toJID); - - public Algorithm getAlgorithm(); -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/TestDifferentProxyScenarios.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/TestDifferentProxyScenarios.java deleted file mode 100644 index fee4ba236a7fd2c8eea4e5f41e4b947887ea6587..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/TestDifferentProxyScenarios.java +++ /dev/null @@ -1,12 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter; - -import junit.framework.TestCase; -/** - * this test class contains test cases for adding and removing client - * with jupiter server. - * @author orieger - * - */ -public class TestDifferentProxyScenarios extends TestCase { - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/ConvergenceProblemTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/ConvergenceProblemTest.java deleted file mode 100644 index 30fe7ad98fd7b96529da625a560c960a9da172b6..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/ConvergenceProblemTest.java +++ /dev/null @@ -1,139 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.puzzles; - -import junit.framework.Test; -import junit.framework.TestSuite; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.text.ClientSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.JupiterTestCase; -import de.fu_berlin.inf.dpp.test.jupiter.text.ServerSynchronizedDocument; - -/** - * This test class contains convergence problem scenarios described in - * "Achieving Convergence with Operational Transformation in Distributed Groupware - * Systems" by Abdessamad Imine, Pascal Molli, Gerald Oster, Michael Rusinowitch. - * - * @author orieger - * - */ -public class ConvergenceProblemTest extends JupiterTestCase{ - - public ConvergenceProblemTest(String method){ - super(method); - } - - /** - * Scenario in fig. 3 described in 3.1 Scenarios violating convergence. - */ - public void testC2PuzzleP1() throws Exception { - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_c3 = new JID("ori81@jabber.cc");; - JID jid_server = new JID("ori78@jabber.cc"); - - String initDocumentState = "core"; - - /* init simulated client and server components. */ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c2); - ClientSynchronizedDocument c3 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c3); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( - network,jid_server); - - /* connect all with simulated network. */ - network.addClient(c1); - network.addClient(c2); - network.addClient(c3); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - s1.addProxyClient(jid_c3); - - Thread.sleep(100); - - /* O3 || O2*/ - c1.sendOperation(new InsertOperation(3,"f"), 100); - c2.sendOperation(new DeleteOperation(2,"r"), 200); - c3.sendOperation(new InsertOperation(2,"f"), 1000); - - Thread.sleep(1500); - - assertEquals(c1.getDocument(),c2.getDocument()); - assertEquals(c2.getDocument(),c3.getDocument()); - assertEquals("coffe",c1.getDocument()); - } - - /** - * Scenario in fig. 5 described in 3.1 Scenarios violating convergence. - */ - public void testC2PuzzleP2() throws Exception { - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_c3 = new JID("ori81@jabber.cc"); - JID jid_c4 = new JID("ori82@jabber.cc"); - JID jid_c5 = new JID("ori83@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - String initDocumentState = "abcd"; - - /* init simulated client and server components. */ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c2); - ClientSynchronizedDocument c3 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c3); - ClientSynchronizedDocument c4 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c4); - ClientSynchronizedDocument c5 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c5); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( - network,jid_server); - - /* connect all with simulated network. */ - network.addClient(c1); - network.addClient(c2); - network.addClient(c3); - network.addClient(c4); - network.addClient(c5); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - s1.addProxyClient(jid_c3); - s1.addProxyClient(jid_c4); - s1.addProxyClient(jid_c5); - - Thread.sleep(100); - - c1.sendOperation(new DeleteOperation(1,"a"), 100); - c4.sendOperation(new InsertOperation(3,"x"), 1000); - c5.sendOperation(new DeleteOperation(3,"c"), 1100); - - c1.sendOperation(new InsertOperation(3,"x"), 1500); - Thread.sleep(2000); - - assertEquals(c1.getDocument(),c2.getDocument()); - assertEquals(c2.getDocument(),c3.getDocument()); - assertEquals(c3.getDocument(),c4.getDocument()); - assertEquals(c4.getDocument(),c5.getDocument()); - assertEquals("acxx",c1.getDocument()); - - } - - public static Test suite() { - TestSuite suite = new TestSuite("Convergence violating scenarios."); - //$JUnit-BEGIN$ - suite.addTest(new ConvergenceProblemTest("testC2PuzzleP1")); - suite.addTest(new ConvergenceProblemTest("testC2PuzzleP2")); - //$JUnit-END$ - return suite; - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/CounterExampleTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/CounterExampleTest.java deleted file mode 100644 index b86979ef0c796686fbc81ba4b0b6cbaddb00c849..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/CounterExampleTest.java +++ /dev/null @@ -1,173 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.puzzles; - -import junit.framework.Test; -import junit.framework.TestSuite; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.text.ClientSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.JupiterTestCase; -import de.fu_berlin.inf.dpp.test.jupiter.text.ServerSynchronizedDocument; - -/** - * This class contains three test scenarios to verify transformation functions - * out of "Providing Correctness of Transformation Functions in Real-Time - * Groupware" - * @author orieger - * - */ -public class CounterExampleTest extends JupiterTestCase{ - - public CounterExampleTest(String method){ - super(method); - } - - /** - * Scenario described in fig. 3 of discussed paper. - * @throws Exception - */ - public void testCounterExampleViolatingConditionC1() throws Exception{ - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - - JID jid_server = new JID("ori78@jabber.cc"); - - String initDocumentState = "abc"; - - /* init simulated client and server components. */ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c2); - - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( - network,jid_server); - - /* connect all with simulated network. */ - network.addClient(c1); - network.addClient(c2); - - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - - - Thread.sleep(100); - - /* O3 || O2*/ - - c1.sendOperation(new InsertOperation(1,"x"),100); - c2.sendOperation(new DeleteOperation(1,"b"),200); - - Thread.sleep(400); - - assertEquals(c1.getDocument(),c2.getDocument()); - assertEquals("axc",c1.getDocument()); - } - - /** - * Scenario described in fig. 4 of discussed paper. - * @throws Exception - */ - public void testCounterExampleViolatingConditionC2() throws Exception{ - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_c3 = new JID("ori81@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - String initDocumentState = "abc"; - - /* init simulated client and server components. */ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c2); - ClientSynchronizedDocument c3 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c3); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( - network,jid_server); - - /* connect all with simulated network. */ - network.addClient(c1); - network.addClient(c2); - network.addClient(c3); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - s1.addProxyClient(jid_c3); - - Thread.sleep(100); - - /* O3 || O2*/ - c1.sendOperation(new InsertOperation(1,"x"),100); - c2.sendOperation(new DeleteOperation(1,"b"),200); - c3.sendOperation(new InsertOperation(2,"y"),1000); - - Thread.sleep(2000); - - assertEquals(c1.getDocument(),c2.getDocument()); - assertEquals(c2.getDocument(),c3.getDocument()); - System.out.println(c1.getDocument()); - } - - /** - * Scenario described in fig. 5 of discussed paper. - * @throws Exception - */ - public void testCounterExample2ViolatingConditionC2() throws Exception{ - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_c3 = new JID("ori81@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - String initDocumentState = "abc"; - - /* init simulated client and server components. */ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c2); - ClientSynchronizedDocument c3 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c3); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( - network,jid_server); - - /* connect all with simulated network. */ - network.addClient(c1); - network.addClient(c2); - network.addClient(c3); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - s1.addProxyClient(jid_c3); - - Thread.sleep(100); - - /* O3 || O2*/ - c1.sendOperation(new InsertOperation(1,"y"),100); - c2.sendOperation(new DeleteOperation(1,"b"),200); - c3.sendOperation(new InsertOperation(2,"y"),1000); - - Thread.sleep(2000); - - assertEquals(c1.getDocument(),c2.getDocument()); - assertEquals(c2.getDocument(),c3.getDocument()); - System.out.println(c1.getDocument()); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Counter test scenarios."); - //$JUnit-BEGIN$ -// suite.addTest(new CounterExampleTest("testCounterExampleViolatingConditionC1")); - suite.addTest(new CounterExampleTest("testCounterExampleViolatingConditionC2")); -// suite.addTest(new CounterExampleTest("testCounterExample2ViolatingConditionC2")); - //$JUnit-END$ - return suite; -} -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/DOptPuzzleTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/DOptPuzzleTest.java deleted file mode 100644 index c877fbc877584be58d40bf3cae154cea8bcbea79..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/DOptPuzzleTest.java +++ /dev/null @@ -1,230 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.puzzles; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.server.impl.ConcurrentManager; -import de.fu_berlin.inf.dpp.test.jupiter.text.ClientSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.JupiterTestCase; -import de.fu_berlin.inf.dpp.test.jupiter.text.ServerSynchronizedDocument; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * this test case simulate the unsolved dOPT Puzzle scenario which described - * in Fig. 2 in "Operational Transformation in Real-Time Group Editors: - * Issues, Algorithm, Achievements", Sun et.al. - * - * @author orieger - * - */ -public class DOptPuzzleTest extends JupiterTestCase{ - - public DOptPuzzleTest(String method){ - super(method); - } - - /** - * dOPT puzzle scenario with three sides and three concurrent insert - * operations of a character at the same position. - * @throws Exception - */ - public void testThreeConcurrentInsertOperations() throws Exception{ - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_c3 = new JID("ori81@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - /* init simulated client and server components. */ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abcd", - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument("abcd", - network,jid_c2); - ClientSynchronizedDocument c3 = new ClientSynchronizedDocument("abcd", - network,jid_c3); -// ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( -// network,jid_server); - ConcurrentManager s1 = new ConcurrentManager( - network,jid_server); - - /* connect all with simulated network. */ - network.addClient(c1); - network.addClient(c2); - network.addClient(c3); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - s1.addProxyClient(jid_c3); - - Thread.sleep(100); - - /* O3 || O2*/ - c3.sendOperation(new InsertOperation(0,"z"),100); - c2.sendOperation(new InsertOperation(0,"x"),2000); - - Thread.sleep(300); - /* O1 -> O3 */ - c1.sendOperation(new InsertOperation(0,"y"),100); - - - Thread.sleep(3000); - - assertEquals(c1.getDocument(),c2.getDocument()); - assertEquals(c2.getDocument(),c3.getDocument()); - System.out.println(c1.getDocument()); - } - - /** - * dOPT puzzle scenario with three sides and three concurrent insert - * operations of a character at the same position. - * @throws Exception - */ - public void testThreeConcurrentInsertStringOperations() throws Exception{ - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_c3 = new JID("ori81@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - /* init simulated client and server components. */ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abcd", - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument("abcd", - network,jid_c2); - ClientSynchronizedDocument c3 = new ClientSynchronizedDocument("abcd", - network,jid_c3); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( - network,jid_server); - - /* connect all with simulated network. */ - network.addClient(c1); - network.addClient(c2); - network.addClient(c3); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - s1.addProxyClient(jid_c3); - - Thread.sleep(100); - - /* O3 || O2*/ - c3.sendOperation(new InsertOperation(0,"zzz"),100); - c2.sendOperation(new InsertOperation(0,"x"),2000); - - Thread.sleep(300); - /* O1 -> O3 */ - c1.sendOperation(new InsertOperation(0,"yy"),100); - - - Thread.sleep(3000); - - assertEquals(c1.getDocument(),c2.getDocument()); - assertEquals(c2.getDocument(),c3.getDocument()); - System.out.println(c1.getDocument()); - } - - /** - * dOPT puzzle scenario with three sides and three concurrent delete - * operations. - * @throws Exception - */ - public void testThreeConcurrentDeleteOperations() throws Exception{ - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_c3 = new JID("ori81@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abcdefg", - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument("abcdefg", - network,jid_c2); - ClientSynchronizedDocument c3 = new ClientSynchronizedDocument("abcdefg", - network,jid_c3); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( network,jid_server); - - network.addClient(c1); - network.addClient(c2); - network.addClient(c3); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - s1.addProxyClient(jid_c3); - - Thread.sleep(1500); - c1.sendOperation(new DeleteOperation(0,"a"),100); - Thread.sleep(1000); - c3.sendOperation(new DeleteOperation(1,"abc"),500); - c2.sendOperation(new DeleteOperation(3,"e"),300); - - Thread.sleep(5000); - - /* cefg befg .*/ - assertEquals(c1.getDocument(),c2.getDocument()); - - assertEquals(c2.getDocument(),c3.getDocument()); - System.out.println(c1.getDocument()); - } - - /** - * dOPT puzzle scenario with three sides and insert / delete operations. - * @throws Exception - */ - public void testConcurrentInsertDeleteOperations() throws Exception{ - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_c3 = new JID("ori81@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abc", - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument("abc", - network,jid_c2); - ClientSynchronizedDocument c3 = new ClientSynchronizedDocument("abc", - network,jid_c3); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( - network,jid_server); - - network.addClient(c1); - network.addClient(c2); - network.addClient(c3); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - s1.addProxyClient(jid_c3); - - - c1.sendOperation(new InsertOperation(0,"a"),0); - c2.sendOperation(new InsertOperation(1,"b"),100); - - Thread.sleep(500); - c3.sendOperation(new DeleteOperation(1,"ab"),1000); - c2.sendOperation(new InsertOperation(2,"by"),100); - c1.sendOperation(new InsertOperation(1,"x"),600); - - Thread.sleep(4000); - assertEquals(c1.getDocument(),c2.getDocument()); - assertEquals(c2.getDocument(),c3.getDocument()); - System.out.println(c1.getDocument()); - - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for dOPT puzzle."); - //$JUnit-BEGIN$ - suite.addTest(new DOptPuzzleTest("testThreeConcurrentInsertOperations")); - suite.addTest(new DOptPuzzleTest("testThreeConcurrentInsertStringOperations")); - suite.addTest(new DOptPuzzleTest("testThreeConcurrentDeleteOperations")); - suite.addTest(new DOptPuzzleTest("testConcurrentInsertDeleteOperations")); - //$JUnit-END$ - return suite; - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/InclusionTransformationTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/InclusionTransformationTest.java deleted file mode 100644 index 3abf4618ca669f106e57194aff951d0e441ea63d..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/InclusionTransformationTest.java +++ /dev/null @@ -1,147 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.puzzles; - -import junit.framework.Test; -import junit.framework.TestSuite; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.text.ClientSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.JupiterTestCase; -import de.fu_berlin.inf.dpp.test.jupiter.text.ServerSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.TwoWayJupiterClientDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.TwoWayJupiterServerDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.SimulateNetzwork; -/** - * Test class contains all possible transformation of operations. - * - * @author orieger - * - */ - -public class InclusionTransformationTest extends JupiterTestCase { - - TwoWayJupiterClientDocument client; - TwoWayJupiterServerDocument server; - - public InclusionTransformationTest(String method){ - super(method); - } - - public void setUp(){ - - network = new SimulateNetzwork(); - - client = new TwoWayJupiterClientDocument("abcdefg", - network); - server = new TwoWayJupiterServerDocument("abcdefg", - network); - - network.addClient(client); - network.addClient(server); - - } - - /** - * insert before insert - * @throws Exception - */ - public void testCase1() throws Exception{ - client.sendOperation(new InsertOperation(0,"x"), 100); - server.sendOperation(new InsertOperation(0,"y"), 200); - - Thread.sleep(300); - - assertEquals(client.getDocument(), server.getDocument()); - - client.sendOperation(new InsertOperation(0,"x"), 100); - server.sendOperation(new InsertOperation(1,"y"), 200); - - Thread.sleep(300); - - assertEquals(client.getDocument(), server.getDocument()); - - } - - /** - * insert after insert - * @throws Exception - */ - public void testCase2() throws Exception{ - client.sendOperation(new InsertOperation(1,"xx"), 100); - server.sendOperation(new DeleteOperation(0,"yyy"), 200); - - Thread.sleep(300); - - assertEquals(client.getDocument(), server.getDocument()); - - client.sendOperation(new InsertOperation(2,"x"), 100); - server.sendOperation(new InsertOperation(1,"y"), 200); - - Thread.sleep(300); - - assertEquals(client.getDocument(), server.getDocument()); - - } - - /** - * insert before delete operation - * @throws Exception - */ - public void testCase3() throws Exception{ - client.sendOperation(new InsertOperation(1,"x"), 100); - server.sendOperation(new DeleteOperation(2,"c"), 200); - - Thread.sleep(300); - - assertEquals(client.getDocument(), server.getDocument()); - - client.sendOperation(new InsertOperation(0,"y"), 100); - server.sendOperation(new DeleteOperation(0,"a"), 200); - - Thread.sleep(300); - - assertEquals(client.getDocument(), server.getDocument()); - - } - - - /** - * insert after delete operation - * @throws Exception - */ - public void testCase4() throws Exception{ - client.sendOperation(new InsertOperation(1,"x"), 100); - server.sendOperation(new DeleteOperation(0,"a"), 200); - - Thread.sleep(300); - - assertEquals(client.getDocument(), server.getDocument()); - - } - - /** - * insert inside delete area - * @throws Exception - */ - public void testCase5() throws Exception{ - client.sendOperation(new InsertOperation(1,"x"), 100); - server.sendOperation(new DeleteOperation(0,"abc"), 200); - - Thread.sleep(300); - - assertEquals(client.getDocument(), server.getDocument()); - - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for dOPT puzzle."); - //$JUnit-BEGIN$ - suite.addTest(new InclusionTransformationTest("testCase1")); - suite.addTest(new InclusionTransformationTest("testCase2")); - suite.addTest(new InclusionTransformationTest("testCase3")); - suite.addTest(new InclusionTransformationTest("testCase4")); - suite.addTest(new InclusionTransformationTest("testCase5")); - //$JUnit-END$ - return suite; - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/SimpleClientServerTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/SimpleClientServerTest.java deleted file mode 100644 index 5d308dd90d61e2aa378160a1b37b125c8f9a8574..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/SimpleClientServerTest.java +++ /dev/null @@ -1,148 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.puzzles; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.apache.log4j.PropertyConfigurator; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.text.ClientSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.JupiterTestCase; -import de.fu_berlin.inf.dpp.test.jupiter.text.ServerSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.TwoWayJupiterServerDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.SimulateNetzwork; - -public class SimpleClientServerTest extends JupiterTestCase{ - - - public SimpleClientServerTest(String method){ - super(method); - } - - public void setUp() { - network = new SimulateNetzwork(); - - } - - public void tearDown(){ - network = null; - } - - /** - * simple test scenario between server and client. - * The client and server send operation from same state. - * Server message has delay, so that client create a new - * Operation. So if server message arrive client and server - * have different document state and jupiter algorithm - * has to converge the document states. - */ - public void test2WayProtocol() throws Exception{ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abc", - network); - c1.setJID(new JID("ori79@jabber.cc")); - TwoWayJupiterServerDocument s1 = new TwoWayJupiterServerDocument("abc", - network); - s1.setJID(new JID("ori78@jabber.cc")); - - network.addClient(c1); - network.addClient(s1); - - c1.sendOperation(new InsertOperation(0, "e"),1000); - /*short delay. */ - Thread.sleep(100); - - assertEquals("eabc", c1.getDocument()); - assertEquals("abc", s1.getDocument()); - - c1.sendOperation(new InsertOperation(0, "x"), 2000); - /*short delay. */ - Thread.sleep(100); - - assertEquals("xeabc", c1.getDocument()); - assertEquals("abc", s1.getDocument()); - - - - s1.sendOperation(c1.getJID(),new DeleteOperation(0,"a"),0); - /*short delay. */ - Thread.sleep(500); - assertEquals("xebc",c1.getDocument()); - Thread.sleep(2000); - assertEquals("xebc",s1.getDocument()); - - Thread.sleep(6000); -// assertEquals("xebc",c1.getDocument()); -// assertEquals("xebc", s1.getDocument()); - assertEquals(c1.getDocument(), s1.getDocument()); - } - - /** - * Site A insert a char into the delete area of site b. - * The delete operation has delay of two seconds. - * @throws Exception - */ - public void testDeleteStringWithConcurentInsert() throws Exception{ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abcdefg", - network); - c1.setJID(new JID("ori79@jabber.cc")); - TwoWayJupiterServerDocument s1 = new TwoWayJupiterServerDocument("abcdefg", - network); - s1.setJID(new JID("ori78@jabber.cc")); - - network.addClient(c1); - network.addClient(s1); - - - - c1.sendOperation(new InsertOperation(3, "x"),1000); - s1.sendOperation(c1.getJID(),new DeleteOperation(1,"bcde"),2000); - Thread.sleep(1100); - assertEquals("abcxdefg", c1.getDocument()); - - Thread.sleep(4000); - assertEquals(c1.getDocument(), s1.getDocument()); - assertEquals("axfg",c1.getDocument()); - - } - - /** - * Site A insert a char into the delete area of site b. - * The insert operation has delay of two seconds. - * @throws Exception - */ - public void testInsertStringWithConcurentDelete() throws Exception{ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abcdefg", - network); - c1.setJID(new JID("ori79@jabber.cc")); - TwoWayJupiterServerDocument s1 = new TwoWayJupiterServerDocument("abcdefg", - network); - s1.setJID(new JID("ori78@jabber.cc")); - - network.addClient(c1); - network.addClient(s1); - - c1.sendOperation(new InsertOperation(3, "x"),2000); - s1.sendOperation(c1.getJID(),new DeleteOperation(1,"bcde"),0); - Thread.sleep(100); - assertEquals("afg", s1.getDocument()); - - Thread.sleep(4000); - assertEquals(c1.getDocument(), s1.getDocument()); - assertEquals("axfg",c1.getDocument()); - - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for simple client server test cases."); - //$JUnit-BEGIN$ - suite.addTest(new SimpleClientServerTest("testInsertStringWithConcurentDelete")); - suite.addTest(new SimpleClientServerTest("test2WayProtocol")); - suite.addTest(new SimpleClientServerTest("testDeleteStringWithConcurentInsert")); - - //$JUnit-END$ - return suite; - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/SimpleJupiterDocumentTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/SimpleJupiterDocumentTest.java deleted file mode 100644 index d929e14f58caa3be3d6757d41cee6ed62772a77e..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/SimpleJupiterDocumentTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.puzzles; -/** - * This test class represent local execution of document changes and - * appropriate jupiter operations. - */ -import de.fu_berlin.inf.dpp.concurrent.jupiter.Algorithm; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.Jupiter; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.test.jupiter.text.Document; -import de.fu_berlin.inf.dpp.test.jupiter.text.JupiterTestCase; -import junit.framework.TestCase; - - -public class SimpleJupiterDocumentTest extends JupiterTestCase{ - - - /** - * simple test to generate local operations and - * compute the requests for other sides. - */ - public void testExecuteLocalOperations(){ - Algorithm algo = new Jupiter(true); - - Document doc = new Document("abc"); - assertEquals("abc",doc.getDocument()); - - /* insert one char. */ - Operation op = new InsertOperation(2,"d"); - doc.execOperation(op); - assertEquals("abdc",doc.getDocument()); - - Request req = algo.generateRequest(op); - assertTrue(req.getOperation().equals(op)); - - /* insert one short string. */ - op = new InsertOperation(2,"insert"); - doc.execOperation(op); - assertEquals("abinsertdc",doc.getDocument()); - - req = algo.generateRequest(op); - System.out.println(req.getOperation().toString()); - - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/SimpleServerProxyTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/SimpleServerProxyTest.java deleted file mode 100644 index cac5b36a08e8ae8b331c7f0d1ca64c07993d2b6b..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/puzzles/SimpleServerProxyTest.java +++ /dev/null @@ -1,253 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.puzzles; - -import org.apache.log4j.PropertyConfigurator; - - - -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.text.ClientSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.JupiterTestCase; -import de.fu_berlin.inf.dpp.test.jupiter.text.ServerSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.SimulateNetzwork; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * this class contains test cases for testing init server side and - * communication with client sides. - * @author orieger - * - */ -public class SimpleServerProxyTest extends JupiterTestCase { - - public SimpleServerProxyTest(String method){ - super(method); - } - -// /** -// * one client connect with server and create an operation. -// * @throws Exception -// */ -// public void xtestOneSimpleConnectionWithJupiterProxy() throws Exception{ -// JID jid_c1 = new JID("ori79@jabber.cc"); -// JID jid_server = new JID("ori78@jabber.cc"); -// -// ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abcdefg", -// network,jid_c1); -// ServerSynchronizedDocument s1 = new ServerSynchronizedDocument("abcdefg", -// network,jid_server); -// -// network.addClient(c1); -// network.addClient(s1); -// -// /* create proxyqueues. */ -// s1.addProxyClient(jid_c1); -// -// c1.sendOperation(new InsertOperation(1,"c"),0); -// Thread.sleep(100); -//// assertEquals(c1.getDocument(), s1.getDocument()); -// assertEquals("acbcdefg",c1.getDocument()); -// -// s1.sendOperation(new DeleteOperation(1,"cb")); -// Thread.sleep(300); -// assertEquals(c1.getDocument(), s1.getDocument()); -// assertEquals("acdefg",c1.getDocument()); -// } - - /** - * two clients connect with jupiter server. - * @throws Exception - */ - public void testTwoConcurrentInsertOperations() throws Exception{ - System.out.println("START: testTwoConcurrentInsertOperations"); - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("X", - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument("X", - network,jid_c2); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( - network,jid_server); - - network.addClient(c1); - network.addClient(c2); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - - c1.sendOperation(new InsertOperation(0,"a"),2000); - c2.sendOperation(new InsertOperation(1,"b"),4000); - Thread.sleep(5000); - - assertEquals("aXb",c1.getDocument()); - assertEquals("aXb",c2.getDocument()); - assertEquals(c1.getDocument(),c2.getDocument()); - System.out.println("END OF METHOD: testTwoConcurrentInsertOperations"); - } - - /** - * two clients connect with jupiter server. - * @throws Exception - */ - public void testThreeConcurrentInsertOperations() throws Exception{ - - System.out.println("START: testThreeConcurrentInsertOperations"); - - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("X", - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument("X", - network,jid_c2); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( - network,jid_server); - - network.addClient(c1); - network.addClient(c2); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - - /*TODO: Die Operation wird schon beim Server umgewandelt - * und muss auf Client-Seite einfach nur entsprechnend - * ausgeführt werden. - * */ - - c1.sendOperation(new InsertOperation(0,"a"),1000); - c1.sendOperation(new InsertOperation(1,"b"),1500); - c2.sendOperation(new InsertOperation(1,"c"),3000); - - Thread.sleep(5500); - -// assertEquals("aXb",c1.getDocument()); -// assertEquals("aXb",c2.getDocument()); - assertEquals(c1.getDocument(),c2.getDocument()); - System.out.println("END OF METHOD: testThreeConcurrentInsertOperations"); - } - - /** - * two clients connect with jupiter server. - * @throws Exception - */ - public void testTwoClientWithJupiterProxy() throws Exception{ - - System.out.println("START: testTwoClientWithJupiterProxy"); - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abcdefg", - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument("abcdefg", - network,jid_c2); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( - network,jid_server); - - network.addClient(c1); - network.addClient(c2); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - - c1.sendOperation(new InsertOperation(1,"c"),0); - Thread.sleep(1000); - - assertEquals("acbcdefg",c1.getDocument()); - assertEquals("acbcdefg",c2.getDocument()); - - /* send two concurrent operations. */ - c1.sendOperation(new InsertOperation(1,"x"), 100); - c2.sendOperation(new InsertOperation(2,"t"), 1000); - Thread.sleep(500); - /* assert local execution. */ - assertEquals("axcbcdefg",c1.getDocument()); - assertEquals("axctbcdefg",c2.getDocument()); - Thread.sleep(2500); - - /* assert remote operations. */ - /**FAILURE*/ - assertEquals(c1.getDocument(),c2.getDocument()); - - /* send two concurrent operations. */ - c1.sendOperation(new InsertOperation(1,"t"), 2000); - c2.sendOperation(new InsertOperation(3,"x"), 6000); -// c1.sendOperation(new InsertOperation(4,"q"), 2000); - - Thread.sleep(6500); - /* assert remote operations. */ - assertEquals(c1.getDocument(),c2.getDocument()); - System.out.println("END OF METHOD: testTwoClientWithJupiterProxy"); - } - - /** - * two clients connect with jupiter server. - * Concurrent delete and insert operations. - * @throws Exception - */ - public void testTwoClientWithJupiterProxyDeleteInsertOperations() throws Exception{ - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abcdefg", - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument("abcdefg", - network,jid_c2); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument( - network,jid_server); - - network.addClient(c1); - network.addClient(c2); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - -// c1.sendOperation(new InsertOperation(1,"c"),0); -// Thread.sleep(300); -//// assertEquals(c1.getDocument(), s1.getDocument()); -// assertEquals("acbcdefg",c1.getDocument()); -// assertEquals("acbcdefg",c2.getDocument()); - - /* send two concurrent operations. */ - c1.sendOperation(new DeleteOperation(0,"abc"), 1000); - c2.sendOperation(new InsertOperation(1,"t"), 2000); - - Thread.sleep(100); - /* assert local execution. */ - assertEquals("defg",c1.getDocument()); - assertEquals("atbcdefg",c2.getDocument()); - Thread.sleep(2500); - /* assert remote operations. */ -// assertEquals(s1.getDocument(),c1.getDocument()); - - - assertEquals(c1.getDocument(),c2.getDocument()); - } - - public static Test suite() { - TestSuite suite = new TestSuite("Test for Proxy Test."); - //$JUnit-BEGIN$ - suite.addTest(new SimpleServerProxyTest("testTwoConcurrentInsertOperations")); - suite.addTest(new SimpleServerProxyTest("testTwoClientWithJupiterProxy")); - suite.addTest(new SimpleServerProxyTest("testThreeConcurrentInsertOperations")); - suite.addTest(new SimpleServerProxyTest("testTwoClientWithJupiterProxyDeleteInsertOperations")); - //$JUnit-END$ - return suite; - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/server/TestClientManaging.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/server/TestClientManaging.java deleted file mode 100644 index f5761cb00123952771c3ec75938bd84d1deeabca..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/server/TestClientManaging.java +++ /dev/null @@ -1,65 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.server; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.server.impl.ConcurrentManager; -import de.fu_berlin.inf.dpp.test.jupiter.text.ClientSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.JupiterTestCase; -import de.fu_berlin.inf.dpp.test.jupiter.text.ServerSynchronizedDocument; -import junit.framework.TestCase; -/** - * this test class contains test cases for managing jupiter proxy clients. - * @author orieger - * - */ -public class TestClientManaging extends JupiterTestCase { - - public TestClientManaging(String name) { - super(name); - } - - public void testConcurrentJupiterDocumentServer() throws Exception{ - JID jid_c1 = new JID("ori79@jabber.cc"); - JID jid_c2 = new JID("ori80@jabber.cc"); - JID jid_c3 = new JID("ori81@jabber.cc");; - JID jid_server = new JID("ori78@jabber.cc"); - - String initDocumentState = "core"; - - /* init simulated client and server components. */ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c1); - ClientSynchronizedDocument c2 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c2); - ClientSynchronizedDocument c3 = new ClientSynchronizedDocument(initDocumentState, - network,jid_c3); - ConcurrentManager s1 = new ConcurrentManager( - network,jid_server); - - /* connect all with simulated network. */ - network.addClient(c1); - network.addClient(c2); - network.addClient(c3); - network.addClient(s1); - -// /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - s1.addProxyClient(jid_c3); - - - Thread.sleep(100); - - /* O3 || O2*/ - c1.sendOperation(new InsertOperation(3,"f"), 100); - c2.sendOperation(new DeleteOperation(2,"r"), 100); - c3.sendOperation(new InsertOperation(2,"f"), 100); - - Thread.sleep(1500); - - assertEquals(c1.getDocument(),c2.getDocument()); - assertEquals(c2.getDocument(),c3.getDocument()); - assertEquals("coffe",c1.getDocument()); - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/server/impl/ConcurrentManager.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/server/impl/ConcurrentManager.java deleted file mode 100644 index d0fe1c341b1112e52c7746663f5e7b1693a92f97..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/server/impl/ConcurrentManager.java +++ /dev/null @@ -1,97 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.server.impl; - -import org.apache.log4j.Logger; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.concurrent.jupiter.RequestForwarder; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.JupiterDocumentServer; -import de.fu_berlin.inf.dpp.concurrent.management.OutgoingMessageForwarder; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.text.NetworkRequest; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.NetworkConnection; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.NetworkEventHandler; - -public class ConcurrentManager implements NetworkEventHandler{ - - private static Logger logger = Logger.getLogger(ConcurrentManager.class); - - private JupiterDocumentServer server; - private JID jid = new JID("ori78@jabber.cc"); - private NetworkConnection connection; -// private RequestForwarder outgoing; - - public ConcurrentManager(NetworkConnection con, JID jid){ - this.connection = con; - this.jid = jid; - init(); - } - - private void init(){ -// this.outgoing = new OutgoingMessageForwarder(); -// server = new JupiterDocumentServer(outgoing); - server = new JupiterDocumentServer(); - - new Thread(new Runnable(){ - - public void run() { - while(true){ - sendRequest(); - } - - } - - }).start(); - } - - public void addProxyClient(JID jid){ - /* if client not in proxy list*/ - try { - if(!server.getProxies().containsKey(jid)){ - logger.info("add new proxy client for "+jid); - server.addProxyClient(jid); - } - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - /* test network methods. */ - public JID getJID() { - return jid; - } - - @Deprecated - public void receiveNetworkEvent(Request req) { -// server.addRequest(req.g) - } - - public void receiveNetworkEvent(NetworkRequest req) { - /* if client not in proxy list*/ - try { - if(!server.getProxies().containsKey(req.getRequest().getJID())){ - logger.info("add new proxy client for "+req.getFrom()); - server.addProxyClient(req.getRequest().getJID()); - } - server.addRequest(req.getRequest()); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - } - - public void sendRequest(){ - try { -// Request request = outgoing.getNextOutgoingRequest(); - Request request = server.getNextOutgoingRequest(); - logger.debug("send transformed operation to client side. "); - /* send operation to client. */ - connection.sendOperation(new NetworkRequest(this.jid,request.getJID(),request), 0); - } catch (InterruptedException e) { - - e.printStackTrace(); - } - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/ClientSynchronizedDocument.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/ClientSynchronizedDocument.java deleted file mode 100644 index d2307b2eac8c47f133e5b28eb95f2a4cdcf9c92f..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/ClientSynchronizedDocument.java +++ /dev/null @@ -1,144 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text; - -import java.util.HashMap; - -import org.apache.log4j.Logger; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Algorithm; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.concurrent.jupiter.TransformationException; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.Jupiter; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.SynchronizedQueue; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.NetworkConnection; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.NetworkEventHandler; - - -/** - * test document to simulate the client site. - * @author orieger - * - */ - -public class ClientSynchronizedDocument implements SynchronizedQueue, NetworkEventHandler, DocumentTestChecker{ - - private static Logger logger = Logger.getLogger(ClientSynchronizedDocument.class); - - private Document doc; - private Algorithm algorithm; - - protected JID jid; - private JID server_jid = new JID("ori78@jabber.cc"); - private NetworkConnection connection; - - private HashMap<String, JupiterDocumentListener> documentListener = new HashMap<String, JupiterDocumentListener>(); - - public ClientSynchronizedDocument(String content, NetworkConnection con){ - this.doc = new Document(content); - this.algorithm = new Jupiter(true); - this.connection = con; - } - - public ClientSynchronizedDocument(String content, NetworkConnection con, JID jid){ - this.doc = new Document(content); - this.algorithm = new Jupiter(true); - this.connection = con; - this.jid = jid; - } - - public JID getJID() { - return this.jid; - } - - public void setJID(JID jid){ - this.jid = jid; - } - - public Operation receiveOperation(Request req) { - Operation op = null; - try { - logger.debug("Client: "+jid+ " receive "+req.getOperation().toString()); - /* 1. transform operation. */ - op = algorithm.receiveRequest(req); -// op = algorithm.receiveTransformedRequest(req); - /* 2. execution on server document*/ - logger.info("execute op: "+op.toString()); - doc.execOperation(op); - } catch (TransformationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return op; - } - - public void sendOperation(Operation op) { - sendOperation(server_jid, op, 0); - } - - - public void sendOperation(Operation op, int delay) { - logger.info("send "+jid.getName()+" : "+op.toString()); - sendOperation(server_jid, op, delay); - } - - public void sendOperation(JID remoteJid, Operation op, int delay) { - /* 1. execute locally*/ - doc.execOperation(op); - /* 2. transform operation. */ - Request req = algorithm.generateRequest(op); - req.setJID(this.jid); - /* 3. send operation. */ -// connection.sendOperation(remoteJid, req, delay); - connection.sendOperation(new NetworkRequest(this.jid, remoteJid,req), delay); - - informListener(); - } - - public void receiveNetworkEvent(Request req) { - logger.info(this.jid+ " receive operation : "+req.getOperation().toString()); - receiveOperation(req); - informListener(); - } - - public String getDocument() { - return doc.getDocument(); - } - - - @Deprecated - public void sendTransformedOperation(Operation op, JID toJID) { - // TODO Auto-generated method stub - - } - - public void receiveNetworkEvent(NetworkRequest req) { - logger.info(this.jid+ " receive operation : "+req.getRequest().getOperation().toString()+" timestamp : "+req.getRequest().getTimestamp()); - receiveOperation(req.getRequest()); - informListener(); - } - - public Algorithm getAlgorithm() { - return algorithm; - } - - private void informListener(){ - for(String key : documentListener.keySet()){ - documentListener.get(key).documentAction(jid); - } - } - - public void addJupiterDocumentListener(JupiterDocumentListener jdl) { - documentListener.put(jdl.getID(), jdl); - } - - public void removeJupiterDocumentListener(String id) { - documentListener.remove(id); - } - - - - - - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/Document.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/Document.java deleted file mode 100644 index 578eb04f50bd620b2ff870bb318d2f15c8090760..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/Document.java +++ /dev/null @@ -1,59 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.*; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.*; -/** - * this class represent a document object for testing. - * @author troll - * - */ -public class Document { - - /** document state. */ - private StringBuffer doc; - - /** - * constructor to init doc. - * @param initState start document state. - */ - public Document(String initState){ - doc = new StringBuffer(initState); - } - - /** - * return string representation of current doc state. - * @return string of current doc state. - */ - public String getDocument(){ - return doc.toString(); - } - - /** - * Execute Operation on document state. - * @param op - */ - public void execOperation(Operation op){ - try{ - /* execute insert operation */ - if (op instanceof InsertOperation) { - InsertOperation iop = (InsertOperation) op; - doc.insert(iop.getPosition(), iop.getText()); - return; - } - /* execute delete operation */ - if (op instanceof DeleteOperation) { - DeleteOperation dop = (DeleteOperation) op; - doc.delete(dop.getPosition(), dop.getPosition() + dop.getTextLength()); - return; - } - /* execute split operations.*/ - if (op instanceof SplitOperation) { - SplitOperation sop = (SplitOperation) op; - execOperation(sop.getSecond()); - execOperation(sop.getFirst()); - } - }catch(Exception e){ - System.out.println(e.getMessage()+ " : "+" doc "+doc.toString()+" | op : "+op.toString()); - } - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/DocumentTestChecker.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/DocumentTestChecker.java deleted file mode 100644 index 88db461b58b13352bbae7f475fb1441a3b72c909..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/DocumentTestChecker.java +++ /dev/null @@ -1,15 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text; - -/** - * interface for testing document state and content. - * @author troll - * - */ -public interface DocumentTestChecker { - - public String getDocument(); - - public void addJupiterDocumentListener(JupiterDocumentListener jdl); - - public void removeJupiterDocumentListener(String id); -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/JupiterDocumentListener.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/JupiterDocumentListener.java deleted file mode 100644 index b20c0313efd971e2b2352f8377db20692639828e..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/JupiterDocumentListener.java +++ /dev/null @@ -1,15 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text; - -import de.fu_berlin.inf.dpp.net.JID; - -/** - * Listener for jupiter document actions. - * @author orieger - * - */ -public interface JupiterDocumentListener { - - public void documentAction(JID jid); - - public String getID(); -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/JupiterServer.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/JupiterServer.java deleted file mode 100644 index 79c26b5b0ad311837cae20838aa1c497909288d1..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/JupiterServer.java +++ /dev/null @@ -1,10 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text; - -import de.fu_berlin.inf.dpp.net.JID; - -public interface JupiterServer { - - public void addProxyClient(JID jid); - - public void removeProxyClient(JID jid); -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/JupiterTestCase.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/JupiterTestCase.java deleted file mode 100644 index 4274fdcd9b5085b5e3f3c520bcc49da8eee98eac..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/JupiterTestCase.java +++ /dev/null @@ -1,27 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text; - -import org.apache.log4j.PropertyConfigurator; - -import de.fu_berlin.inf.dpp.test.jupiter.text.network.SimulateNetzwork; -import junit.framework.TestCase; - -public class JupiterTestCase extends TestCase{ - static { - PropertyConfigurator.configureAndWatch("log4j.properties", 60 * 1000); - } - - public JupiterTestCase(){ - - } - - public JupiterTestCase(String method){ - super(method); - } - - protected SimulateNetzwork network; - - public void setUp() { - network = new SimulateNetzwork(); - - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/NetworkRequest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/NetworkRequest.java deleted file mode 100644 index 2e8aec0ea6df9c8fc72d798f6be5a0ad20bef613..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/NetworkRequest.java +++ /dev/null @@ -1,37 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.RequestImpl; -import de.fu_berlin.inf.dpp.net.JID; - -public class NetworkRequest { - - private JID from; - - private JID to; - - private Request request; - - public NetworkRequest(JID from, JID to, Request req){ - this.from = from; - this.to = to; - /* adaption to new request format. */ - if(req.getJID() == null){ - this.request = new RequestImpl(req.getSiteId(),req.getTimestamp(),req.getOperation(),from); - }else{ - this.request = req; - } - } - - public JID getFrom() { - return from; - } - - public JID getTo() { - return to; - } - - public Request getRequest() { - return request; - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/ProxySynchronizedQueue.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/ProxySynchronizedQueue.java deleted file mode 100644 index d0590f37de46408cadcc18724ab7225ac5acee49..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/ProxySynchronizedQueue.java +++ /dev/null @@ -1,100 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text; - -import org.apache.log4j.Logger; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Algorithm; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Timestamp; -import de.fu_berlin.inf.dpp.concurrent.jupiter.TransformationException; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.Jupiter; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.JupiterTimestampFactory; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.RequestImpl; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.SynchronizedQueue; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.NetworkConnection; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.NetworkEventHandler; - -/** - * This proxy class on server represent the server side of the two-way jupiter protocol. - * @author troll - * - */ -public class ProxySynchronizedQueue implements SynchronizedQueue{ - - private static Logger logger = Logger.getLogger(ProxySynchronizedQueue.class); - - private Algorithm algorithm; - private NetworkConnection connection; - private JID jid; - - public ProxySynchronizedQueue(JID jid, NetworkConnection con){ - this.jid = jid; - this.algorithm = new Jupiter(false); - this.connection = con; - } - - public JID getJID() { - return jid; - } - - public Operation receiveOperation(Request req) { - Operation op = null; - try { - logger.debug(jid+ " : Operation before OT:"+req.getOperation().toString()); - /* 1. transform operation. */ - op = algorithm.receiveRequest(req); - -// //TODO: Only for testing: create new request. -// if(!jid.toString().equals("ori79@jabber.cc")){ -// Request send_req = new RequestImpl( -// algorithm.getSiteId(), -// algorithm.getTimestamp(), -// op); -// -// connection.sendOperation(jid, send_req, 0); -// } - - logger.debug(jid+ " : Operation after OT: "+op.toString()); - } catch (TransformationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return op; - } - - /** - * send a transformed operation to client side. - * @param op operation has transformed and only send to - * client side. - */ - public void sendTransformedOperation(Operation op, JID jid){ - Timestamp time = algorithm.getTimestamp(); - logger.debug("timestamp before : "+time.toString()); - /* current timestemp have to be decrement to achieve the preconditions.*/ -// int[] t = time.getComponents(); -// --t[1]; -// time = new JupiterTimestampFactory().createTimestamp(t); - Request send_req = new RequestImpl( - algorithm.getSiteId(), - time, - op); - logger.debug("timestamp after : "+time.toString()); - connection.sendOperation(new NetworkRequest(this.jid,jid,send_req), 0); -// connection.sendOperation(jid, send_req, 0); - } - - public void sendOperation(Operation op) { - /* 1. transform operation. */ - Request req = algorithm.generateRequest(op); - /* 2. opertion to client. */ - connection.sendOperation(new NetworkRequest(this.jid,jid,req), 0); -// connection.sendOperation(jid, req, 0); -// connection - } - - public Algorithm getAlgorithm() { - return algorithm; - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/ServerSynchronizedDocument.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/ServerSynchronizedDocument.java deleted file mode 100644 index 79f8fd720d53b6217ef8730110a00137a45d8471..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/ServerSynchronizedDocument.java +++ /dev/null @@ -1,249 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text; - -import java.util.HashMap; -import java.util.List; -import java.util.Set; -import java.util.Vector; - -import org.apache.log4j.Logger; -import org.eclipse.ui.internal.presentations.util.ProxyControl; - -import com.sun.corba.se.impl.orbutil.concurrent.Sync; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Algorithm; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.concurrent.jupiter.TransformationException; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.Jupiter; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.RequestImpl; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.SynchronizedQueue; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.NetworkConnection; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.NetworkEventHandler; - - -public class ServerSynchronizedDocument implements JupiterServer, SynchronizedQueue, NetworkEventHandler, DocumentTestChecker{ - - private static Logger logger = Logger.getLogger(ServerSynchronizedDocument.class); - - private Document doc; - /* sync algorithm with ack-operation list. */ - private Algorithm algorithm; - - private JID jid; - private NetworkConnection connection; - - private boolean accessDenied = false; - - private HashMap<JID,ProxySynchronizedQueue> proxyQueues; - - @Deprecated - public ServerSynchronizedDocument(String content, NetworkConnection con){ - init(content,con); - } - - @Deprecated - public ServerSynchronizedDocument(String content, NetworkConnection con, JID jid){ - this.jid = jid; - init(content,con); - } - - - public ServerSynchronizedDocument(NetworkConnection con, JID jid){ - this.jid = jid; - /* init network connection. */ - init(con); - } - - /* init proxy queue and all necessary objects. */ - private void init(String content, NetworkConnection con){ - this.doc = new Document(content); - this.algorithm = new Jupiter(true); - this.connection = con; - this.proxyQueues = new HashMap<JID,ProxySynchronizedQueue>(); - } - - /** - * init proxy queue and network connection. - * @param con - */ - private void init(NetworkConnection con){ - this.connection = con; - this.proxyQueues = new HashMap<JID,ProxySynchronizedQueue>(); - } - - public void setJID(JID jid){ - this.jid = jid; - } - - public JID getJID() { - return jid; - } - - /** - * Receive operation between server and client as two-way protocol. - */ - public Operation receiveOperation(Request req) { - Operation op = null; - try { - logger.debug("Operation before OT:"+req.getOperation().toString()+" "+algorithm.getTimestamp()); - /* 1. transform operation. */ - op = algorithm.receiveRequest(req); - logger.debug("Operation after OT: "+op.toString()+" "+algorithm.getTimestamp()); - - /* 2. execution on server document*/ - doc.execOperation(op); - } catch (TransformationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return op; - } - - /** - * {@inheritDoc} - */ - private synchronized Operation receiveOperation(Request req, JID jid) { - while(accessDenied){ - try { - logger.debug("wait for semaphore."); - wait(); - } catch (InterruptedException e) { - logger.error(e.getMessage()); - } - } - - /* get semaphore*/ - accessDenied = true; - - /* transformed incoming operation of client jid.*/ - Operation op = null; - try { - - /* 1. transform client request in client proxy.*/ - ProxySynchronizedQueue proxy = proxyQueues.get(jid); - if(proxy != null){ - op = proxy.receiveOperation(req); - } - else{ - throw new TransformationException("no proxy client queue for "+jid); - } - - /* 2. submit transformed operation to other proxies. */ - for(JID j : proxyQueues.keySet()){ - proxy = proxyQueues.get(j); - - if(!j.toString().equals(jid.toString())){ - logger.debug(j.toString()+" : proxy timestamp "+proxy.getAlgorithm().getTimestamp()+" op before : "+req.getOperation()+ " req timestamp: "+req.getTimestamp()); - - /* 3. create submit op as local proxy operation and send to client. */ - proxy.sendOperation(op); - - logger.debug(j.toString()+" : vector after receive "+proxy.getAlgorithm().getTimestamp()+" op after : "+op); - } - - } - - } catch (TransformationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - - }finally{ - logger.debug("end of lock and clear semaphore."); - accessDenied = false; - notifyAll(); - } - - return op; - } - - /* send to all proxy clients. */ - public void sendOperation(Operation op) { - /* 1. execute locally*/ - doc.execOperation(op); - /* 2. transfer proxy queues. */ - for(JID jid: proxyQueues.keySet()){ - proxyQueues.get(jid).sendOperation(op); - } - } - - /** - * send operation to special jid. - * @param jid - * @param op - */ - public void sendOperation(JID jid, Operation op){ - sendOperation(jid, op, 0); - } - - /** - * send operation only for two-way protocol test. - * @param jid - * @param op - * @param delay - */ - public void sendOperation(JID jid, Operation op, int delay) { - /* 1. execute locally*/ - doc.execOperation(op); - /* 2. transform operation. */ - Request req = algorithm.generateRequest(op); - /*sent to client*/ -// connection.sendOperation(jid, req,delay); - connection.sendOperation(new NetworkRequest(this.jid, jid,req), delay); - - } - - public void receiveNetworkEvent(Request req) { - logger.info("receive operation : "+req.getOperation().toString()); - receiveOperation(req); - - } - - - - - public String getDocument() { - return doc.getDocument(); - } - - - public void addProxyClient(JID jid) { - ProxySynchronizedQueue queue = new ProxySynchronizedQueue(jid, this.connection); - proxyQueues.put(jid,queue); - } - - public void removeProxyClient(JID jid) { - proxyQueues.remove(jid); - } - - public void sendTransformedOperation(Operation op, JID toJID) { - // TODO Auto-generated method stub - - } - - - public void receiveNetworkEvent(NetworkRequest req) { -// logger.debug("receive network event with networtrequest from "+req.getFrom()); - receiveOperation(req.getRequest(), req.getFrom()); - } - - public Algorithm getAlgorithm() { - return algorithm; - } - - - public void addJupiterDocumentListener(JupiterDocumentListener jdl) { - // TODO Auto-generated method stub - - } - - public void removeJupiterDocumentListener(String id) { - // TODO Auto-generated method stub - - } - - - - - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/TwoWayJupiterClientDocument.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/TwoWayJupiterClientDocument.java deleted file mode 100644 index 6de9931841612466d88cfe804841d566c545ac35..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/TwoWayJupiterClientDocument.java +++ /dev/null @@ -1,16 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text; - -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.NetworkConnection; -import junit.framework.TestCase; - -public class TwoWayJupiterClientDocument extends ClientSynchronizedDocument { - - - - public TwoWayJupiterClientDocument(String content, NetworkConnection con) { - super(content, con); - jid = new JID("ori79@jabber.cc"); - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/TwoWayJupiterServerDocument.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/TwoWayJupiterServerDocument.java deleted file mode 100644 index bd81246c8adba2ae0fc8c312affe7e4cb06d91ba..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/TwoWayJupiterServerDocument.java +++ /dev/null @@ -1,159 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text; - -import java.util.List; -import java.util.Vector; - -import org.apache.log4j.Logger; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Algorithm; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.concurrent.jupiter.TransformationException; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.Jupiter; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.SynchronizedQueue; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.NetworkConnection; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.NetworkEventHandler; - - -public class TwoWayJupiterServerDocument implements SynchronizedQueue, NetworkEventHandler, DocumentTestChecker{ - - private static Logger logger = Logger.getLogger(TwoWayJupiterServerDocument.class); - - private Document doc; - /* sync algorithm with ack-operation list. */ - private Algorithm algorithm; - - private JID jid = new JID("ori78@jabber.cc"); - private JID jid_client = new JID("ori79@jabber.cc"); - private NetworkConnection connection; - - private List<SynchronizedQueue> proxyQueues; - - - public TwoWayJupiterServerDocument(String content, NetworkConnection con){ - init(content,con); - } - - - public TwoWayJupiterServerDocument(String content, NetworkConnection con, JID jid){ - this.jid = jid; - init(content,con); - } - - /* init proxy queue and all necessary objects. */ - private void init(String content, NetworkConnection con){ - this.doc = new Document(content); - this.algorithm = new Jupiter(false); - this.connection = con; - this.proxyQueues = new Vector<SynchronizedQueue>(); - } - - public void setJID(JID jid){ - this.jid = jid; - } - - public JID getJID() { - return jid; - } - - /** - * {@inheritDoc} - */ - public Operation receiveOperation(Request req) { - Operation op = null; - try { - logger.debug("Operation before OT:"+req.getOperation().toString()); - /* 1. transform operation. */ - op = algorithm.receiveRequest(req); - - logger.debug("Operation after OT: "+op.toString()); - /* 2. execution on server document*/ - doc.execOperation(op); - } catch (TransformationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return op; - } - - @Deprecated - public void sendOperation(Operation op) { - - } - - /** - * send operation to special jid. - * @param jid - * @param op - */ - public void sendOperation(JID jid, Operation op){ - sendOperation(jid, op, 0); - } - - public void sendOperation(JID jid, Operation op, int delay) { - /* 1. execute locally*/ - doc.execOperation(op); - /* 2. transform operation. */ - Request req = algorithm.generateRequest(op); - /*sent to client*/ - connection.sendOperation(new NetworkRequest(this.jid,jid,req), delay); -// connection.sendOperation(jid, req,delay); - - } - - /** - * send operation to twowayjupiterclient - * @param jid - * @param op - * @param delay - */ - public void sendOperation(Operation op, int delay) { - sendOperation(jid_client, op, delay); - } - - public void receiveNetworkEvent(Request req) { - logger.info("receive operation : "+req.getOperation().toString()); - receiveOperation(req); - - } - - public String getDocument() { - return doc.getDocument(); - } - - - public Algorithm getAlgorithm() { - return this.algorithm; - } - - - - public void sendTransformedOperation(Operation op, JID toJID) { - // TODO Auto-generated method stub - - } - - - /** - * receive network request. - */ - public void receiveNetworkEvent(NetworkRequest req) { - receiveOperation(req.getRequest()); - } - - - - public void addJupiterDocumentListener(JupiterDocumentListener jdl) { - // TODO Auto-generated method stub - - } - - public void removeJupiterDocumentListener(String id) { - // TODO Auto-generated method stub - - } - - - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/NetworkConnection.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/NetworkConnection.java deleted file mode 100644 index 83bf0f8f654600b853e5af26e51f31401f8c7e63..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/NetworkConnection.java +++ /dev/null @@ -1,29 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text.network; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.text.NetworkRequest; - -/** - * interface for simulated network. - * @author troll - * - */ - -public interface NetworkConnection { - - /** - * send operation over the network with delay. - * @param jid - * @param req - * @param delay in millis - * @deprecated - */ - public void sendOperation(JID jid, Request req, int delay); - - public void sendOperation(NetworkRequest req, int delay); - - public void addClient(NetworkEventHandler remote); - - public void removeClient(NetworkEventHandler remote); -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/NetworkEventHandler.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/NetworkEventHandler.java deleted file mode 100644 index 902c32b7b84d589b67fd3a574b06816df3ec8b48..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/NetworkEventHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text.network; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.text.NetworkRequest; - -/** - * handler for simulated network events. - * @author troll - * - */ -public interface NetworkEventHandler { - - /** - * receive a remote document request. - * @param req - * @deprecated - */ - public void receiveNetworkEvent(Request req); - - /** - * receive a remote document request. - * @param req - */ - public void receiveNetworkEvent(NetworkRequest req); - - - - /** - * network Jabber id of appropriate client. - */ - public JID getJID(); -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/SimulateNetzwork.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/SimulateNetzwork.java deleted file mode 100644 index 2ab2c15c5c6377b75b851d1b5cf3e9c094b77105..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/SimulateNetzwork.java +++ /dev/null @@ -1,86 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text.network; - -import java.util.HashMap; - -import org.apache.log4j.Logger; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.text.NetworkRequest; - -/** - * this class simulate a network. - * @author troll - * - */ -public class SimulateNetzwork implements NetworkConnection{ - - private static Logger logger = Logger.getLogger(SimulateNetzwork.class); - - private HashMap<JID, NetworkEventHandler> clients; - - - - public SimulateNetzwork(){ - clients = new HashMap<JID, NetworkEventHandler>(); - - } - - - - - private void sendOperation(NetworkRequest req){ - if(clients.containsKey(req.getTo())){ - logger.debug("send message to "+req.getTo()); - clients.get(req.getTo()).receiveNetworkEvent(req); - } - } - - public void sendOperation(final NetworkRequest req, final int delay){ - new Thread(new Runnable(){ - public void run() { - logger.debug("Delay in send operation "+req.getRequest().getOperation().toString()+" of "+delay+" millis"); - try { - Thread.sleep(delay); - sendOperation(req); - } catch (InterruptedException e) { - e.printStackTrace(); - } - }}).start(); - } - - private void sendOperation(JID jid, Request req){ - if(clients.containsKey(jid)){ - clients.get(jid).receiveNetworkEvent(req); - } - } - - @Deprecated - public void sendOperation(final JID jid, final Request req, final int delay) { - - new Thread(new Runnable(){ - public void run() { - logger.debug("Delay in send operation "+req.getOperation().toString()+" of "+delay+" millis to "+jid); - try { - Thread.sleep(delay); - sendOperation(jid, req); - } catch (InterruptedException e) { - e.printStackTrace(); - } - }}).start(); - - } - - public void addClient(NetworkEventHandler remote){ - if(!clients.containsKey(remote.getJID())){ - clients.put(remote.getJID(), remote); - } - } - - public void removeClient(NetworkEventHandler remote){ - clients.remove(remote.getJID()); - } - - - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/SimulatedNetworkTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/SimulatedNetworkTest.java deleted file mode 100644 index 5e469adc81f73ab1bc199def7ec6275ce17a6063..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/text/network/SimulatedNetworkTest.java +++ /dev/null @@ -1,91 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.text.network; - -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.text.ClientSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.ServerSynchronizedDocument; -import junit.framework.TestCase; - -public class SimulatedNetworkTest extends TestCase { - - static { - PropertyConfigurator.configureAndWatch("log4j.properties", 60 * 1000); - } - private SimulateNetzwork network; - - public void setUp() { - network = new SimulateNetzwork(); - - } - - public void tearDown() { - - } - - /** - * simple test of a two-site communication. - */ - public void testSimpleNetzworkMessage() throws Exception{ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abc", - network); - c1.setJID(new JID("ori79@jabber.cc")); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument("abc", - network); - s1.setJID(new JID("ori78@jabber.cc")); - - network.addClient(c1); - network.addClient(s1); - - /* test network connection */ - c1.sendOperation(new InsertOperation(0, "e")); - /*short delay. */ - Thread.sleep(100); - - assertEquals("eabc", c1.getDocument()); - assertEquals("eabc", s1.getDocument()); - s1.sendOperation(c1.getJID(), new DeleteOperation(0, "e")); - /*short delay. */ - Thread.sleep(100); - - assertEquals("abc", c1.getDocument()); - assertEquals("abc", s1.getDocument()); - - } - - public void testNetworkMessagesWithDelay() throws Exception{ - ClientSynchronizedDocument c1 = new ClientSynchronizedDocument("abc", - network); - c1.setJID(new JID("ori79@jabber.cc")); - ServerSynchronizedDocument s1 = new ServerSynchronizedDocument("abc", - network); - s1.setJID(new JID("ori78@jabber.cc")); - - network.addClient(c1); - network.addClient(s1); - - c1.sendOperation(new InsertOperation(0, "e")); - /*short delay. */ - Thread.sleep(100); - - assertEquals("eabc", c1.getDocument()); - assertEquals("eabc", s1.getDocument()); - - c1.sendOperation(new InsertOperation(0, "x"), 2000); - /*short delay. */ - Thread.sleep(100); - - assertEquals("xeabc", c1.getDocument()); - assertEquals("eabc", s1.getDocument()); - - s1.sendOperation(c1.getJID(),new DeleteOperation(0,"e"),0); - /*short delay. */ - Thread.sleep(100); - assertEquals("xabc",c1.getDocument()); - Thread.sleep(2000); - assertEquals("xabc",s1.getDocument()); - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/JupiterTestUI.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/JupiterTestUI.java deleted file mode 100644 index 913d54f24eb898d6bc04374f0c399cd4d10520e0..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/JupiterTestUI.java +++ /dev/null @@ -1,1116 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.ui; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JFrame; -import javax.swing.JOptionPane; - -import org.apache.log4j.Logger; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.jupiter.server.impl.ConcurrentManager; -import de.fu_berlin.inf.dpp.test.jupiter.text.ClientSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.JupiterDocumentListener; -import de.fu_berlin.inf.dpp.test.jupiter.text.ServerSynchronizedDocument; -import de.fu_berlin.inf.dpp.test.jupiter.text.network.SimulateNetzwork; - -/** - * - * @author troll - */ -public class JupiterTestUI extends javax.swing.JPanel { - - private static Logger logger = Logger.getLogger(JupiterTestUI.class); - - public static String SIDE_1 = "side1"; - public static String SIDE_2 = "side2"; - public static String SIDE_3 = "side3"; - - Messages resourceMap = new Messages(); - ActionListener actionListener; - - JupiterSimulater jupiter; - - /** Creates new form NewJPanel */ - public JupiterTestUI() { - actionListener = new JupiterActionListener(); - initComponents(); - initListener(); - jupiter = new JupiterSimulater(); - -// jupiter.deactiveSide3(); - } - - public void update() { - this.repaint(); - } - - private void initComponents() { - - jLabelInitialState = new javax.swing.JLabel(); - jTextFieldInitialState = new javax.swing.JTextField(); - jLabelGlobalResult = new javax.swing.JLabel(); - jPanel1 = new javax.swing.JPanel(); - jRadioButtonInsert = new javax.swing.JRadioButton(); - jRadioButtonDelete = new javax.swing.JRadioButton(); - jTextFieldPosition = new javax.swing.JTextField(); - jLabelPositionSide1 = new javax.swing.JLabel(); - jTextFieldDelay = new javax.swing.JTextField(); - jLabelDelaySide1 = new javax.swing.JLabel(); - jTextFieldTextSide1 = new javax.swing.JTextField(); - jLabelTextSide1 = new javax.swing.JLabel(); - jTextFieldResultSide1 = new javax.swing.JTextField(); - jButtonExecuteSide1 = new javax.swing.JButton(); - jPanel2 = new javax.swing.JPanel(); - jRadioButtonInsertSide2 = new javax.swing.JRadioButton(); - jRadioButtonDeleteSide2 = new javax.swing.JRadioButton(); - jTextFieldPositionSide2 = new javax.swing.JTextField(); - jLabelPositionSide2 = new javax.swing.JLabel(); - jTextFieldDelaySide2 = new javax.swing.JTextField(); - jLabelDelaySide2 = new javax.swing.JLabel(); - jTextFieldTextSide2 = new javax.swing.JTextField(); - jLabelTextSide2 = new javax.swing.JLabel(); - jTextFieldResultSide2 = new javax.swing.JTextField(); - jButtonExecuteSide2 = new javax.swing.JButton(); - jPanel3 = new javax.swing.JPanel(); - jRadioButtonInsertSide3 = new javax.swing.JRadioButton(); - jRadioButtonDeleteSide3 = new javax.swing.JRadioButton(); - jTextFieldPositionSide3 = new javax.swing.JTextField(); - jLabelPositionSide3 = new javax.swing.JLabel(); - jTextFieldDelaySide3 = new javax.swing.JTextField(); - jLabelDelaySide3 = new javax.swing.JLabel(); - jTextFieldTextSide3 = new javax.swing.JTextField(); - jLabelTextSide3 = new javax.swing.JLabel(); - jTextFieldResultSide3 = new javax.swing.JTextField(); - jButtonExecuteSide3 = new javax.swing.JButton(); - jButtonRun = new javax.swing.JButton(); - jButtonExit = new javax.swing.JButton(); - - setName("Form"); // NOI18N - - // org.jdesktop.application.ResourceMap resourceMap = - // org.jdesktop.application.Application.getInstance(desktopapplication1.DesktopApplication1.class).getContext().getResourceMap(NewJPanel.class); - jLabelInitialState.setText(resourceMap - .getString("jLabelInitialState.text")); // NOI18N - jLabelInitialState.setName("jLabelInitialState"); // NOI18N - - jTextFieldInitialState.setName("jTextFieldInitialState"); // NOI18N - - // jLabelGlobalResult.setFont(resourceMap.getFont("jLabelGlobalResult.font")); - // // NOI18N - jLabelGlobalResult.setText(resourceMap - .getString("jLabelGlobalResult.text")); // NOI18N - jLabelGlobalResult.setName("jLabelGlobalResult"); // NOI18N - - jPanel1.setBorder(javax.swing.BorderFactory - .createTitledBorder("Side 1")); - jPanel1.setName("jPanel1"); // NOI18N - - jRadioButtonInsert.setText(resourceMap - .getString("jRadioButtonInsert.text")); // NOI18N - jRadioButtonInsert.setName("jRadioButtonInsert"); // NOI18N - // jRadioButtonInsert.setSelected(true); - - jRadioButtonDelete.setText(resourceMap - .getString("jRadioButtonDelete.text")); // NOI18N - jRadioButtonDelete.setName("jRadioButtonDelete"); // NOI18N - - jTextFieldPosition.setName("jTextFieldPosition"); // NOI18N - - jLabelPositionSide1.setText(resourceMap - .getString("jLabelPositionSide1.text")); // NOI18N - jLabelPositionSide1.setName("jLabelPositionSide1"); // NOI18N - - jTextFieldDelay.setText(resourceMap.getString("jTextFieldDelay.text")); // NOI18N - jTextFieldDelay.setName("jTextFieldDelay"); // NOI18N - - jLabelDelaySide1 - .setText(resourceMap.getString("jLabelDelaySide1.text")); // NOI18N - jLabelDelaySide1.setName("jLabelDelaySide1"); // NOI18N - - jTextFieldTextSide1.setName("jTextFieldTextSide1"); // NOI18N - - jLabelTextSide1.setText(resourceMap.getString("jLabelTextSide1.text")); // NOI18N - jLabelTextSide1.setName("jLabelTextSide1"); // NOI18N - - jTextFieldResultSide1.setName("jTextFieldResultSide1"); // NOI18N - - jButtonExecuteSide1.setText(resourceMap - .getString("jButtonExecuteSide1.text")); // NOI18N - jButtonExecuteSide1.setName("jButtonExecuteSide1"); // NOI18N - - org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout( - jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout - .setHorizontalGroup(jPanel1Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel1Layout - .createSequentialGroup() - .add( - jPanel1Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel1Layout - .createSequentialGroup() - .add( - 8, - 8, - 8) - .add( - jRadioButtonInsert) - .add( - 18, - 18, - 18) - .add( - jPanel1Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel1Layout - .createSequentialGroup() - .add( - jLabelPositionSide1) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.UNRELATED) - .add( - jLabelDelaySide1)) - .add( - jPanel1Layout - .createSequentialGroup() - .add( - 12, - 12, - 12) - .add( - jPanel1Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jTextFieldResultSide1, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 251, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jPanel1Layout - .createSequentialGroup() - .add( - jTextFieldPosition, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 22, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - 18, - 18, - 18) - .add( - jTextFieldDelay, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 43, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - 18, - 18, - 18) - .add( - jPanel1Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jLabelTextSide1) - .add( - jTextFieldTextSide1, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 150, - Short.MAX_VALUE)))))) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED)) - .add( - jPanel1Layout - .createSequentialGroup() - .addContainerGap() - .add( - jRadioButtonDelete) - .add( - 285, - 285, - 285))) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add(jButtonExecuteSide1) - .addContainerGap())); - jPanel1Layout - .setVerticalGroup(jPanel1Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel1Layout - .createSequentialGroup() - .add( - jPanel1Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add( - jLabelPositionSide1) - .add(jLabelDelaySide1) - .add(jLabelTextSide1)) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - jPanel1Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add(jRadioButtonInsert) - .add( - jTextFieldPosition, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jTextFieldDelay, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jTextFieldTextSide1, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.UNRELATED) - .add( - jPanel1Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add(jRadioButtonDelete) - .add( - jTextFieldResultSide1, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(12, Short.MAX_VALUE)) - .add( - org.jdesktop.layout.GroupLayout.TRAILING, - jPanel1Layout.createSequentialGroup() - .addContainerGap(46, Short.MAX_VALUE) - .add(jButtonExecuteSide1) - .addContainerGap())); - - jPanel2.setBorder(javax.swing.BorderFactory - .createTitledBorder("Side 2")); - jPanel2.setName("jPanel2"); // NOI18N - - jRadioButtonInsertSide2.setText(resourceMap - .getString("jRadioButtonInsertSide2.text")); // NOI18N - jRadioButtonInsertSide2.setName("jRadioButtonInsertSide2"); // NOI18N - // jRadioButtonInsertSide2.setSelected(true); - - jRadioButtonDeleteSide2.setText(resourceMap - .getString("jRadioButtonDeleteSide2.text")); // NOI18N - jRadioButtonDeleteSide2.setName("jRadioButtonDeleteSide2"); // NOI18N - - jTextFieldPositionSide2.setName("jTextFieldPositionSide2"); // NOI18N - - jLabelPositionSide2.setText(resourceMap - .getString("jLabelPositionSide2.text")); // NOI18N - jLabelPositionSide2.setName("jLabelPositionSide2"); // NOI18N - - jTextFieldDelaySide2.setText(resourceMap - .getString("jTextFieldDelaySide2.text")); // NOI18N - jTextFieldDelaySide2.setName("jTextFieldDelaySide2"); // NOI18N - - jLabelDelaySide2 - .setText(resourceMap.getString("jLabelDelaySide2.text")); // NOI18N - jLabelDelaySide2.setName("jLabelDelaySide2"); // NOI18N - - jTextFieldTextSide2.setName("jTextFieldTextSide2"); // NOI18N - - jLabelTextSide2.setText(resourceMap.getString("jLabelTextSide2.text")); // NOI18N - jLabelTextSide2.setName("jLabelTextSide2"); // NOI18N - - jTextFieldResultSide2.setName("jTextFieldResultSide2"); // NOI18N - - jButtonExecuteSide2.setText(resourceMap - .getString("jButtonExecuteSide2.text")); // NOI18N - jButtonExecuteSide2.setName("jButtonExecuteSide2"); // NOI18N - - org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout( - jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout - .setHorizontalGroup(jPanel2Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel2Layout - .createSequentialGroup() - .add( - jPanel2Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel2Layout - .createSequentialGroup() - .add( - 8, - 8, - 8) - .add( - jRadioButtonInsertSide2) - .add( - 18, - 18, - 18) - .add( - jPanel2Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel2Layout - .createSequentialGroup() - .add( - jLabelPositionSide2) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.UNRELATED) - .add( - jLabelDelaySide2)) - .add( - jPanel2Layout - .createSequentialGroup() - .add( - 12, - 12, - 12) - .add( - jPanel2Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jTextFieldResultSide2, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 251, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jPanel2Layout - .createSequentialGroup() - .add( - jTextFieldPositionSide2, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 22, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - 18, - 18, - 18) - .add( - jTextFieldDelaySide2, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 43, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - 18, - 18, - 18) - .add( - jPanel2Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jLabelTextSide2) - .add( - jTextFieldTextSide2, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 150, - Short.MAX_VALUE)))))) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED)) - .add( - jPanel2Layout - .createSequentialGroup() - .addContainerGap() - .add( - jRadioButtonDeleteSide2) - .add( - 285, - 285, - 285))) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add(jButtonExecuteSide2) - .addContainerGap())); - jPanel2Layout - .setVerticalGroup(jPanel2Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel2Layout - .createSequentialGroup() - .add( - jPanel2Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add( - jLabelPositionSide2) - .add(jLabelDelaySide2) - .add(jLabelTextSide2)) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - jPanel2Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add( - jRadioButtonInsertSide2) - .add( - jTextFieldPositionSide2, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jTextFieldDelaySide2, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jTextFieldTextSide2, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.UNRELATED) - .add( - jPanel2Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add( - jRadioButtonDeleteSide2) - .add( - jTextFieldResultSide2, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jButtonExecuteSide2)) - .addContainerGap( - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE))); - - jPanel3.setBorder(javax.swing.BorderFactory - .createTitledBorder("Side 3")); - jPanel3.setName("jPanel3"); // NOI18N - - jRadioButtonInsertSide3.setText(resourceMap - .getString("jRadioButtonInsertSide3.text")); // NOI18N - jRadioButtonInsertSide3.setName("jRadioButtonInsertSide3"); // NOI18N - // jRadioButtonInsertSide3.setSelected(true); - - jRadioButtonDeleteSide3.setText(resourceMap - .getString("jRadioButtonDeleteSide3.text")); // NOI18N - jRadioButtonDeleteSide3.setName("jRadioButtonDeleteSide3"); // NOI18N - - jTextFieldPositionSide3.setName("jTextFieldPositionSide3"); // NOI18N - - jLabelPositionSide3.setText(resourceMap - .getString("jLabelPositionSide3.text")); // NOI18N - jLabelPositionSide3.setName("jLabelPositionSide3"); // NOI18N - - jTextFieldDelaySide3.setText(resourceMap - .getString("jTextFieldDelaySide3.text")); // NOI18N - jTextFieldDelaySide3.setName("jTextFieldDelaySide3"); // NOI18N - - jLabelDelaySide3 - .setText(resourceMap.getString("jLabelDelaySide3.text")); // NOI18N - jLabelDelaySide3.setName("jLabelDelaySide3"); // NOI18N - - jTextFieldTextSide3.setName("jTextFieldTextSide3"); // NOI18N - - jLabelTextSide3.setText(resourceMap.getString("jLabelTextSide3.text")); // NOI18N - jLabelTextSide3.setName("jLabelTextSide3"); // NOI18N - - jTextFieldResultSide3.setName("jTextFieldResultSide3"); // NOI18N - - jButtonExecuteSide3.setText(resourceMap - .getString("jButtonExecuteSide3.text")); // NOI18N - jButtonExecuteSide3.setName("jButtonExecuteSide3"); // NOI18N - - org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout( - jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout - .setHorizontalGroup(jPanel3Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel3Layout - .createSequentialGroup() - .add( - jPanel3Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel3Layout - .createSequentialGroup() - .add( - 8, - 8, - 8) - .add( - jRadioButtonInsertSide3) - .add( - 18, - 18, - 18) - .add( - jPanel3Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel3Layout - .createSequentialGroup() - .add( - jLabelPositionSide3) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.UNRELATED) - .add( - jLabelDelaySide3)) - .add( - jPanel3Layout - .createSequentialGroup() - .add( - 12, - 12, - 12) - .add( - jPanel3Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jTextFieldResultSide3, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 251, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jPanel3Layout - .createSequentialGroup() - .add( - jTextFieldPositionSide3, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 22, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - 18, - 18, - 18) - .add( - jTextFieldDelaySide3, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 43, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - 18, - 18, - 18) - .add( - jPanel3Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jLabelTextSide3) - .add( - jTextFieldTextSide3, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 150, - Short.MAX_VALUE)))))) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED)) - .add( - jPanel3Layout - .createSequentialGroup() - .addContainerGap() - .add( - jRadioButtonDeleteSide3) - .add( - 285, - 285, - 285))) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add(jButtonExecuteSide3) - .addContainerGap())); - jPanel3Layout - .setVerticalGroup(jPanel3Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel3Layout - .createSequentialGroup() - .add( - jPanel3Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add( - jLabelPositionSide3) - .add(jLabelDelaySide3) - .add(jLabelTextSide3)) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - jPanel3Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add( - jRadioButtonInsertSide3) - .add( - jTextFieldPositionSide3, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jTextFieldDelaySide3, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jTextFieldTextSide3, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.UNRELATED) - .add( - jPanel3Layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add( - jRadioButtonDeleteSide3) - .add( - jTextFieldResultSide3, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(12, Short.MAX_VALUE)) - .add( - org.jdesktop.layout.GroupLayout.TRAILING, - jPanel3Layout.createSequentialGroup() - .addContainerGap(46, Short.MAX_VALUE) - .add(jButtonExecuteSide3) - .addContainerGap())); - - jButtonRun.setText(resourceMap.getString("jButtonRun.text")); // NOI18N - jButtonRun.setName("jButtonRun"); // NOI18N - - jButtonExit.setText(resourceMap.getString("jButtonExit.text")); // NOI18N - jButtonExit.setName("jButtonExit"); // NOI18N - - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout( - this); - this.setLayout(layout); - layout - .setHorizontalGroup(layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - org.jdesktop.layout.GroupLayout.TRAILING, - layout - .createSequentialGroup() - .addContainerGap(320, Short.MAX_VALUE) - .add(jButtonRun) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add(jButtonExit).addContainerGap()) - .add( - layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - layout - .createSequentialGroup() - .add(3, 3, 3) - .add( - layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - jPanel3, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - layout - .createSequentialGroup() - .add( - 48, - 48, - 48) - .add( - jLabelInitialState) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - jTextFieldInitialState, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 140, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - 43, - 43, - 43) - .add( - jLabelGlobalResult)) - .add( - jPanel1, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jPanel2, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .addContainerGap( - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE)))); - layout - .setVerticalGroup(layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - org.jdesktop.layout.GroupLayout.TRAILING, - layout - .createSequentialGroup() - .addContainerGap(376, Short.MAX_VALUE) - .add( - layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add(jButtonRun).add( - jButtonExit)) - .addContainerGap()) - .add( - layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - layout - .createSequentialGroup() - .addContainerGap() - .add( - layout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add( - jTextFieldInitialState, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - jLabelInitialState) - .add( - jLabelGlobalResult)) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - jPanel1, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - jPanel2, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - jPanel3, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addContainerGap(42, - Short.MAX_VALUE)))); - }// </editor-fold> - - // Variables declaration - do not modify - private javax.swing.JButton jButtonExecuteSide1; - private javax.swing.JButton jButtonExecuteSide2; - private javax.swing.JButton jButtonExecuteSide3; - private javax.swing.JButton jButtonExit; - private javax.swing.JButton jButtonRun; - private javax.swing.JLabel jLabelDelaySide1; - private javax.swing.JLabel jLabelDelaySide2; - private javax.swing.JLabel jLabelDelaySide3; - private javax.swing.JLabel jLabelGlobalResult; - private javax.swing.JLabel jLabelInitialState; - private javax.swing.JLabel jLabelPositionSide1; - private javax.swing.JLabel jLabelPositionSide2; - private javax.swing.JLabel jLabelPositionSide3; - private javax.swing.JLabel jLabelTextSide1; - private javax.swing.JLabel jLabelTextSide2; - private javax.swing.JLabel jLabelTextSide3; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; - private javax.swing.JRadioButton jRadioButtonDelete; - private javax.swing.JRadioButton jRadioButtonDeleteSide2; - private javax.swing.JRadioButton jRadioButtonDeleteSide3; - private javax.swing.JRadioButton jRadioButtonInsert; - private javax.swing.JRadioButton jRadioButtonInsertSide2; - private javax.swing.JRadioButton jRadioButtonInsertSide3; - private javax.swing.JTextField jTextFieldDelay; - private javax.swing.JTextField jTextFieldDelaySide2; - private javax.swing.JTextField jTextFieldDelaySide3; - private javax.swing.JTextField jTextFieldInitialState; - private javax.swing.JTextField jTextFieldPosition; - private javax.swing.JTextField jTextFieldPositionSide2; - private javax.swing.JTextField jTextFieldPositionSide3; - private javax.swing.JTextField jTextFieldResultSide1; - private javax.swing.JTextField jTextFieldResultSide2; - private javax.swing.JTextField jTextFieldResultSide3; - private javax.swing.JTextField jTextFieldTextSide1; - private javax.swing.JTextField jTextFieldTextSide2; - private javax.swing.JTextField jTextFieldTextSide3; - - // End of variables declaration - - /** - * this method init additional listener and component settings. - */ - private void initListener() { - /*set init document text. */ - jTextFieldInitialState.setText(resourceMap - .getString("jTextFieldInitialState.text")); - jTextFieldResultSide1.setText(resourceMap - .getString("jTextFieldInitialState.text")); - jTextFieldResultSide2.setText(resourceMap - .getString("jTextFieldInitialState.text")); - jTextFieldResultSide3.setText(resourceMap - .getString("jTextFieldInitialState.text")); - - /* set action listener. */ - jButtonExecuteSide1.addActionListener(actionListener); - jButtonExecuteSide2.addActionListener(actionListener); - jButtonExecuteSide3.addActionListener(actionListener); - - jButtonExit.addActionListener(actionListener); - jButtonRun.addActionListener(actionListener); - } - - public class JupiterActionListener implements ActionListener { - - // Messages resourceMap; - - public void actionPerformed(ActionEvent event) { - - /* Exit program */ - if (resourceMap.getString("jButtonExit.text").equals( - event.getActionCommand())) { - System.exit(0); - } - /* run jupiter. :) */ - if (resourceMap.getString("jButtonRun.text").equals( - event.getActionCommand())) { - jupiter.simulate(); - } - if (resourceMap.getString("jButtonExecuteSide1.text").equals( - event.getActionCommand())) { - jupiter.simulate(SIDE_1); - } - if (resourceMap.getString("jButtonExecuteSide2.text").equals( - event.getActionCommand())) { - jupiter.simulate(SIDE_2); - } - if (resourceMap.getString("jButtonExecuteSide3.text").equals( - event.getActionCommand())) { - jupiter.simulate(SIDE_3); - } - } - } - - public class JupiterSimulater implements JupiterDocumentListener { - - protected SimulateNetzwork network; - - protected ClientSynchronizedDocument c1; - protected ClientSynchronizedDocument c2; - protected ClientSynchronizedDocument c3; -// protected ServerSynchronizedDocument s1; - protected ConcurrentManager s1; - - JID jid_c1; - JID jid_c2; - JID jid_c3; - - public JupiterSimulater() { - init(); - // deactiveSide3(); - } - -// public void deactiveSide3() { -// network.removeClient(c3); -// s1.removeProxyClient(jid_c3); -// jPanel3.setVisible(false); -// update(); -// } - - private void init() { - - network = new SimulateNetzwork(); - - jid_c1 = new JID("ori79@jabber.cc"); - jid_c2 = new JID("ori80@jabber.cc"); - jid_c3 = new JID("ori81@jabber.cc"); - JID jid_server = new JID("ori78@jabber.cc"); - - c1 = new ClientSynchronizedDocument(jTextFieldInitialState - .getText(), network, jid_c1); - c1.addJupiterDocumentListener(this); - c2 = new ClientSynchronizedDocument(jTextFieldInitialState - .getText(), network, jid_c2); - c2.addJupiterDocumentListener(this); - c3 = new ClientSynchronizedDocument(jTextFieldInitialState - .getText(), network, jid_c3); - c3.addJupiterDocumentListener(this); -// s1 = new ServerSynchronizedDocument(jTextFieldInitialState -// .getText(), network, jid_server); - s1 = new ConcurrentManager( network, jid_server); - - network.addClient(c1); - network.addClient(c2); - network.addClient(c3); - network.addClient(s1); - - /* create proxyqueues. */ - s1.addProxyClient(jid_c1); - s1.addProxyClient(jid_c2); - s1.addProxyClient(jid_c3); - } - - public void simulate() { - try { - executeSide1(); - executeSide2(); - executeSide3(); - } catch (Exception e) { - JOptionPane.showMessageDialog(new JFrame(), e.getMessage()); - } - } - - public void simulate(String side) { - try { - if (side.endsWith(SIDE_1)) { - executeSide1(); - } - if (side.endsWith(SIDE_2)) { - executeSide2(); - } - if (side.endsWith(SIDE_3)) { - executeSide3(); - } - } catch (Exception e) { - JOptionPane.showMessageDialog(new JFrame(), "Error"); - } - } - - private void executeSide1() throws Exception { - Operation operation = null; - try { - /* get op type */ - if (jRadioButtonDelete.isSelected()) { - operation = new DeleteOperation(Integer - .parseInt(jTextFieldPosition.getText()), - jTextFieldTextSide1.getText()); - } - if (jRadioButtonInsert.isSelected()) { - operation = new InsertOperation(Integer - .parseInt(jTextFieldPosition.getText()), - jTextFieldTextSide1.getText()); - } - } catch (Exception e) { - logger.error("Error in side 1 operation creation", e); - } - if (operation != null) - c1.sendOperation(operation, Integer.parseInt(jTextFieldDelay - .getText())); - } - - private void executeSide2() throws Exception { - Operation operation = null; - try { - /* get op type */ - if (jRadioButtonDeleteSide2.isSelected()) { - operation = new DeleteOperation(Integer - .parseInt(jTextFieldPositionSide2.getText()), - jTextFieldTextSide2.getText()); - } - if (jRadioButtonInsertSide2.isSelected()) { - operation = new InsertOperation(Integer - .parseInt(jTextFieldPositionSide2.getText()), - jTextFieldTextSide2.getText()); - } - - } catch (Exception e) { - logger.error("Error in side 2 operation creation", e); - } - if (operation != null) - c2.sendOperation(operation, Integer - .parseInt(jTextFieldDelaySide2.getText())); - } - - private void executeSide3() throws Exception { - Operation operation = null; - try { - /* get op type */ - if (jRadioButtonDeleteSide3.isSelected()) { - operation = new DeleteOperation(Integer - .parseInt(jTextFieldPositionSide3.getText()), - jTextFieldTextSide3.getText()); - } - if (jRadioButtonInsertSide2.isSelected()) { - operation = new InsertOperation(Integer - .parseInt(jTextFieldPositionSide3.getText()), - jTextFieldTextSide3.getText()); - } - } catch (Exception e) { - logger.error("Error in side 3 operation creation", e); - } - if (operation != null) - c3.sendOperation(operation, Integer - .parseInt(jTextFieldDelaySide3.getText())); - } - - /** - * update ui with new document state. - * - * @param side - */ - public void documentAction(JID jid) { - if (jid.equals(jid_c1)) { - jTextFieldResultSide1.setText(c1.getDocument()); - update(); - } - if (jid.equals(jid_c2)) { - jTextFieldResultSide2.setText(c2.getDocument()); - update(); - } - if (jid.equals(jid_c3)) { - jTextFieldResultSide3.setText(c3.getDocument()); - update(); - } - } - - public String getID() { - return "TEST"; - - } - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/Messages.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/Messages.java deleted file mode 100644 index 66d6474d81e8e935d3ff3d454886db0eb67ce3d3..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/Messages.java +++ /dev/null @@ -1,22 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.ui; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "de.fu_berlin.inf.dpp.test.jupiter.ui.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - public Messages() { - } - - public String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/UITest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/UITest.java deleted file mode 100644 index 5b219b4bbd8820528dbc08d8e2cad79bb3ef101a..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/UITest.java +++ /dev/null @@ -1,29 +0,0 @@ -package de.fu_berlin.inf.dpp.test.jupiter.ui; - -import javax.swing.JFrame; - -import org.apache.log4j.PropertyConfigurator; - - -public class UITest { - static { - PropertyConfigurator.configureAndWatch("log4j.properties", 60 * 1000); - } -// public void testStartUI() throws Exception{ -// JupiterTestUI testUI = new JupiterTestUI(); -// testUI.setVisible(true); -// System.out.println("test"); -// } - - public static void main(String[] args){ - JupiterTestUI ui = new JupiterTestUI(); -// - JFrame frame = new JFrame(); - frame.add(ui); - frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); - frame.setSize( 508, 452 ); - - frame.setVisible( true ); - - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/messages.properties b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/messages.properties deleted file mode 100644 index a5809c1d066c44534fab2df251de81d5bae43304..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/jupiter/ui/messages.properties +++ /dev/null @@ -1,29 +0,0 @@ -JupiterTestUI.0=Test Text -jLabelInitialState.text=Initial state: -jTextFieldInitialState.text=abc -jButtonRun.text=Run -jLabelTextSide3.text=Text -jLabelDelaySide3.text=Delay -jTextFieldDelaySide3.text=0 -jLabelPositionSide3.text=Position -jRadioButtonDeleteSide3.text=Delete OP -jRadioButtonInsertSide3.text=Insert OP -jLabelTextSide2.text=Text -jLabelDelaySide2.text=Delay -jTextFieldDelaySide2.text=0 -jLabelPositionSide2.text=Position -jRadioButtonDeleteSide2.text=Delete OP -jRadioButtonInsertSide2.text=Insert OP -jLabelTextSide1.text=Text -jLabelDelaySide1.text=Delay -jTextFieldDelay.text=0 -jLabelPositionSide1.text=Position -jRadioButtonDelete.text=Delete OP -jRadioButtonInsert.text=Insert OP -jLabelGlobalResult.text=Result -#NOI18N -jLabelGlobalResult.font=Dialog 12 Bold -jButtonExit.text=Exit -jButtonExecuteSide3.text=Execute3 -jButtonExecuteSide2.text=Execute2 -jButtonExecuteSide1.text=Execute1 \ No newline at end of file diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/IBBFileTransferTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/IBBFileTransferTest.java deleted file mode 100644 index 66218e9bfe651cbdab4fb40e60bad20e59978434..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/IBBFileTransferTest.java +++ /dev/null @@ -1,162 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.logging.Logger; - -import junit.framework.TestCase; - -import org.eclipse.core.runtime.CoreException; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smackx.filetransfer.FileTransferListener; -import org.jivesoftware.smackx.filetransfer.FileTransferManager; -import org.jivesoftware.smackx.filetransfer.FileTransferRequest; -import org.jivesoftware.smackx.filetransfer.IncomingFileTransfer; - -import de.fu_berlin.inf.dpp.FileList; -import de.fu_berlin.inf.dpp.Saros; -import de.fu_berlin.inf.dpp.net.ITransmitter; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.net.internal.XMPPChatTransmitter; -import de.fu_berlin.inf.dpp.test.util.FileListHelper; - -public class IBBFileTransferTest extends TestCase implements FileTransferListener{ - static { - XMPPConnection.DEBUG_ENABLED = true; - } - - private static Logger logger = Logger.getLogger(XMPPTransmitterTest.class.toString()); - - private XMPPConnection connection1; - private FileTransferManager transferManager1; - - private XMPPConnection connection2; - private FileTransferManager transferManager2; - - public void setUp() throws Exception { - - connection1 = new XMPPConnection("jabber.cc"); - // while (!connection1.isAuthenticated()) { - // System.out.println("connecting user1"); - connection1.connect(); - connection1.login("ori79", "123456"); - // } - transferManager1 = new FileTransferManager(connection1); - logger.info("connection 1 established."); - Thread.sleep(1000); - - connection2 = new XMPPConnection("jabber.cc"); - // while (!connection2.isAuthenticated()) { - - connection2.connect(); - connection2.login("ori78", "123456"); - // } - logger.info("connection 1 established."); - transferManager2 = new FileTransferManager(connection2); - - Thread.sleep(1000); - - } - - public void tearDown() { - connection1.disconnect(); - connection2.disconnect(); - } - - - public void testFileListTranfer() throws CoreException, XMPPException{ -// XMPPChatTransmitter receiver = new XMPPChatTransmitter(connection2); - - transferManager2.addFileTransferListener(this); - - ITransmitter transfer = new XMPPChatTransmitter(connection1); - - FileList list = FileListHelper.createFileListForDefaultProject(); - transfer.sendFileList(new JID(connection2.getUser()), list); - } - - public void fileTransferRequest(FileTransferRequest request) { - String fileDescription = request.getDescription(); - -// IncomingFileTransfer transfer = request.accept(); -// FileList fileList = receiveFileList(request); - FileList fileList = receiveFileListBufferByteArray(request); - assertNotNull(fileList); - } - - private FileList receiveFileListBufferByteArray(FileTransferRequest request){ - FileList fileList = null; - try { - final IncomingFileTransfer transfer = request.accept(); - - InputStream in = transfer.recieveFile(); - - - byte[] buffer = new byte[1024]; - int bytesRead; - String sb = new String(); - while ((bytesRead = in.read(buffer, 0, 1024)) != -1) { - sb += new String(buffer,0,buffer.length).toString(); - System.out.println("incomming: "+sb); - } - - fileList = new FileList(sb.toString()); - - - - } catch (Exception e) { -// log.error(e.getMessage()); - e.printStackTrace(); - Saros.log("Exception while receiving file list", e); - // TODO retry? but we dont catch any exception here, - // smack might not throw them up - } - - return fileList; - } - - private FileList receiveFileList(FileTransferRequest request) { -// log.info("Receiving file list"); - - FileList fileList = null; - try { - final IncomingFileTransfer transfer = request.accept(); - - InputStream in = transfer.recieveFile(); - - BufferedReader reader = new BufferedReader( - new InputStreamReader(in)); - StringBuffer sb = new StringBuffer(); - - try { - String line = null; - /* TODO: an dieser Stelle kommt es zu einem DeadLock. */ - while ((line = reader.readLine()) != null) { - System.out.println(line); - sb.append(line + "\n"); - } - } catch (Exception e) { -// logger.error(e.getMessage()); - e.printStackTrace(); -// Saros.log("Error while receiving file list", e); - } finally { - reader.close(); - } - - fileList = new FileList(sb.toString()); - -// log.info("Received file list"); - - } catch (Exception e) { -// log.error(e.getMessage()); - e.printStackTrace(); - Saros.log("Exception while receiving file list", e); - // TODO retry? but we dont catch any exception here, - // smack might not throw them up - } - - return fileList; - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/JingleFileTransferTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/JingleFileTransferTest.java deleted file mode 100644 index b025ef2a8db8884c007591b11c1874cb1891a876..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/JingleFileTransferTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net; - -import java.util.logging.Logger; - -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smackx.filetransfer.FileTransferManager; - -import junit.framework.TestCase; - -public class JingleFileTransferTest extends TestCase{ - - static { - XMPPConnection.DEBUG_ENABLED = true; - } - - private static Logger logger = Logger.getLogger(XMPPTransmitterTest.class.toString()); - - private XMPPConnection connection1; - private FileTransferManager transferManager1; - - private XMPPConnection connection2; - private FileTransferManager transferManager2; - - public void setUp() throws Exception { -// PropertyConfigurator.configureAndWatch("log4j.properties", 60 * 1000); -// Logger logger = Logger.getLogger("de.fu_berlin.inf.dpp"); - - connection1 = new XMPPConnection("jabber.cc"); - // while (!connection1.isAuthenticated()) { - // System.out.println("connecting user1"); - connection1.connect(); - connection1.login("ori79", "123456"); - // } - transferManager1 = new FileTransferManager(connection1); - logger.info("connection 1 established."); - Thread.sleep(1000); - - connection2 = new XMPPConnection("jabber.cc"); - // while (!connection2.isAuthenticated()) { - - connection2.connect(); - connection2.login("ori78", "123456"); - // } - logger.info("connection 1 established."); - transferManager2 = new FileTransferManager(connection2); - - Thread.sleep(1000); - -// mock = new MockInvitationProcess(this, null, null); - } - - public void tearDown() { - connection1.disconnect(); - connection2.disconnect(); - } - - public void testJingleFileListTransfer(){ - - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/MultiUserChatManagerTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/MultiUserChatManagerTest.java deleted file mode 100644 index 0bb601d59020b3653d252d4d9b3b94af122eefb0..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/MultiUserChatManagerTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net; - -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; -import org.jivesoftware.smack.XMPPConnection; - -import de.fu_berlin.inf.dpp.net.internal.MultiUserChatManager; -import junit.framework.TestCase; - -public class MultiUserChatManagerTest extends TestCase { - - static { - XMPPConnection.DEBUG_ENABLED = true; - } - -// private String server = "jabber.org"; - private String server = "teppic.local"; - - private XMPPConnection conn1; - private String user1 = "ori79"; - private String user2 = "ori78"; - private String password = "123456"; - - private XMPPConnection conn2; - - protected void setUp() throws Exception{ - PropertyConfigurator.configureAndWatch("log4j.properties", 60 * 1000); - Logger logger = Logger.getLogger("de.fu_berlin.inf.dpp"); - - conn1 = new XMPPConnection(server); - conn1.connect(); - conn1.login(user1, password); - -// conn2 = new XMPPConnection(server); -// conn2.connect(); -// conn2.login(user2, password); - - } - - protected void tearDown() throws Exception { - conn1.disconnect(); - conn2.disconnect(); - } - - public void testRoomExistConnection() throws Exception { - MultiUserChatManager mucManager = new MultiUserChatManager(); - mucManager.initMUC(conn1, user1,"ori2007@conference.teppic"); - -// MultiUserChatManager mucMananagerUser2 = new MultiUserChatManager(); -// mucMananagerUser2.initMUC(conn2, user2); - System.out.println("connected."); - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/ReceiveFileListFileTransferListener.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/ReceiveFileListFileTransferListener.java deleted file mode 100644 index cfddd9c478b43be376b31aae81ae1e701203d90d..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/ReceiveFileListFileTransferListener.java +++ /dev/null @@ -1,113 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net; - -import java.io.BufferedInputStream; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.logging.Logger; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smackx.filetransfer.FileTransferListener; -import org.jivesoftware.smackx.filetransfer.FileTransferRequest; -import org.jivesoftware.smackx.filetransfer.IBBTransferNegotiator; -import org.jivesoftware.smackx.filetransfer.IncomingFileTransfer; - -import de.fu_berlin.inf.dpp.test.util.ResourceHelper; - -public class ReceiveFileListFileTransferListener implements - FileTransferListener { - - private static Logger logger = Logger.getLogger(ReceiveFileListFileTransferListener.class.toString()); - - - public void fileTransferRequest(FileTransferRequest request) { - - IncomingFileTransfer transfer = request.accept(); - String filename = request.getFileName() - + "." - + request.getRequestor().substring(0, - request.getRequestor().indexOf("@")); - try { - logger.info("Received File list: "+request.getFileName()); - // transfer.recieveFile(new File(filename)); - - - final InputStream input = transfer.recieveFile(); - IProject project = ResourceHelper.getProject(ResourceHelper.RECEIVED_TEST_PROJECT); - final IFile file = project.getFile(request.getFileName()); - if (file.exists()) { - // file.setReadOnly(false); - System.out.println("file exist file"); - new Thread(new Runnable(){ - - public void run() { - try { - file.setContents(input, IResource.FORCE, - new NullProgressMonitor()); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - }).start(); - - - } else { - System.out.println("create new file"); - new Thread(new Runnable(){ - - - public void run() { - try { - file.create(input, false, new NullProgressMonitor()); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - }).start(); - - - } - - logger.info("receiving finished."); - /* 2. Test with direct writing file. */ -// java.io.File file = new File("Testfile"); -// System.out.println(file.getAbsolutePath()); -// transfer.recieveFile(file); -// System.out.println("file created."); - - // catch (IOException e) { - // // TODO Auto-generated catch block - // e.printStackTrace(); - // } - // mock.resourceReceived(null, new - // Path(transfer.getFileName()+".received"), input); - } catch (CoreException e) { - - e.printStackTrace(); - } - catch (XMPPException e) { - // TODO Auto-generated catch block - System.out.println(e); - // logger.log(Level.ALL,e.getMessage()); - } - - // if (new File(filename).exists()) { - // // new File("Testfile2.txt").deleteOnExit(); - // logger.debug("File exists and will delete."); - // } - - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/ReceivedSingleFileListener.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/ReceivedSingleFileListener.java deleted file mode 100644 index bc3b677929f16201db128dfc3a3b2e623283c473..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/ReceivedSingleFileListener.java +++ /dev/null @@ -1,86 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net; - -import java.io.File; -import java.io.InputStream; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smackx.filetransfer.FileTransferListener; -import org.jivesoftware.smackx.filetransfer.FileTransferRequest; -import org.jivesoftware.smackx.filetransfer.IncomingFileTransfer; - -import de.fu_berlin.inf.dpp.test.util.ResourceHelper; - -public class ReceivedSingleFileListener implements FileTransferListener { - - private static Logger logger = Logger.getLogger(ReceivedSingleFileListener.class.toString()); - private static final String RESOURCE_TRANSFER_DESCRIPTION = "resourceAddActivity"; - - public void fileTransferRequest(FileTransferRequest request) { - IncomingFileTransfer transfer = request.accept(); - - - try { - logger.info("received file: "+transfer.getFilePath() + " "+transfer.getFileName()+ " desc: "+request.getDescription()); - - // transfer.recieveFile(new File(filename)); - - - InputStream input = transfer.recieveFile(); - IProject project = ResourceHelper.getProject(ResourceHelper.RECEIVED_TEST_PROJECT); - - String path = request.getDescription().substring(RESOURCE_TRANSFER_DESCRIPTION.length()+1); - System.out.println("Path : "+path); - IFile file = project.getFile(path); - if (file.exists()) { - // file.setReadOnly(false); - logger.info("file already exists and will be update."); - file.setContents(input, IResource.FORCE, - new NullProgressMonitor()); - - } else { - if(!file.getParent().exists()){ - logger.info("create dir: "+new File(file.getParent().getFullPath().toString()).mkdirs()); - } - IResource re = file.getParent(); - - file.create(input, true, new NullProgressMonitor()); - logger.info("new file will be create."); - } - - /* 2. Test with direct writing file. */ -// java.io.File file = new File("Testfile"); -// System.out.println(file.getAbsolutePath()); -// transfer.recieveFile(file); -// System.out.println("file created."); - - // catch (IOException e) { - // // TODO Auto-generated catch block - // e.printStackTrace(); - // } - // mock.resourceReceived(null, new - // Path(transfer.getFileName()+".received"), input); - } catch (CoreException e) { - - e.printStackTrace(); - } - catch (XMPPException e) { - // TODO Auto-generated catch block - System.out.println(e); - // logger.log(Level.ALL,e.getMessage()); - } - - // if (new File(filename).exists()) { - // // new File("Testfile2.txt").deleteOnExit(); - // logger.debug("File exists and will delete."); - // } - - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/RequestTransmitterTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/RequestTransmitterTest.java deleted file mode 100644 index f863fe6e5c2b5d05dc2213ab422723975c6baadb..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/RequestTransmitterTest.java +++ /dev/null @@ -1,110 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net; -/** - * this class contains test case for transfering jupiter requests as - * jabber packet extensions. - */ -import org.eclipse.core.runtime.Path; -import org.jivesoftware.smack.Chat; -import org.jivesoftware.smack.ChatManager; -import org.jivesoftware.smack.MessageListener; -import org.jivesoftware.smack.PacketListener; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.filter.MessageTypeFilter; -import org.jivesoftware.smack.packet.Message; -import org.jivesoftware.smack.packet.Packet; -import org.jivesoftware.smack.provider.ProviderManager; - -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.JupiterVectorTime; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.RequestImpl; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.net.internal.RequestExtensionProvider; -import de.fu_berlin.inf.dpp.net.internal.RequestPacketExtension; - -import junit.framework.TestCase; - -public class RequestTransmitterTest extends TestCase implements PacketListener, MessageListener { - - static { - XMPPConnection.DEBUG_ENABLED = true; - ProviderManager providermanager = ProviderManager.getInstance(); - providermanager.addExtensionProvider(RequestPacketExtension.ELEMENT, RequestPacketExtension.NAMESPACE, - new RequestExtensionProvider()); - } - private XMPPConnection connection1; - private XMPPConnection connection2; - Request req; - - public RequestTransmitterTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - super.setUp(); - connection1 = new XMPPConnection("jabber.cc"); - connection1.connect(); - connection1.login("ori78", "123456"); - - connection2 = new XMPPConnection("jabber.cc"); - connection2.connect(); - connection2.login("ori79", "123456"); - connection2.addPacketListener(this, new MessageTypeFilter( - Message.Type.chat)); - - req = new RequestImpl(1,new JupiterVectorTime(1,3),new DeleteOperation(34,"insert text")); - req.setEditorPath(new Path("hello")); - req.setJID(new JID("ori78@jabber.cc")); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testSendRequest() throws XMPPException, Exception{ - ChatManager chatmanager = connection1.getChatManager(); - Chat newChat = chatmanager.createChat(connection2.getUser(),this); - - try { - Message message = new Message(); -// Request req = new RequestImpl(1,new JupiterVectorTime(1,3),new DeleteOperation(34,"insert text")); -// req.setEditorPath(new Path("hello")); -// req.setJID(new JID("ori78@jabber.cc")); - message.addExtension(new RequestPacketExtension(req)); - newChat.sendMessage(message); - } - catch (XMPPException e) { - System.out.println("Error Delivering block"); - } - Thread.sleep(300); - } - - public void processPacket(Packet packet) { - - Message message = (Message) packet; - - RequestPacketExtension packetExtension = (RequestPacketExtension)message.getExtension(RequestPacketExtension.ELEMENT,RequestPacketExtension.NAMESPACE); - if(packetExtension != null){ - System.out.println("Received request : "+packetExtension.getRequest().toString()); - assertEquals(req,packetExtension.getRequest()); - }else{ - System.out.println("Failure in request packet extension."); - } - } - - public void processMessage(Chat chat, Message message) { - RequestPacketExtension packetExtension = (RequestPacketExtension)message.getExtension(RequestPacketExtension.ELEMENT, - RequestPacketExtension.NAMESPACE); - if(packetExtension != null){ - System.out.println("Received request : "+packetExtension.getRequest().toString()); - assertEquals(req,packetExtension.getRequest()); - }else{ - System.out.println("Failure in request packet extension."); - } - } - - - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/RosterListenerImpl.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/RosterListenerImpl.java deleted file mode 100644 index 0876a0476783a3366d70932129e34d8dae90dccd..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/RosterListenerImpl.java +++ /dev/null @@ -1,281 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net; - -import java.util.Collection; -import java.util.Iterator; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.jivesoftware.smack.PacketListener; -import org.jivesoftware.smack.Roster; -import org.jivesoftware.smack.RosterEntry; -import org.jivesoftware.smack.RosterListener; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.Packet; -import org.jivesoftware.smack.packet.Presence; -import org.jivesoftware.smack.packet.RosterPacket; -import org.jivesoftware.smack.packet.RosterPacket.ItemStatus; -import org.jivesoftware.smack.packet.RosterPacket.ItemType; - -import de.fu_berlin.inf.dpp.net.JID; - -public class RosterListenerImpl implements RosterListener, PacketListener { - - private static Logger logger = Logger.getLogger(RosterListenerImpl.class - .toString()); - - private XMPPConnection connection; - -// private Roster roster; - - public RosterListenerImpl(XMPPConnection conn, Roster roster) { - this.connection = conn; -// this.roster = roster; - } - - public void entriesAdded(Collection<String> addresses) { - logger.info("entriesAdded on "+connection.getUser()); - for (Iterator<String> it = addresses.iterator(); it.hasNext();) { - String address = it.next(); -// RosterEntry entry = roster.getEntry(address); - RosterEntry entry = connection.getRoster().getEntry(address); - // When the entry is only from the other user, then send a - // subscription request - try { - if (entry != null - && entry.getType() == RosterPacket.ItemType.none) { - - logger.info("added with type none " + connection.getUser()); - String name = entry.getName(); - if (entry.getName() == null) { - name = new JID(entry.getUser()).getName(); - } - // addUser(entry.getUser(), entry.getName()); - // connection.getRoster().createEntry(entry.getUser(), - // name, new String[0]); - - } - if (entry != null - && entry.getType() == RosterPacket.ItemType.from) { - logger.info("added with type from " + connection.getUser()); - -// String name = entry.getName(); -// if (entry.getName() == null) { -// name = new JID(entry.getUser()).getName(); -// } - - connection.getRoster().createEntry(entry.getUser(), entry.getUser(), - new String[0]); -// roster.createEntry(entry.getUser(), entry.getUser(), -// new String[0]); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - } - - public void entriesDeleted(Collection<String> addresses) { - logger.info("entries delete " + connection.getUser()); - - } - - public void entriesUpdated(Collection<String> addresses) { - logger.info("entries update " + connection.getUser()); - for (String address : addresses) { - RosterEntry entry = connection.getRoster().getEntry(address); - if (entry.getType().equals(RosterPacket.ItemType.to)) { - System.out.println("to"); -// -// Presence presence = new Presence(Presence.Type.subscribed); -// presence.setTo(entry.getUser()); -// presence.setFrom(connection.getUser()); -// -// connection.sendPacket(presence); - - /* wir kommen hier in eine endlosschleife. */ - // RosterPacket.Item rosterItem = new RosterPacket.Item( - // entry.getUser(), entry.getUser()); - // ; - // rosterItem.setItemType(ItemType.both); - // rosterItem.setName(entry.getUser()); - // - // RosterPacket rosterPacket = new RosterPacket(); - // rosterPacket.setType(IQ.Type.SET); - // rosterPacket.addRosterItem(rosterItem); - // connection.sendPacket(rosterPacket); - } - if (entry.getType().equals(RosterPacket.ItemType.from)) { - System.out.println("from"); - try { - // RosterPacket.Item rosterItem = new RosterPacket.Item( - // connection.getUser(), connection.getUser()); - // ; - // rosterItem.setItemType(ItemType.both); - // rosterItem.setName(entry.getUser()); - // - // RosterPacket rosterPacket = new RosterPacket(); - // rosterPacket.setType(IQ.Type.SET); - // rosterPacket.addRosterItem(rosterItem); - // connection.sendPacket(rosterPacket); - - // if(roster.getEntry(entry.getUser()) == null){ - - - connection.getRoster().createEntry(entry.getUser(), - entry.getUser(), new String[0]); -// roster.createEntry(entry.getUser(), -// entry.getUser(), new String[0]); - - - - // } - } catch (XMPPException e) { - logger.info(e.getStackTrace().toString()); -// e.printStackTrace(); - } - } - // if (entry.getType().equals(RosterPacket.ItemType.none)) { - // System.out.println("none"); - // } - if (entry.getStatus() != null - && entry.getStatus().equals( - RosterPacket.ItemStatus.SUBSCRIPTION_PENDING)) { - logger.info("subscripe"); - - if (entry.getUser().equals(connection.getUser())) { - Presence presence = new Presence(Presence.Type.unsubscribed); - presence.setTo(entry.getUser()); - presence.setFrom(connection.getUser()); - - connection.sendPacket(presence); - } else { - Presence presence = new Presence(Presence.Type.subscribed); - presence.setTo(entry.getUser()); - presence.setFrom(connection.getUser()); - - connection.sendPacket(presence); - } - - // addUser(entry.getUser(),new JID(entry.getUser()).getName()); - } - // addUser(entry.getUser(), entry.getName()); - // System.out.println(entry.getStatus()); - // System.out.println(entry.getName()); - } - } - - public void presenceChanged(Presence presence) { - - logger.info("presence changed user" + connection.getUser() - + " status :" + presence.getType() + " from: " - + presence.getFrom()); - } - - @Deprecated - public void addUser(String user, String name) { - RosterPacket.Item rosterItem = new RosterPacket.Item(user, name); - rosterItem.setItemType(ItemType.both); - rosterItem.setName(name); - - RosterPacket rosterPacket = new RosterPacket(); - rosterPacket.setType(IQ.Type.SET); - rosterPacket.addRosterItem(rosterItem); - // rosterPacket.toXML(); - - connection.sendPacket(rosterPacket); - - Presence presence = new Presence(Presence.Type.subscribed); - presence.setTo(user); - presence.setFrom(connection.getUser()); - - connection.sendPacket(presence); - } - - public void processPacket(Packet packet) { - // TODO Auto-generated method stub - logger.info("Packet called. " + packet.getFrom()); - - if (!packet.getFrom().equals(connection.getUser())) { - - // RosterPacket rosterp = (RosterPacket) packet; - /* - * 1. überprüfen ob es eine subscribe anfrage ist 2. überprüfen, ob - * user im in liste ist. 3. hinzufügen des accounts. - */ - if (packet instanceof Presence) { - - Presence p = (Presence) packet; - - /* this states handled by roster listener. */ - if (p.getType().equals(Presence.Type.unavailable) - || p.getType().equals(Presence.Type.available)) { - logger.info("Presence " + p.getFrom() + " " + p.getType()); - return; - } - - if (p.getType() == Presence.Type.subscribed) { - logger.info("subcriped form " + p.getFrom()); - } - - /* Anfrage für eine Kontakthinzufügung. */ - if (p.getType().equals(Presence.Type.subscribe)) { - - //TODO: Änderung ohne roster object - RosterEntry e = connection.getRoster().getEntry(packet.getFrom()); - logger.info("subscribe from " + p.getFrom()); -// RosterEntry e = roster.getEntry(packet.getFrom()); -// logger.info("subscribe from " + p.getFrom()); - - - if (e == null) { - try { -// Presence presence = new Presence( -// Presence.Type.subscribe); -// presence.setTo(packet.getFrom()); -// presence.setFrom(connection.getUser()); -// -// connection.sendPacket(presence); - - //TODO: Änderung ohne Roster object - connection.getRoster().createEntry(packet.getFrom(), packet.getFrom(), null); -// roster.createEntry(packet.getFrom(), packet.getFrom(), null); - /* allow presence. */ - - // RosterPacket.Item rosterItem = new - // RosterPacket.Item( - // packet.getFrom(), new - // JID(packet.getFrom()).getName()); - // ; - // rosterItem.setItemType(ItemType.both); - // rosterItem.setName(new - // JID(packet.getFrom()).getName()); - // - // RosterPacket rosterPacket = new RosterPacket(); - // rosterPacket.setType(IQ.Type.SET); - // rosterPacket.addRosterItem(rosterItem); - // connection.sendPacket(rosterPacket); - } catch (XMPPException e1) { - logger.log(Level.WARNING, e1.getStackTrace().toString()); - } - } - - } - if (packet instanceof RosterPacket) { - RosterPacket rp = (RosterPacket) packet; - System.out.println(rp.getType()); - } - } - // addUser(rosterp.getFrom(), rosterp.getFrom()); - // try { - // roster.createEntry(rosterp.getFrom(), rosterp.getFrom(), null); - // } catch (XMPPException e) { - // // TODO Auto-generated catch block - // e.printStackTrace(); - // } - } - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/Test.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/Test.java deleted file mode 100644 index e2652a5ab65cd6642299e59ec742257bfcc2e703..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/Test.java +++ /dev/null @@ -1,31 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; - -import de.fu_berlin.inf.dpp.test.util.ResourceHelper; -import junit.framework.TestCase; - -public class Test extends TestCase { - - private static Logger logger = Logger.getLogger(Test.class.toString()); - - public void testWorkspace() throws CoreException{ - logger.log(Level.ALL, "init"); -// logger.debug("hello"); - IProject project = ResourceHelper.createDefaultProject(); -// IFile file = ResourceHelper.createFile(project, "testfile.txt", "dies ist ein Testfile"); - logger.log(Level.ALL, "logtest"); - - assertTrue(project.exists()); -// file.delete(true, new NullProgressMonitor()); -// assertFalse(file.exists()); - } - - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/UserListExtensionTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/UserListExtensionTest.java deleted file mode 100644 index d75618ef558def38f9908d4ea3f3163a0f32112a..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/UserListExtensionTest.java +++ /dev/null @@ -1,130 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net; - -import java.util.List; -import java.util.Vector; - -import org.jivesoftware.smack.Chat; -import org.jivesoftware.smack.ChatManager; -import org.jivesoftware.smack.MessageListener; -import org.jivesoftware.smack.PacketListener; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.filter.MessageTypeFilter; -import org.jivesoftware.smack.packet.DefaultPacketExtension; -import org.jivesoftware.smack.packet.Message; -import org.jivesoftware.smack.packet.Packet; -import org.jivesoftware.smack.provider.ProviderManager; - -import de.fu_berlin.inf.dpp.User; -import de.fu_berlin.inf.dpp.User.UserRole; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.net.internal.PacketExtensions; -import de.fu_berlin.inf.dpp.net.internal.RequestExtensionProvider; -import de.fu_berlin.inf.dpp.net.internal.RequestPacketExtension; - -import junit.framework.TestCase; -/** - * this class contains test cases for testing the user list jabber extensions. - * @author orieger - * - */ -public class UserListExtensionTest extends TestCase implements PacketListener, MessageListener{ - - static { - XMPPConnection.DEBUG_ENABLED = true; - } - private XMPPConnection connection1; - private XMPPConnection connection2; - List<User> userList; - - public UserListExtensionTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - super.setUp(); - connection1 = new XMPPConnection("jabber.cc"); - connection1.connect(); - connection1.login("ori78", "123456"); - - connection2 = new XMPPConnection("jabber.cc"); - connection2.connect(); - connection2.login("ori79", "123456"); - connection2.addPacketListener(this, new MessageTypeFilter( - Message.Type.chat)); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testUserListExtensionTransfer() throws Exception{ - userList = new Vector<User>(); - User u = new User(new JID("ori1@jabber.de")); - u.setColorID(1); - u.setUserRole(UserRole.DRIVER); - userList.add(u); - User u1 = new User(new JID("ori2@jabber.de")); - u1.setColorID(1); - u1.setUserRole(UserRole.OBSERVER); - userList.add(u1); - - ChatManager chatmanager = connection1.getChatManager(); - Chat newChat = chatmanager.createChat(connection2.getUser(),this); - - try { - Message message = new Message(); -// Request req = new RequestImpl(1,new JupiterVectorTime(1,3),new DeleteOperation(34,"insert text")); -// req.setEditorPath(new Path("hello")); -// req.setJID(new JID("ori78@jabber.cc")); - message.addExtension(PacketExtensions.createUserListExtension(userList)); - newChat.sendMessage(message); - } - catch (XMPPException e) { - System.out.println("Error Delivering block"); - } - Thread.sleep(500); - } - - public void processPacket(Packet packet) { - Message message = (Message) packet; - processMessage(null, message); - } - - public void processMessage(Chat chat, Message message) { - List<User> incomingUser = new Vector<User>(); - DefaultPacketExtension userlistExtension = PacketExtensions - .getUserlistExtension(message); - - int count = 0; - while (true) { - String jidS = userlistExtension.getValue("User" - + count); - if (jidS == null) - break; -// log.debug(" *:" + jidS); - - JID jid = new JID(jidS); - User user = new User(jid); - - String userRole = userlistExtension.getValue("UserRole"+count); - user.setUserRole(de.fu_berlin.inf.dpp.User.UserRole.valueOf(userRole)); - - String color = userlistExtension.getValue("UserColor"+count); - try{ - user.setColorID(Integer.parseInt(color)); - }catch(NumberFormatException nfe){ -// log.warn("Exception during convert user color form userlist for user : "+user.getJid()); - System.out.println("NumberFormatException."); - } - count++; - - incomingUser.add(user); - - } - - assertEquals(userList, incomingUser); - - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/XMPPTransmitterTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/XMPPTransmitterTest.java deleted file mode 100644 index 9b58df6db5c4b5b8ee84030ccaa4c2182c0c1bc7..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/XMPPTransmitterTest.java +++ /dev/null @@ -1,359 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net; - -import java.io.File; -import java.io.InputStream; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smackx.filetransfer.FileTransferListener; -import org.jivesoftware.smackx.filetransfer.FileTransferManager; -import org.jivesoftware.smackx.filetransfer.FileTransferRequest; -import org.jivesoftware.smackx.filetransfer.IncomingFileTransfer; -import org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer; -import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; - -import de.fu_berlin.inf.dpp.FileList; -import de.fu_berlin.inf.dpp.User; -import de.fu_berlin.inf.dpp.activities.IActivity; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.invitation.IInvitationProcess; -import de.fu_berlin.inf.dpp.invitation.IInvitationProcess.TransferMode; -import de.fu_berlin.inf.dpp.net.IFileTransferCallback; -import de.fu_berlin.inf.dpp.net.ITransmitter; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.net.TimedActivity; -import de.fu_berlin.inf.dpp.net.internal.XMPPChatTransmitter; -import de.fu_berlin.inf.dpp.project.ISharedProject; -import de.fu_berlin.inf.dpp.test.net.mock.MockInvitationProcess; -import de.fu_berlin.inf.dpp.test.util.FileListHelper; -import de.fu_berlin.inf.dpp.test.util.ResourceHelper; -import junit.framework.TestCase; - -public class XMPPTransmitterTest extends TestCase implements - FileTransferListener, ITransmitter, IFileTransferCallback { - - static { - XMPPConnection.DEBUG_ENABLED = true; - } - - private static Logger logger = Logger.getLogger(XMPPTransmitterTest.class.toString()); - - private XMPPConnection connection1; - private FileTransferManager transferManager1; - - private XMPPConnection connection2; - private FileTransferManager transferManager2; - - private MockInvitationProcess mock; - - public void setUp() throws Exception { -// PropertyConfigurator.configureAndWatch("log4j.properties", 60 * 1000); -// Logger logger = Logger.getLogger("de.fu_berlin.inf.dpp"); - - connection1 = new XMPPConnection("jabber.cc"); - // while (!connection1.isAuthenticated()) { - // System.out.println("connecting user1"); - connection1.connect(); - connection1.login("ori79", "123456"); - // } - transferManager1 = new FileTransferManager(connection1); - logger.info("connection 1 established."); - Thread.sleep(1000); - - connection2 = new XMPPConnection("jabber.cc"); - // while (!connection2.isAuthenticated()) { - - connection2.connect(); - connection2.login("ori78", "123456"); - // } - logger.info("connection 1 established."); - transferManager2 = new FileTransferManager(connection2); - - Thread.sleep(1000); - -// mock = new MockInvitationProcess(this, null, null); - } - - public void tearDown() { - connection1.disconnect(); - connection2.disconnect(); - } - - public void testSendFileList() throws CoreException, XMPPException{ -// transferManager2.addFileTransferListener(new ReceivedSingleFileListener()); - transferManager2.addFileTransferListener(new ReceiveFileListFileTransferListener()); - - ITransmitter transfer = new XMPPChatTransmitter(connection1); - FileList list = FileListHelper.createFileListForDefaultProject(); - transfer.sendFileList(new JID(connection2.getUser()), list); - - } - - - public void xtestTransferFileFunction() throws CoreException, XMPPException{ - transferManager2.addFileTransferListener(new ReceivedSingleFileListener()); - - ITransmitter transfer = new XMPPChatTransmitter(connection1); - //TODO: project initialisieren -// transfer.sendFile(new JID(connection2.getUser()), ResourceHelper.getDefaultProject(), ResourceHelper.getDefaultFile().getProjectRelativePath(), null); - transfer.sendFile(new JID(connection2.getUser()), ResourceHelper.getDefaultProject(), ResourceHelper.getFile("src/First.java").getProjectRelativePath(), null); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public void xtestReceivedFileList() throws CoreException, XMPPException{ -// transferManager2.addFileTransferListener(new ReceiveFileListFileTransferListener()); - - ITransmitter transfer = new XMPPChatTransmitter(connection1); - - FileList list = FileListHelper.createFileListForDefaultProject(); - transfer.sendFileList(new JID(connection2.getUser()), list); - } - - /* - * 1. Invitation mock process einfügen 2. File Transfer simulieren. - */ -// public void testReceivedRessource() { -// sendFileWithFileTransfer(); -// } - - - - /* file transfer methods */ - - public void fileTransferRequest(FileTransferRequest request) { - - IncomingFileTransfer transfer = request.accept(); - String filename = request.getFileName()+"."+request.getRequestor().substring(0, request.getRequestor().indexOf("@")); - logger.log(Level.FINE,filename); - - try { - InputStream input = transfer.recieveFile(); - - } catch (XMPPException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - -// // TODO Auto-generated method stub -// // Check to see if the request should be accepted -// // if(shouldAccept(request)) { -// // Accept it -// -// -// -// logger.info("Incomming file "+request.getRequestor()); -// IncomingFileTransfer transfer = request.accept(); -// String filename = request.getFileName()+"."+request.getRequestor().substring(0, request.getRequestor().indexOf("@")); -// try { -// -//// transfer.recieveFile(new File(filename)); -// InputStream input = transfer.recieveFile(); -// mock.resourceReceived(null, new Path(transfer.getFileName()+".received"), input); -// } catch (XMPPException e) { -// // TODO Auto-generated catch block -// logger.log(Level.ALL,e.getMessage()); -// } -// -//// if (new File(filename).exists()) { -////// new File("Testfile2.txt").deleteOnExit(); -//// logger.debug("File exists and will delete."); -//// } - } - -// /* helper methods. */ -// protected void sendFileWithFileTransfer() { -// transferManager2 -// .addFileTransferListener(this); -// -// // Create the outgoing file transfer -// OutgoingFileTransfer transfer = transferManager1 -// .createOutgoingFileTransfer(connection2.getUser()); -// -// // Send the file -// try { -// transfer.sendFile(new File("Testfile.txt"), -// "You won't believe this!"); -// -// while (!transfer.isDone()) { -// if (transfer.getStatus().equals(Status.error)) { -// logger.log(Level.WARNING,"ERROR!!! " + transfer.getError()); -// } else { -// logger.log(Level.FINE,"Status : " + transfer.getStatus()); -// logger.log(Level.FINE,"Progress : " + transfer.getProgress()); -// } -// try { -// Thread.sleep(1000); -// } catch (InterruptedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } -// -// if (transfer.getStatus().equals(Status.complete)) { -// logger.log(Level.FINE,"transfer complete"); -// } -// } catch (XMPPException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } - - - - - public void addInvitationProcess(IInvitationProcess invitation) { - // TODO Auto-generated method stub - - } - - - public void removeInvitationProcess(IInvitationProcess invitation) { - // TODO Auto-generated method stub - - } - - - public void sendActivities(ISharedProject sharedProject, - List<TimedActivity> activities) { - // TODO Auto-generated method stub - - } - - public void sendCancelInvitationMessage(JID jid, String errorMsg) { - // TODO Auto-generated method stub - - } - - - public void sendFile(JID recipient, IProject project, - IPath path, IFileTransferCallback callback) { - // TODO Auto-generated method stub - - } - - - public void sendFile(JID recipient, IProject project, IPath path, - int timestamp, IFileTransferCallback callback) { - // TODO Auto-generated method stub - - } - - - public void sendFileList(JID jid, FileList fileList) throws XMPPException { - // TODO Auto-generated method stub - - } - - - public void sendInviteMessage(ISharedProject sharedProject, JID jid, - String description) { - // TODO Auto-generated method stub - - } - - - public void sendJoinMessage(ISharedProject sharedProject) { - // TODO Auto-generated method stub - - } - - - public void sendLeaveMessage(ISharedProject sharedProject) { - // TODO Auto-generated method stub - - } - - public void sendRemainingFiles() { - // TODO Auto-generated method stub - - } - - - public void sendRemainingMessages() { - // TODO Auto-generated method stub - - } - - - public void sendRequestForActivity(ISharedProject sharedProject, - int timestamp, boolean andup) { - // TODO Auto-generated method stub - - } - - - public void sendRequestForFileListMessage(JID recipient) { - // TODO Auto-generated method stub - - } - - - public void sendUserListTo(JID to, List<User> participants) { - // TODO Auto-generated method stub - - } - - - public void setXMPPConnection(XMPPConnection connection) { - // TODO Auto-generated method stub - - } - - - public void fileSent(IPath path) { - logger.log(Level.FINE,"File sent "+path); - - } - - - public void fileTransferFailed(IPath path, Exception e) { - logger.log(Level.WARNING,"File transfer failed: "+e.getMessage()); - - } - - public void sendProjectArchive(JID recipient, IProject project, - File archive, IFileTransferCallback callback) { - // TODO Auto-generated method stub - - } - - public void transferProgress(int transfered) { - // TODO Auto-generated method stub - - } - - public void jingleFallback() { - // TODO Auto-generated method stub - - } - - public void setTransferMode(TransferMode mode) { - // TODO Auto-generated method stub - - } - - public void sendActivitiyTo(ISharedProject sharedProject, - IActivity activity, JID jid) { - // TODO Auto-generated method stub - - } - - public void sendJupiterRequest(ISharedProject sharedProject, - Request request, JID jid) { - // TODO Auto-generated method stub - - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/jingle/TestJingleFileTransfer.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/jingle/TestJingleFileTransfer.java deleted file mode 100644 index 012727b42e1f024e63b993dc66691f21e254fff2..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/jingle/TestJingleFileTransfer.java +++ /dev/null @@ -1,8 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net.jingle; - -import junit.framework.TestCase; - -public class TestJingleFileTransfer extends TestCase{ - - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/learning/FileTransferProcessMonitor.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/learning/FileTransferProcessMonitor.java deleted file mode 100644 index 27b8becb1140c2546c2d3aa72180b070c73517ef..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/learning/FileTransferProcessMonitor.java +++ /dev/null @@ -1,60 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net.learning; - -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smackx.filetransfer.FileTransfer; - -/** - * for information on monitoring the process of a file tranfer - * - * @author troll - * - */ -public class FileTransferProcessMonitor extends Thread { - - FileTransfer transfer; - - private boolean running = true; - - private boolean closeMonitor = false; - - public FileTransferProcessMonitor(FileTransfer transfer) { - this.transfer = transfer; - } - - public boolean isRunning() throws XMPPException { - return this.running; - } - - public String getException() { - return null; - } - - public void closeMonitor(boolean close) { - this.closeMonitor = close; - } - - public void run() { - int time = 0; - - while (!closeMonitor ) { - try { - while (!transfer.isDone() && (transfer.getProgress()<1.0)) { - - /* check negotiator process */ - System.out.println("Status: " + transfer.getStatus() - + " Progress : " + transfer.getProgress()); - - - Thread.sleep(500); - } - this.running = false; - - Thread.sleep(500); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/learning/TestXMPPFileTranserReceiver.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/learning/TestXMPPFileTranserReceiver.java deleted file mode 100644 index 3b784d59ce2ba542ce7904d850812a00675c10ac..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/learning/TestXMPPFileTranserReceiver.java +++ /dev/null @@ -1,129 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net.learning; - -import java.io.File; -import java.util.logging.Logger; - -import junit.framework.TestCase; - -import org.jivesoftware.smack.RosterEntry; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.packet.Presence; -import org.jivesoftware.smackx.filetransfer.FileTransferListener; -import org.jivesoftware.smackx.filetransfer.FileTransferManager; -import org.jivesoftware.smackx.filetransfer.FileTransferRequest; -import org.jivesoftware.smackx.filetransfer.IBBTransferNegotiator; -import org.jivesoftware.smackx.filetransfer.IncomingFileTransfer; -import org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer; -import org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiatorManager; - -/** - * this test class received xmpp file transfer data. - * - * @author troll - * - */ -public class TestXMPPFileTranserReceiver extends TestCase implements - FileTransferListener { - - static { - XMPPConnection.DEBUG_ENABLED = true; - } - - private static Logger logger = Logger - .getLogger(TestXMPPFileTransferSender.class.toString()); - - private XMPPConnection connection; - private FileTransferManager transferManager; - - private final String SERVER = "jabber.org"; - - private final String SENDER_JID = "ori78@"+SERVER; - - private final int MAX_TRANSFER_RETRIES = 10000; - - private boolean incommingFile = false; - - public void setUp() throws Exception { - // PropertyConfigurator.configureAndWatch("log4j.properties", 60 * - // 1000); - // Logger logger = Logger.getLogger("de.fu_berlin.inf.dpp"); - - connection = new XMPPConnection(SERVER); - // while (!connection2.isAuthenticated()) { - - connection.connect(); - connection.login("ori79", "123456"); - // } - logger.info("connection 1 established."); - transferManager = new FileTransferManager(connection); -// transferManager.getProperties().setProperty(Socks5TransferNegotiatorManager.PROPERTIES_PORT,"7777"); -// transferManager.getProperties().setProperty(IBBTransferNegotiator.PROPERTIES_BLOCK_SIZE, "40690"); - Thread.sleep(1000); - } - - public void tearDown() { - connection.disconnect(); - - } - - public void testReceivingFile() throws InterruptedException{ - transferManager.addFileTransferListener(this); - - logger.info("wait for receiver online state."); - RosterEntry entry = connection.getRoster().getEntry(SENDER_JID); - assertNotNull(entry); - - Presence p = connection.getRoster().getPresence(entry.getUser()); - assertNotNull(p); - - while(!incommingFile){ - System.out.print("."); - Thread.sleep(200); - } - - logger.info("finished"); - - } - - public void fileTransferRequest(FileTransferRequest request) { - logger.info("INCOMMING FILE"); - - IncomingFileTransfer transfer = request.accept(); - - /*file path*/ - String filename = "/home/troll/smack_test.jar"; - File infile = new File(filename); - - - try { - logger.info("start receiving file"); - - FileTransferProcessMonitor monitor = new FileTransferProcessMonitor(transfer); - /*receive file*/ - transfer.recieveFile(infile); - monitor.start(); - - System.out.println("wait for incomming datas ..."); - while(monitor.isAlive() && monitor.isRunning()){ - Thread.sleep(500); - System.out.print("."); - } - - monitor.closeMonitor(true); - - - } catch (XMPPException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - logger.info("receiving finished."); - incommingFile = true; - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/learning/TestXMPPFileTransferSender.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/learning/TestXMPPFileTransferSender.java deleted file mode 100644 index b8f6a559d7b72809cb811097c571f9f36a5bfe88..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/learning/TestXMPPFileTransferSender.java +++ /dev/null @@ -1,163 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net.learning; - -import java.io.File; -import java.util.logging.Logger; - -import junit.framework.TestCase; - -import org.jivesoftware.smack.PacketListener; -import org.jivesoftware.smack.RosterEntry; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.packet.Packet; -import org.jivesoftware.smack.packet.Presence; -import org.jivesoftware.smack.util.StringUtils; -import org.jivesoftware.smackx.filetransfer.FileTransferListener; -import org.jivesoftware.smackx.filetransfer.FileTransferManager; -import org.jivesoftware.smackx.filetransfer.FileTransferRequest; -import org.jivesoftware.smackx.filetransfer.IBBTransferNegotiator; -import org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer; -import org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiatorManager; - -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.net.XMPPTransmitterTest; -import de.fu_berlin.inf.dpp.test.net.mock.MockInvitationProcess; - -public class TestXMPPFileTransferSender extends TestCase implements PacketListener { - - static { - XMPPConnection.DEBUG_ENABLED = true; - } - - private static Logger logger = Logger.getLogger(TestXMPPFileTransferSender.class.toString()); - - private XMPPConnection connection; - private FileTransferManager transferManager; - - private final String SERVER = "jabber.org"; - - private final String RESOURCE = "/Smack"; - - private final String RECEIVER_JID = "ori79@"+SERVER; - - - private static final int MAX_TRANSFER_RETRIES = 10000; - - private boolean send = false; - - public void setUp() throws Exception { -// PropertyConfigurator.configureAndWatch("log4j.properties", 60 * 1000); -// Logger logger = Logger.getLogger("de.fu_berlin.inf.dpp"); - - connection = new XMPPConnection(SERVER); - // while (!connection1.isAuthenticated()) { - // System.out.println("connecting user1"); - connection.connect(); - connection.login("ori78", "123456"); - // } - transferManager = new FileTransferManager(connection); - logger.info("connection 1 established."); - Thread.sleep(1000); - -// transferManager.getProperties().setProperty(Socks5TransferNegotiatorManager.PROPERTIES_PORT,"50010");transferManager.getProperties().setProperty(IBBTransferNegotiator.PROPERTIES_BLOCK_SIZE, "40690"); -// transferManager.getProperties().setProperty(IBBTransferNegotiator.PROPERTIES_BLOCK_SIZE, "40960"); -// mock = new MockInvitationProcess(this, null, null); - } - - public void tearDown(){ - connection.disconnect(); - } - - /** - * this method check the file transfer between two separate - * computers. - * @throws InterruptedException - * @throws XMPPException - */ - public void testSendLargeFile() throws InterruptedException, XMPPException{ - - connection.addPacketListener(this, null); - - RosterEntry entry = connection.getRoster().getEntry(RECEIVER_JID); - assertNotNull(entry); - - Presence p = connection.getRoster().getPresence(entry.getUser()); - assertNotNull(p); - - /*wait for receiver online status*/ - logger.info("wait for receiver online state."); - while(!send){ - if(p.getMode() == Presence.Mode.available){ - send = true; - } - System.out.print("."); - Thread.sleep(200); - } - - logger.info("try to send file"); - sendFile(); - - logger.info("file sended. "); - } - - private void sendFile() throws XMPPException, InterruptedException{ - - Thread.sleep(1000); - - String filename = "lib/smack.jar"; - File file = new File(filename); - - assertTrue(file.exists()); - - /*create output stream */ - OutgoingFileTransfer.setResponseTimeout(MAX_TRANSFER_RETRIES); - OutgoingFileTransfer transfer = transferManager.createOutgoingFileTransfer(RECEIVER_JID+RESOURCE); - - FileTransferProcessMonitor monitor = new FileTransferProcessMonitor(transfer); - /* send file. */ - transfer.sendFile(file, "Smack lib"); - monitor.start(); - - logger.info("SEND FILE ..."); - /* wait for transfer file finished.*/ - System.out.println("wait ..."); - while(monitor.isAlive() && monitor.isRunning()){ - Thread.sleep(500); - System.out.print("."); - } - - monitor.closeMonitor(true); - - logger.info("TRANSFER COMPLETED."); - } - - public void processPacket(Packet packet) { - if (!packet.getFrom().equals(connection.getUser())) { - - /* - * 1. überprüfen ob es eine subscribe anfrage ist 2. überprüfen, ob - * user im in liste ist. 3. hinzufügen des accounts. - */ - if (packet instanceof Presence) { - - Presence p = (Presence) packet; - - /* this states handled by roster listener. */ - if (p.getType().equals(Presence.Type.available)) { - - if(StringUtils.parseBareAddress(p.getFrom()).equals(RECEIVER_JID)){ - logger.info("Presence RECEIVER_JID " + p.getFrom() + " " + p.getType()); - send = true; - return; - } - - logger.info("Presence " + p.getFrom() + " " + p.getType()); - - return; - } - } - } - } - - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/mock/MockInvitationProcess.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/mock/MockInvitationProcess.java deleted file mode 100644 index 18396837155caff52d3165a744b246086c60e612..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/mock/MockInvitationProcess.java +++ /dev/null @@ -1,173 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net.mock; - -import java.io.File; -import java.io.InputStream; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; - -import de.fu_berlin.inf.dpp.FileList; -import de.fu_berlin.inf.dpp.invitation.IInvitationProcess; -import de.fu_berlin.inf.dpp.invitation.IInvitationProcess.IInvitationUI; -import de.fu_berlin.inf.dpp.invitation.IInvitationProcess.State; -import de.fu_berlin.inf.dpp.net.ITransmitter; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.test.util.ResourceHelper; - -public class MockInvitationProcess implements IInvitationProcess{ - - private static Logger logger = Logger.getLogger(MockInvitationProcess.class.toString()); - - protected final ITransmitter transmitter; - - protected State state; - - private Exception exception; - - protected JID peer; - - protected IInvitationUI invitationUI=null; - - protected String description; - - public MockInvitationProcess(ITransmitter transmitter, JID peer, String description) { - this.transmitter = transmitter; - this.peer = peer; - this.description = description; - - transmitter.addInvitationProcess(this); - } - - - public void cancel(String errorMsg, boolean replicated) { - // TODO Auto-generated method stub - - } - - - public void fileListReceived(JID from, FileList fileList) { - // TODO Auto-generated method stub - - } - - - public String getDescription() { - // TODO Auto-generated method stub - return null; - } - - - public Exception getException() { - // TODO Auto-generated method stub - return null; - } - - - public JID getPeer() { - // TODO Auto-generated method stub - return null; - } - - - public String getProjectName() { - // TODO Auto-generated method stub - return null; - } - - - public State getState() { - // TODO Auto-generated method stub - return null; - } - - public void invitationAccepted(JID from) { - // TODO Auto-generated method stub - - } - - - public void joinReceived(JID from) { - // TODO Auto-generated method stub - - } - - - public void resourceReceived(JID from, IPath path, InputStream input) { - logger.log(Level.FINE,"received method"); - try { - IProject localProject = null; - // Then check with all the projects -// File f = new File("/home/troll/testfile.txt"); - - localProject = ResourceHelper.createDefaultProject(); -// IWorkspace workspace = ResourcesPlugin.getWorkspace(); -// IProject[] projects = workspace.getRoot().getProjects(); -// localProject = workspace.getRoot().getProject("testProject"); -// for(IProject p : projects){ -// if(p.getName().equals("Saros Test")){ -// localProject = p; -// } -// } - if(localProject == null){ - logger.log(Level.WARNING,"no project founded."); - return; - } - - IFile file = localProject.getFile(path); - if (file.exists()) { -// file.setReadOnly(false); - logger.info("file exist"); - file.setContents(input, IResource.FORCE, new NullProgressMonitor()); - } else { - logger.info("file will be created"); - file.create(input, true, new NullProgressMonitor()); - } - } catch (Exception e) { - logger.log(Level.WARNING,e.getMessage()); - } - - } - - - public TransferMode getTransferMode() { - // TODO Auto-generated method stub - return null; - } - - public void jingleFallback() { - // TODO Auto-generated method stub - - } - - - public void fileSent(IPath path) { - // TODO Auto-generated method stub - - } - - - public void fileTransferFailed(IPath path, Exception e) { - // TODO Auto-generated method stub - - } - - - public void transferProgress(int transfered) { - // TODO Auto-generated method stub - - } - - - public void setTransferMode(TransferMode mode) { - // TODO Auto-generated method stub - - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/mock/StubXMPPTransmitter.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/mock/StubXMPPTransmitter.java deleted file mode 100644 index 5656c54ad3403301c7cb379e3528346d39f5a359..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/net/mock/StubXMPPTransmitter.java +++ /dev/null @@ -1,151 +0,0 @@ -package de.fu_berlin.inf.dpp.test.net.mock; - -import java.io.File; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smackx.filetransfer.FileTransferListener; -import org.jivesoftware.smackx.filetransfer.FileTransferRequest; - -import de.fu_berlin.inf.dpp.FileList; -import de.fu_berlin.inf.dpp.User; -import de.fu_berlin.inf.dpp.activities.IActivity; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.invitation.IInvitationProcess; -import de.fu_berlin.inf.dpp.net.IFileTransferCallback; -import de.fu_berlin.inf.dpp.net.ITransmitter; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.net.TimedActivity; -import de.fu_berlin.inf.dpp.project.ISharedProject; - -public class StubXMPPTransmitter implements ITransmitter, FileTransferListener{ - - - public void addInvitationProcess(IInvitationProcess invitation) { - // TODO Auto-generated method stub - - } - - - public void removeInvitationProcess(IInvitationProcess invitation) { - // TODO Auto-generated method stub - - } - - - public void sendActivities(ISharedProject sharedProject, - List<TimedActivity> activities) { - // TODO Auto-generated method stub - - } - - - public void sendCancelInvitationMessage(JID jid, String errorMsg) { - // TODO Auto-generated method stub - - } - - - public void sendFile(JID recipient, IProject project, - IPath path, IFileTransferCallback callback) { - // TODO Auto-generated method stub - - } - - - public void sendFile(JID recipient, IProject project, IPath path, - int timestamp, IFileTransferCallback callback) { - // TODO Auto-generated method stub - - } - - - public void sendFileList(JID jid, FileList fileList) throws XMPPException { - // TODO Auto-generated method stub - - } - - - public void sendInviteMessage(ISharedProject sharedProject, JID jid, - String description) { - // TODO Auto-generated method stub - - } - - - public void sendJoinMessage(ISharedProject sharedProject) { - // TODO Auto-generated method stub - - } - - - public void sendLeaveMessage(ISharedProject sharedProject) { - // TODO Auto-generated method stub - - } - - - public void sendRemainingFiles() { - // TODO Auto-generated method stub - - } - - public void sendRemainingMessages() { - // TODO Auto-generated method stub - - } - - public void sendRequestForActivity(ISharedProject sharedProject, - int timestamp, boolean andup) { - // TODO Auto-generated method stub - - } - - public void sendRequestForFileListMessage(JID recipient) { - // TODO Auto-generated method stub - - } - - - public void sendUserListTo(JID to, List<User> participants) { - // TODO Auto-generated method stub - - } - - - public void setXMPPConnection(XMPPConnection connection) { - // TODO Auto-generated method stub - - } - - - public void fileTransferRequest(FileTransferRequest request) { - // TODO Auto-generated method stub - - } - - - public void sendProjectArchive(JID recipient, IProject project, - File archive, IFileTransferCallback callback) { - // TODO Auto-generated method stub - - } - - - public void sendActivitiyTo(ISharedProject sharedProject, - IActivity activity, JID jid) { - // TODO Auto-generated method stub - - } - - - public void sendJupiterRequest(ISharedProject sharedProject, - Request request, JID jid) { - // TODO Auto-generated method stub - - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/project/svn/SVNProjectTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/project/svn/SVNProjectTest.java deleted file mode 100644 index c3787ed2a7b79c65cfcdda0bddc1776849cfed81..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/project/svn/SVNProjectTest.java +++ /dev/null @@ -1,7 +0,0 @@ -package de.fu_berlin.inf.dpp.test.project.svn; - -public class SVNProjectTest extends junit.framework.TestCase{ - - - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/EditorAPIStub.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/EditorAPIStub.java deleted file mode 100644 index 586d2886bcca1054336da3ec6a48c27cdc51a1f8..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/EditorAPIStub.java +++ /dev/null @@ -1,96 +0,0 @@ -package de.fu_berlin.inf.dpp.test.stubs; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.text.TextSelection; -import org.eclipse.jface.text.source.ILineRange; -import org.eclipse.jface.text.source.LineRange; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.texteditor.IDocumentProvider; -import org.eclipse.ui.texteditor.StatusTextEditor; - -import de.fu_berlin.inf.dpp.editor.EditorManager; -import de.fu_berlin.inf.dpp.editor.internal.IEditorAPI; - -public class EditorAPIStub implements IEditorAPI { - private IEditorPart activeEditor; - private Set<IEditorPart> openEditors = new HashSet<IEditorPart>(); - private Map<IEditorPart, ITextSelection> selections = new HashMap<IEditorPart, ITextSelection>(); - private Map<IEditorPart, ILineRange> viewports = new HashMap<IEditorPart, ILineRange>(); - - public void addSharedEditorListener(IEditorPart editorPart) { - } - - public void closeEditor(IEditorPart part) { - openEditors.remove(part); - } - - public IEditorPart getActiveEditor() { - return activeEditor; - } - - public IDocument getDocument(IEditorPart editorPart) { - return null; - } - - public IDocumentProvider getDocumentProvider(IEditorInput editorInput) { - return null; - } - - public IResource getEditorResource(IEditorPart editorPart) { - return new FileStub("/foo/test", "test content"); - } - - public Set<IEditorPart> getOpenEditors() { - return openEditors; - } - - public IEditorPart openEditor(IFile file) { - //activeEditor = // TODO; - //TODO: Fehler überprüfen. - StatusTextEditor statusTextEditor = new StatusTextEditor(); -// FileEditorInput input = new FileEditorInput(file); -// statusTextEditor.setInput(input); -// openEditors.add(statusTextEditor); // HACK - - return activeEditor; - } - - public void setSelection(IEditorPart editorPart, ITextSelection selection) { - selections.put(editorPart, selection); - } - - public ITextSelection getSelection(IEditorPart editorPart) { - ITextSelection selection = selections.get(editorPart); - return selection != null ? selection : TextSelection.emptySelection(); - } - - public void setViewport(IEditorPart editorPart, boolean jumpTo, int top, int bottom, String text) { - viewports.put(editorPart, new LineRange(top, bottom - top)); - } - - public ILineRange getViewport(IEditorPart editorPart) { - ILineRange range = viewports.get(editorPart); - return range != null ? range : new LineRange(1, 0); - } - - public void setEditable(IEditorPart editorPart, boolean editable) { - } - - public void setEditorManager(EditorManager editorManager) { - } - - public void setSelection(IEditorPart editorPart, ITextSelection selection, - String source) { - // TODO Auto-generated method stub - - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/EditorPartStub.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/EditorPartStub.java deleted file mode 100644 index 075ba689b50459ac82e0364e5bcfff38a2fb0635..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/EditorPartStub.java +++ /dev/null @@ -1,105 +0,0 @@ -package de.fu_berlin.inf.dpp.test.stubs; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IPropertyListener; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.PartInitException; - -public class EditorPartStub implements IEditorPart { - - public IEditorInput getEditorInput() { - // TODO Auto-generated method stub - return null; - } - - public IEditorSite getEditorSite() { - // TODO Auto-generated method stub - return null; - } - - public void init(IEditorSite site, IEditorInput input) throws PartInitException { - // TODO Auto-generated method stub - - } - - public void addPropertyListener(IPropertyListener listener) { - // TODO Auto-generated method stub - - } - - public void createPartControl(Composite parent) { - // TODO Auto-generated method stub - - } - - public void dispose() { - // TODO Auto-generated method stub - - } - - public IWorkbenchPartSite getSite() { - // TODO Auto-generated method stub - return null; - } - - public String getTitle() { - // TODO Auto-generated method stub - return null; - } - - public Image getTitleImage() { - // TODO Auto-generated method stub - return null; - } - - public String getTitleToolTip() { - // TODO Auto-generated method stub - return null; - } - - public void removePropertyListener(IPropertyListener listener) { - // TODO Auto-generated method stub - - } - - public void setFocus() { - // TODO Auto-generated method stub - - } - - public Object getAdapter(Class adapter) { - // TODO Auto-generated method stub - return null; - } - - public void doSave(IProgressMonitor monitor) { - // TODO Auto-generated method stub - - } - - public void doSaveAs() { - // TODO Auto-generated method stub - - } - - public boolean isDirty() { - // TODO Auto-generated method stub - return false; - } - - public boolean isSaveAsAllowed() { - // TODO Auto-generated method stub - return false; - } - - public boolean isSaveOnCloseNeeded() { - // TODO Auto-generated method stub - return false; - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/FileStub.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/FileStub.java deleted file mode 100644 index 5bc14c36458cf2736f06852ca3d9adc64a61588b..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/FileStub.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * DPP - Serious Distributed Pair Programming - * (c) Freie Universit�t Berlin - Fachbereich Mathematik und Informatik - 2006 - * (c) Riad Djemili - 2006 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package de.fu_berlin.inf.dpp.test.stubs; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.net.URI; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFileState; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResourceProxy; -import org.eclipse.core.resources.IResourceProxyVisitor; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourceAttributes; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.content.IContentDescription; -import org.eclipse.core.runtime.jobs.ISchedulingRule; - -public class FileStub implements IFile { - private IPath path; - private String content; - - public FileStub(String path, String content) { - this.path = new Path(path); - this.content = content; - } - - public IPath getProjectRelativePath() { - return path; - } - - public InputStream getContents() throws CoreException { - return new ByteArrayInputStream(content.getBytes()); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - - if (!(obj instanceof IFile)) - return false; - - IFile other = (IFile)obj; - return path.equals(other.getProjectRelativePath()); - } - - - public void appendContents(InputStream source, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {} - public void appendContents(InputStream source, int updateFlags, IProgressMonitor monitor) throws CoreException {} - public void create(InputStream source, boolean force, IProgressMonitor monitor) throws CoreException {} - public void create(InputStream source, int updateFlags, IProgressMonitor monitor) throws CoreException {} - public void createLink(IPath localLocation, int updateFlags, IProgressMonitor monitor) throws CoreException {} - public void createLink(URI location, int updateFlags, IProgressMonitor monitor) throws CoreException {} - public void delete(boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {} - public String getCharset() throws CoreException {return null;} - public String getCharset(boolean checkImplicit) throws CoreException {return null;} - public String getCharsetFor(Reader reader) throws CoreException {return null;} - public IContentDescription getContentDescription() throws CoreException {return null;} - public InputStream getContents(boolean force) throws CoreException {return null;} - public int getEncoding() throws CoreException {return 0;} - public IPath getFullPath() {return null;} - public IFileState[] getHistory(IProgressMonitor monitor) throws CoreException {return null;} - public String getName() {return null;} - public boolean isReadOnly() {return false;} - public void move(IPath destination, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {} - public void setCharset(String newCharset) throws CoreException {} - public void setCharset(String newCharset, IProgressMonitor monitor) throws CoreException {} - public void setContents(InputStream source, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {} - public void setContents(IFileState source, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {} - public void setContents(InputStream source, int updateFlags, IProgressMonitor monitor) throws CoreException {} - public void setContents(IFileState source, int updateFlags, IProgressMonitor monitor) throws CoreException {} - public void accept(IResourceProxyVisitor visitor, int memberFlags) throws CoreException {} - public void accept(IResourceVisitor visitor) throws CoreException {} - public void accept(IResourceVisitor visitor, int depth, boolean includePhantoms) throws CoreException {} - public void accept(IResourceVisitor visitor, int depth, int memberFlags) throws CoreException {} - public void clearHistory(IProgressMonitor monitor) throws CoreException {} - public void copy(IPath destination, boolean force, IProgressMonitor monitor) throws CoreException {} - public void copy(IPath destination, int updateFlags, IProgressMonitor monitor) throws CoreException {} - public void copy(IProjectDescription description, boolean force, IProgressMonitor monitor) throws CoreException {} - public void copy(IProjectDescription description, int updateFlags, IProgressMonitor monitor) throws CoreException {} - public IMarker createMarker(String type) throws CoreException {return null;} - public IResourceProxy createProxy() {return null;} - public void delete(boolean force, IProgressMonitor monitor) throws CoreException {} - public void delete(int updateFlags, IProgressMonitor monitor) throws CoreException {} - public void deleteMarkers(String type, boolean includeSubtypes, int depth) throws CoreException {} - public boolean exists() {return false;} - public IMarker findMarker(long id) throws CoreException {return null;} - public IMarker[] findMarkers(String type, boolean includeSubtypes, int depth) throws CoreException {return null;} - public String getFileExtension() {return null;} - public long getLocalTimeStamp() {return 0;} - public IPath getLocation() {return null;} - public URI getLocationURI() {return null;} - public IMarker getMarker(long id) {return null;} - public long getModificationStamp() {return 0;} - public IContainer getParent() {return null;} - public String getPersistentProperty(QualifiedName key) throws CoreException {return null;} - public IProject getProject() {return null;} - public IPath getRawLocation() {return null;} - public URI getRawLocationURI() {return null;} - public ResourceAttributes getResourceAttributes() {return null;} - public Object getSessionProperty(QualifiedName key) throws CoreException {return null;} - public int getType() {return 0;} - public IWorkspace getWorkspace() {return null;} - public boolean isAccessible() {return false;} - public boolean isDerived() {return false;} - public boolean isLocal(int depth) {return false;} - public boolean isLinked() {return false;} - public boolean isLinked(int options) {return false;} - public boolean isPhantom() {return false;} - public boolean isSynchronized(int depth) {return false;} - public boolean isTeamPrivateMember() {return false;} - public void move(IPath destination, boolean force, IProgressMonitor monitor) throws CoreException {} - public void move(IPath destination, int updateFlags, IProgressMonitor monitor) throws CoreException {} - public void move(IProjectDescription description, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {} - public void move(IProjectDescription description, int updateFlags, IProgressMonitor monitor) throws CoreException {} - public void refreshLocal(int depth, IProgressMonitor monitor) throws CoreException {} - public void revertModificationStamp(long value) throws CoreException {} - public void setDerived(boolean isDerived) throws CoreException {} - public void setLocal(boolean flag, int depth, IProgressMonitor monitor) throws CoreException {} - public long setLocalTimeStamp(long value) throws CoreException {return 0;} - public void setPersistentProperty(QualifiedName key, String value) throws CoreException {} - public void setReadOnly(boolean readOnly) {} - public void setResourceAttributes(ResourceAttributes attributes) throws CoreException {} - public void setSessionProperty(QualifiedName key, Object value) throws CoreException {} - public void setTeamPrivateMember(boolean isTeamPrivate) throws CoreException {} - public void touch(IProgressMonitor monitor) throws CoreException {} - public Object getAdapter(Class adapter) {return null;} - public boolean contains(ISchedulingRule rule) {return false;} - public boolean isConflicting(ISchedulingRule rule) {return false;} - - public int findMaxProblemSeverity(String type, boolean includeSubtypes, - int depth) throws CoreException { - // TODO Auto-generated method stub - return 0; - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/TextSelectionStub.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/TextSelectionStub.java deleted file mode 100644 index 89ebda5dd9a063407ca340cf1c962463f97c7a81..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/stubs/TextSelectionStub.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * DPP - Serious Distributed Pair Programming - * (c) Freie Universit�t Berlin - Fachbereich Mathematik und Informatik - 2006 - * (c) Riad Djemili - 2006 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package de.fu_berlin.inf.dpp.test.stubs; - -import org.eclipse.jface.text.ITextSelection; - -public class TextSelectionStub implements ITextSelection { - - private int offset; - private int length; - private int startLine; - private int endLine; - - public TextSelectionStub(int offset, int length, int startLine, int endLine) { - this.offset = offset; - this.length = length; - this.startLine = startLine; - this.endLine = endLine; - } - - public int getOffset() { - return offset; - } - - public int getLength() { - return length; - } - - public int getStartLine() { - return startLine; - } - - public int getEndLine() { - return endLine; - } - - public String getText() { - return null; - } - - public boolean isEmpty() { - return false; - } -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/util/FileListHelper.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/util/FileListHelper.java deleted file mode 100644 index 435ce5151da288dc6993cf3a7782a996045d05e8..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/util/FileListHelper.java +++ /dev/null @@ -1,17 +0,0 @@ -package de.fu_berlin.inf.dpp.test.util; - -import org.eclipse.core.runtime.CoreException; - -import de.fu_berlin.inf.dpp.FileList; - -public class FileListHelper { - - public static FileList createFileListForDefaultProject() throws CoreException{ - return new FileList(ResourceHelper.createDefaultProject()); - } - - public static FileList createFielListForProject(String projectname) throws CoreException{ - return new FileList(ResourceHelper.createProject(projectname)); - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/util/ResourceHelper.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/util/ResourceHelper.java deleted file mode 100644 index 4f7e584007dc627bdb970f74b86c4dbcd1cdf8d4..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/util/ResourceHelper.java +++ /dev/null @@ -1,116 +0,0 @@ -package de.fu_berlin.inf.dpp.test.util; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.logging.Logger; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; - -/** - * A simple helper class for use with JUnit plug-in tests. - * - * @author rdjemili - */ -public class ResourceHelper { - - public static Logger logger = Logger.getLogger(ResourceHelper.class.toString()); - - public static String TEST_PROJECT = "JUnitTestProject"; - public static String RECEIVED_TEST_PROJECT = "JUnitReceivedTestProject"; - - - private static void initProject(IProject localProject) throws CoreException{ - IFile file = createFile(localProject, "First.java", "public class First{ /* erste Testklasse*/ }"); -// if (file.exists()) { -//// file.setReadOnly(false); -// -// file.setContents(input, IResource.FORCE, new NullProgressMonitor()); -// } else { -// file.create(input, true, new NullProgressMonitor()); -// } - } - - public static IProject createProject(String name) throws CoreException { - - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IProject project = root.getProject(name); - if(!project.exists()){ - logger.info("project will create"); - project.create(null); - project.open(null); - initProject(project); - } -// project.create(null); - project.open(null); - - return project; - } - - public static IProject createDefaultProject() throws CoreException { - return createProject(TEST_PROJECT); - } - - public static IProject getProject(String name) throws CoreException { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IProject project = root.getProject(name); - if(!project.exists()){ - project.create(null); - } -// project.create(null); - project.open(null); - - return project; - } - - public static IProject getDefaultProject() throws CoreException { - - return getProject(TEST_PROJECT); - } - - public static IFile getDefaultFile() throws CoreException{ - IProject project = getDefaultProject(); - IFile file = project.getFile("First.java"); - if(!file.exists()){ - initProject(project); - file = project.getFile("First.java"); - } - return file; - } - - public static IFile getFile(String path) throws CoreException{ - IProject project = getDefaultProject(); - IFile file = project.getFile(path); - if(!file.exists()){ - return null; - } - return file; - } - - public static IFile createFile(IProject project, String path, String content) - throws CoreException { - - IFile file = project.getFile(new Path(path)); - ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes()); - file.create(in, true, null); - - return file; - } - - public static IFile createFile(IProject project, String path, InputStream input) - throws CoreException { - - IFile file = project.getFile(new Path(path)); -// ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes()); - file.create(input, true, null); - - - return file; -} -} diff --git a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/zip/TarFileZipperTest.java b/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/zip/TarFileZipperTest.java deleted file mode 100644 index 03c4ff41f570ab01074cc46004c996f1863026a9..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/de/fu_berlin/inf/dpp/test/zip/TarFileZipperTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package de.fu_berlin.inf.dpp.test.zip; - -import java.io.File; -import java.util.List; -import java.util.Vector; - -import org.apache.log4j.PropertyConfigurator; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -import de.fu_berlin.inf.dpp.test.util.ResourceHelper; -import de.fu_berlin.inf.dpp.util.FileZipper; -import junit.framework.TestCase; - -public class TarFileZipperTest extends TestCase { - static { - PropertyConfigurator.configureAndWatch("log4j.properties", 60 * 1000); - } - public TarFileZipperTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testCreateZipArchive() throws Exception{ -// FileZipper.createZipArchive(); -// FileZipper.readInputStreamsProjectArchive(new File("/home/troll/t_incoming_archive.zip")); - FileZipper.readInputStreamsProjectArchive(new File("/home/troll/Project.zip")); -// FileZipper.readZipArchive("/home/troll/t_incoming_archive.zip"); - } - - public void xtestCreateProjectArchive() throws Exception{ - -// - List<IPath> list = new Vector<IPath>(); - list.add(new Path("/home/troll/test_archiv/ConnectionDateiori79.log")); - list.add(new Path("/home/troll/test_archiv/ConnectionDateiori80.log")); - - - FileZipper.createProjectZipArchive(list,"/home/troll/archive.zip", null); - FileZipper.readInputStreamsProjectArchive(new File("/home/troll/archive.zip")); - - - - - } - -} diff --git a/de.fu_berlin.inf.dpp.test/src/resources/JupiterTestUI.properties b/de.fu_berlin.inf.dpp.test/src/resources/JupiterTestUI.properties deleted file mode 100644 index f4223a1150f8584aab4adb8889264aa65b60ede1..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.test/src/resources/JupiterTestUI.properties +++ /dev/null @@ -1,27 +0,0 @@ -# To change this template, choose Tools | Templates -# and open the template in the editor. - -jLabelInitialState.text=Initial state: -jButtonRun.text=Run -jLabelTextSide3.text=Text -jLabelDelaySide3.text=Delay -jTextFieldDelaySide3.text=0 -jLabelPositionSide3.text=Position -jRadioButtonDeleteSide3.text=Delete OP -jRadioButtonInsertSide3.text=Insert OP -jLabelTextSide2.text=Text -jLabelDelaySide2.text=Delay -jTextFieldDelaySide2.text=0 -jLabelPositionSide2.text=Position -jRadioButtonDeleteSide2.text=Delete OP -jRadioButtonInsertSide2.text=Insert OP -jLabelTextSide1.text=Text -jLabelDelaySide1.text=Delay -jTextFieldDelay.text=0 -jLabelPositionSide1.text=Position -jRadioButtonDelete.text=Delete OP -jRadioButtonInsert.text=Insert OP -jLabelGlobalResult.text=Result -#NOI18N -jLabelGlobalResult.font=Dialog 12 Bold -jButtonExit.text=Exit diff --git a/de.fu_berlin.inf.dpp.update/.project b/de.fu_berlin.inf.dpp.update/.project deleted file mode 100644 index 3ac5de8b625a59945274236ea297568396c90517..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.update/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>Saros Update Site</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.UpdateSiteBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.UpdateSiteNature</nature> - </natures> -</projectDescription> diff --git a/de.fu_berlin.inf.dpp.update/features/feature.xml b/de.fu_berlin.inf.dpp.update/features/feature.xml deleted file mode 100644 index 425cce0d1ab185e89876a3a936444d6f3fee5bc4..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.update/features/feature.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="de.fu_berlin.inf.saros_feature" - label="Saros Feature" - version="1.0.0"> - - <description> - Serious Distributed Pair Programming for Eclipse. - </description> - - <copyright> - Code: Riad Djemili & FU-Berlin, Germany -Icons: Mark James (http://famfamfam.com) - </copyright> - - <license url="http://www.example.com/license"> - [Enter License Description here.] - </license> - -</feature> diff --git a/de.fu_berlin.inf.dpp.update/index.html b/de.fu_berlin.inf.dpp.update/index.html deleted file mode 100644 index 65b8cead62df8614f806fe5b679bed6fceee9e5f..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.update/index.html +++ /dev/null @@ -1,60 +0,0 @@ -<html> -<head> -<title>Saros Update Site</title> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -<style>@import url("web/site.css");</style> -<script type="text/javascript"> - var returnval = 0; - var stylesheet, xmlFile, cache, doc; - function init(){ - // NSCP 7.1+ / Mozilla 1.4.1+ / Safari - // Use the standard DOM Level 2 technique, if it is supported - if (document.implementation && document.implementation.createDocument) { - xmlFile = document.implementation.createDocument("", "", null); - stylesheet = document.implementation.createDocument("", "", null); - if (xmlFile.load){ - xmlFile.load("site.xml"); - stylesheet.load("web/site.xsl"); - } else { - alert("Document could not be loaded by browser."); - } - xmlFile.addEventListener("load", transform, false); - stylesheet.addEventListener("load", transform, false); - } - //IE 6.0+ solution - else if (window.ActiveXObject) { - xmlFile = new ActiveXObject("msxml2.DOMDocument.3.0"); - xmlFile.async = false; - xmlFile.load("site.xml"); - stylesheet = new ActiveXObject("msxml2.FreeThreadedDOMDocument.3.0"); - stylesheet.async = false; - stylesheet.load("web/site.xsl"); - cache = new ActiveXObject("msxml2.XSLTemplate.3.0"); - cache.stylesheet = stylesheet; - transformData(); - } - } - // separate transformation function for IE 6.0+ - function transformData(){ - var processor = cache.createProcessor(); - processor.input = xmlFile; - processor.transform(); - data.innerHTML = processor.output; - } - // separate transformation function for NSCP 7.1+ and Mozilla 1.4.1+ - function transform(){ - returnval+=1; - if (returnval==2){ - var processor = new XSLTProcessor(); - processor.importStylesheet(stylesheet); - doc = processor.transformToDocument(xmlFile); - document.getElementById("data").innerHTML = doc.documentElement.innerHTML; - } - } -</script> -</head> -<body onload="init();"> -<!--[insert static HTML here]--> -<div id="data"><!-- this is where the transformed data goes --></div> -</body> -</html> diff --git a/de.fu_berlin.inf.dpp.update/site.xml b/de.fu_berlin.inf.dpp.update/site.xml deleted file mode 100644 index 463f21d497aed7d34345465a57a2be6accfe1991..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.update/site.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<site> - <feature url="features/de.fu_berlin.inf.dpp.feature_1.0.0.jar" id="de.fu_berlin.inf.dpp.feature" version="1.0.0"/> -</site> diff --git a/de.fu_berlin.inf.dpp.update/web/site.css b/de.fu_berlin.inf.dpp.update/web/site.css deleted file mode 100644 index 425134ee313a29c4b3a3ed92069a036c46d5519c..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.update/web/site.css +++ /dev/null @@ -1,12 +0,0 @@ -<STYLE type="text/css"> -td.spacer {padding-bottom: 10px; padding-top: 10px;} -.title { font-family: sans-serif; color: #99AACC;} -.bodyText { font-family: sans-serif; font-size: 9pt; color:#000000; } -.sub-header { font-family: sans-serif; font-style: normal; font-weight: bold; font-size: 9pt; color: white;} -.log-text {font-family: sans-serif; font-style: normal; font-weight: lighter; font-size: 8pt; color:black;} -.big-header { font-family: sans-serif; font-style: normal; font-weight: bold; font-size: 9pt; color: white; border-top:10px solid white;} -.light-row {background:#FFFFFF} -.dark-row {background:#EEEEFF} -.header {background:#99AADD} -#indent {word-wrap : break-word;width :300px;text-indent:10px;} -</STYLE> diff --git a/de.fu_berlin.inf.dpp.update/web/site.xsl b/de.fu_berlin.inf.dpp.update/web/site.xsl deleted file mode 100644 index 2c807599e4117237adb8ca6b2f8b4ca759a8a256..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp.update/web/site.xsl +++ /dev/null @@ -1,214 +0,0 @@ -<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl="urn:schemas-microsoft-com:xslt"> -<xsl:output method="html" encoding="UTF-8"/> -<xsl:key name="cat" match="category" use="@name"/> -<xsl:template match="/"> -<xsl:for-each select="site"> - <html> - <head> - <title>Saros Update Site</title> - <style>@import url("web/site.css");</style> - </head> - <body> - <h1 class="title">Saros Update Site</h1> - <p class="bodyText"><xsl:value-of select="description"/></p> - <table width="100%" border="0" cellspacing="1" cellpadding="2"> - <xsl:for-each select="category-def"> - <xsl:sort select="@label" order="ascending" case-order="upper-first"/> - <xsl:sort select="@name" order="ascending" case-order="upper-first"/> - <xsl:if test="count(key('cat',@name)) != 0"> - <tr class="header"> - <td class="sub-header" width="30%"> - <xsl:value-of select="@name"/> - </td> - <td class="sub-header" width="70%"> - <xsl:value-of select="@label"/> - </td> - </tr> - <xsl:for-each select="key('cat',@name)"> - <xsl:sort select="ancestor::feature//@version" order="ascending"/> - <xsl:sort select="ancestor::feature//@id" order="ascending" case-order="upper-first"/> - <tr> - <xsl:choose> - <xsl:when test="(position() mod 2 = 1)"> - <xsl:attribute name="class">dark-row</xsl:attribute> - </xsl:when> - <xsl:otherwise> - <xsl:attribute name="class">light-row</xsl:attribute> - </xsl:otherwise> - </xsl:choose> - <td class="log-text" id="indent"> - <xsl:choose> - <xsl:when test="ancestor::feature//@label"> - <a href="{ancestor::feature//@url}"><xsl:value-of select="ancestor::feature//@label"/></a> - <br/> - <div id="indent"> - (<xsl:value-of select="ancestor::feature//@id"/> - <xsl:value-of select="ancestor::feature//@version"/>) - </div> - </xsl:when> - <xsl:otherwise> - <a href="{ancestor::feature//@url}"><xsl:value-of select="ancestor::feature//@id"/> - <xsl:value-of select="ancestor::feature//@version"/></a> - </xsl:otherwise> - </xsl:choose> - <br /> - </td> - <td> - <table> - <xsl:if test="ancestor::feature//@os"> - <tr><td class="log-text" id="indent">Operating Systems:</td> - <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@os"/></td> - </tr> - </xsl:if> - <xsl:if test="ancestor::feature//@ws"> - <tr><td class="log-text" id="indent">Windows Systems:</td> - <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@ws"/></td> - </tr> - </xsl:if> - <xsl:if test="ancestor::feature//@nl"> - <tr><td class="log-text" id="indent">Languages:</td> - <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@nl"/></td> - </tr> - </xsl:if> - <xsl:if test="ancestor::feature//@arch"> - <tr><td class="log-text" id="indent">Architecture:</td> - <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@arch"/></td> - </tr> - </xsl:if> - </table> - </td> - </tr> - </xsl:for-each> - <tr><td class="spacer"><br/></td><td class="spacer"><br/></td></tr> - </xsl:if> - </xsl:for-each> - <xsl:if test="count(feature) > count(feature/category)"> - <tr class="header"> - <td class="sub-header" colspan="2"> - Uncategorized - </td> - </tr> - </xsl:if> - <xsl:choose> - <xsl:when test="function-available('msxsl:node-set')"> - <xsl:variable name="rtf-nodes"> - <xsl:for-each select="feature[not(category)]"> - <xsl:sort select="@id" order="ascending" case-order="upper-first"/> - <xsl:sort select="@version" order="ascending" /> - <xsl:value-of select="."/> - <xsl:copy-of select="." /> - </xsl:for-each> - </xsl:variable> - <xsl:variable name="myNodeSet" select="msxsl:node-set($rtf-nodes)/*"/> - <xsl:for-each select="$myNodeSet"> - <tr> - <xsl:choose> - <xsl:when test="position() mod 2 = 1"> - <xsl:attribute name="class">dark-row</xsl:attribute> - </xsl:when> - <xsl:otherwise> - <xsl:attribute name="class">light-row</xsl:attribute> - </xsl:otherwise> - </xsl:choose> - <td class="log-text" id="indent"> - <xsl:choose> - <xsl:when test="@label"> - <a href="{@url}"><xsl:value-of select="@label"/></a> - <br /> - <div id="indent"> - (<xsl:value-of select="@id"/> - <xsl:value-of select="@version"/>) - </div> - </xsl:when> - <xsl:otherwise> - <a href="{@url}"><xsl:value-of select="@id"/> - <xsl:value-of select="@version"/></a> - </xsl:otherwise> - </xsl:choose> - <br /><br /> - </td> - <td> - <table> - <xsl:if test="@os"> - <tr><td class="log-text" id="indent">Operating Systems:</td> - <td class="log-text" id="indent"><xsl:value-of select="@os"/></td> - </tr> - </xsl:if> - <xsl:if test="@ws"> - <tr><td class="log-text" id="indent">Windows Systems:</td> - <td class="log-text" id="indent"><xsl:value-of select="@ws"/></td> - </tr> - </xsl:if> - <xsl:if test="@nl"> - <tr><td class="log-text" id="indent">Languages:</td> - <td class="log-text" id="indent"><xsl:value-of select="@nl"/></td> - </tr> - </xsl:if> - <xsl:if test="@arch"> - <tr><td class="log-text" id="indent">Architecture:</td> - <td class="log-text" id="indent"><xsl:value-of select="@arch"/></td> - </tr> - </xsl:if> - </table> - </td> - </tr> - </xsl:for-each> - </xsl:when> - <xsl:otherwise> - <xsl:for-each select="feature[not(category)]"> - <xsl:sort select="@id" order="ascending" case-order="upper-first"/> - <xsl:sort select="@version" order="ascending" /> - <tr> - <xsl:choose> - <xsl:when test="count(preceding-sibling::feature[not(category)]) mod 2 = 1"> - <xsl:attribute name="class">dark-row</xsl:attribute> - </xsl:when> - <xsl:otherwise> - <xsl:attribute name="class">light-row</xsl:attribute> - </xsl:otherwise> - </xsl:choose> - <td class="log-text" id="indent"> - <xsl:choose> - <xsl:when test="@label"> - <a href="{@url}"><xsl:value-of select="@label"/></a> - <br /> - <div id="indent"> - (<xsl:value-of select="@id"/> - <xsl:value-of select="@version"/>) - </div> - </xsl:when> - <xsl:otherwise> - <a href="{@url}"><xsl:value-of select="@id"/> - <xsl:value-of select="@version"/></a> - </xsl:otherwise> - </xsl:choose> - <br /><br /> - </td> - <td> - <table> - <xsl:if test="@os"> - <tr><td class="log-text" id="indent">Operating Systems:</td> - <td class="log-text" id="indent"><xsl:value-of select="@os"/></td> - </tr> - </xsl:if> - <xsl:if test="@ws"> - <tr><td class="log-text" id="indent">Windows Systems:</td> - <td class="log-text" id="indent"><xsl:value-of select="@ws"/></td> - </tr> - </xsl:if> - <xsl:if test="@nl"> - <tr><td class="log-text" id="indent">Languages:</td> - <td class="log-text" id="indent"><xsl:value-of select="@nl"/></td> - </tr> - </xsl:if> - <xsl:if test="@arch"> - <tr><td class="log-text" id="indent">Architecture:</td> - <td class="log-text" id="indent"><xsl:value-of select="@arch"/></td> - </tr> - </xsl:if> - </table> - </td> - </tr> - </xsl:for-each> - </xsl:otherwise> - </xsl:choose> - </table> - </body> - </html> -</xsl:for-each> -</xsl:template> -</xsl:stylesheet> diff --git a/de.fu_berlin.inf.dpp/icons/sample.gif b/de.fu_berlin.inf.dpp/icons/sample.gif deleted file mode 100644 index 34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp/icons/sample.gif and /dev/null differ diff --git a/de.fu_berlin.inf.dpp/lib/easymock.jar b/de.fu_berlin.inf.dpp/lib/easymock.jar deleted file mode 100644 index c4159f5a0a4c19d6afc89cbc271208acb8ba7dff..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp/lib/easymock.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp/lib/junit.jar b/de.fu_berlin.inf.dpp/lib/junit.jar deleted file mode 100644 index 674d71e89ea154dbe2e3cd032821c22b39e8fd68..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp/lib/junit.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp/lib/log4j-1.2.15.jar b/de.fu_berlin.inf.dpp/lib/log4j-1.2.15.jar deleted file mode 100644 index c930a6ab4d4b73c1a6feb9e929091205664bb340..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp/lib/log4j-1.2.15.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp/lib/smack.jar b/de.fu_berlin.inf.dpp/lib/smack.jar deleted file mode 100644 index 6bfc8f2594bf826a97518693afee3d8038023479..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp/lib/smack.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp/lib/smackx-jingle.jar b/de.fu_berlin.inf.dpp/lib/smackx-jingle.jar deleted file mode 100644 index c14af0a240944114eaebfcc17884f9f62ad48617..0000000000000000000000000000000000000000 Binary files a/de.fu_berlin.inf.dpp/lib/smackx-jingle.jar and /dev/null differ diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/management/ConcurrentDocumentManager.java b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/management/ConcurrentDocumentManager.java deleted file mode 100644 index cc786ef19a8d61f372dad3bf1556c22e669f132a..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/management/ConcurrentDocumentManager.java +++ /dev/null @@ -1,419 +0,0 @@ -package de.fu_berlin.inf.dpp.concurrent.management; - -import java.util.HashMap; -import java.util.List; -import java.util.Vector; - -import org.apache.log4j.Logger; -import org.eclipse.core.runtime.IPath; - -import de.fu_berlin.inf.dpp.User; -import de.fu_berlin.inf.dpp.activities.EditorActivity; -import de.fu_berlin.inf.dpp.activities.IActivity; -import de.fu_berlin.inf.dpp.activities.TextEditActivity; -import de.fu_berlin.inf.dpp.activities.EditorActivity.Type; -import de.fu_berlin.inf.dpp.concurrent.ConcurrentManager; -import de.fu_berlin.inf.dpp.concurrent.jupiter.JupiterClient; -import de.fu_berlin.inf.dpp.concurrent.jupiter.JupiterServer; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; -import de.fu_berlin.inf.dpp.concurrent.jupiter.RequestForwarder; -import de.fu_berlin.inf.dpp.concurrent.jupiter.TransformationException; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.JupiterDocumentClient; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.JupiterDocumentServer; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; -import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.SplitOperation; -import de.fu_berlin.inf.dpp.net.IActivitySequencer; -import de.fu_berlin.inf.dpp.net.JID; -import de.fu_berlin.inf.dpp.project.IActivityListener; -import de.fu_berlin.inf.dpp.project.IActivityManager; -import de.fu_berlin.inf.dpp.project.IActivityProvider; - -public class ConcurrentDocumentManager implements ConcurrentManager { - - private static Logger logger = Logger.getLogger(Logger.class); - - /** Jupiter server instance documents */ - private HashMap<IPath, JupiterDocumentServer> concurrentDocuments; - - /** current open editor at client side. */ - private HashMap<IPath, JupiterClient> clientDocs; - - private List<User> drivers; - - private User host; - - private JID myJID; - - private Side side; - - private RequestForwarder forwarder; - - private IActivitySequencer sequencer; - - public ConcurrentDocumentManager(Side side, User host, JID myJID) { - - if (side == Side.HOST_SIDE) { - concurrentDocuments = new HashMap<IPath, JupiterDocumentServer>(); - } - - this.clientDocs = new HashMap<IPath, JupiterClient>(); - drivers = new Vector<User>(); - this.side = side; - this.host = host; - this.myJID = myJID; - } - - public void setActivitySequencer(IActivitySequencer sequencer){ - this.sequencer = sequencer; - } - - public void setRequestForwarder(RequestForwarder f) { - this.forwarder = f; - } - - public RequestForwarder getRequestForwarder() { - return this.forwarder; - } - - public void addDriver(User jid) { - drivers.add(jid); - - } - - public void removeDriver(User jid) { - drivers.remove(jid); - } - - public List<User> getDriver() { - - return drivers; - } - - public boolean isDriver(User jid) { - return drivers.contains(jid); - } - - /** - * - */ - public IActivity activityCreated(IActivity activity) { - - // editorActivitiy(activity, true); - - if(createdTextEditActivity(activity)){ - /* handled by jupiter and is sended by request transmitting. */ - return null; - } - return activity; - } - - - - /** - * handles text edit activities with jupiter. - * @param activity - * @return true if activity is transformed with jupiter. - */ - private boolean createdTextEditActivity(IActivity activity) { - - if (activity instanceof TextEditActivity) { - TextEditActivity textEdit = (TextEditActivity) activity; - // if (!isHostSide()) { - /** - * lokal erzeugte operation beim client 1. Aufruf von - * generateRequest beim client. Änderungen wurden bereits im Editor - * geschrieben. 2. versenden der Änderungen an Server (später) - */ - JupiterClient jupClient = null; - /* no jupiter client already exists for this editor text edit */ - if (!clientDocs.containsKey(textEdit.getEditor())) { - jupClient = new JupiterDocumentClient(this.myJID, - this.forwarder); - jupClient.setEditor(textEdit.getEditor()); - clientDocs.put(textEdit.getEditor(), jupClient); - } - - /* generate request. */ - jupClient = clientDocs.get(textEdit.getEditor()); - if (jupClient != null) { - Operation op = getOperation(textEdit); - /* sync with local jupiter client */ - Request req = jupClient.generateRequest(op); - - - /* already set and forward inside of jup client.*/ -// /* add appropriate Editor path. */ -// req.setEditorPath(textEdit.getEditor()); -// /* transmit request */ -// forwarder.forwardOutgoingRequest(req); - return true; - } - // } - } - return false; - } - - private TextEditActivity execTextEditActivity(Request request) { - - // if (!isHostSide()) { - /** - * lokal erzeugte operation beim client 1. Aufruf von generateRequest - * beim client. Änderungen wurden bereits im Editor geschrieben. 2. - * versenden der Änderungen an Server (später) - */ - JupiterClient jupClient = null; - /* no jupiter client already exists for this editor text edit */ - if (!clientDocs.containsKey(request.getEditorPath())) { - jupClient = new JupiterDocumentClient(this.myJID, this.forwarder); - jupClient.setEditor(request.getEditorPath()); - clientDocs.put(request.getEditorPath(), jupClient); - } - - /* generate request. */ - jupClient = clientDocs.get(request.getEditorPath()); - if (jupClient != null) { - /* operational transformation. */ - Operation op; - try { - op = jupClient.receiveRequest(request); - } catch (TransformationException e) { - logger.error("Error during transformation: ", e); - return null; - } - - TextEditActivity textEdit = getTextEditActivity(op); - textEdit.setEditor(request.getEditorPath()); - textEdit.setSource(request.getJID().toString()); - /* execute activity in activity sequencer. */ - sequencer.execTransformedActivity(textEdit); - return textEdit; - } - // } - return null; - } - - public IActivity exec(IActivity activity) { - - if(activity instanceof TextEditActivity){ - //check for jupiter client documents - TextEditActivity text = (TextEditActivity) activity; - if(clientDocs.containsKey(text.getEditor())){ - /* activity have to be transformed with jupiter on this client.*/ - return null; - } - } - - return activity; - } - - public boolean isHostSide() { - if (side == Side.HOST_SIDE) { - return true; - } - return false; - } - - public boolean isHost(JID jid) { - if (jid.equals(host.getJid())) { - return true; - } - return false; - } - - public void setHost(User host) { - this.host = host; - } - - /** - * convert TextEditActivity to Operation op - * - * @param text - * @return - */ - public Operation getOperation(TextEditActivity text) { - Operation op = null; - // delete activity - if (text.replace > 0 && text.text.length() == 0) { - /* string placeholder in length of delete area. */ -// String placeholder = ((10) * (5)) + ""; - op = new DeleteOperation(text.offset, text.replace+""); - } - // insert activity - if (text.replace == 0 && text.text.length() > 0) { - op = new InsertOperation(text.offset, text.text); - } - return op; - } - - /** - * convert Operation op to text edit activity - * - * @param op - * @return - */ - public TextEditActivity getTextEditActivity(Operation op) { - TextEditActivity textEdit = null; - if (op instanceof DeleteOperation) { - DeleteOperation del = (DeleteOperation) op; - textEdit = new TextEditActivity(del.getPosition(), "", Integer.parseInt(del.getText())); - } - if (op instanceof InsertOperation) { - InsertOperation ins = (InsertOperation) op; - textEdit = new TextEditActivity(ins.getPosition(), ins.getText(), 0); - } - if (op instanceof SplitOperation) { - // TODO: implements later: - logger.warn("Split Operation have to be implements."); - } - - return textEdit; - } - -// private void editorActivitiy(IActivity activity, boolean local) { -// if (!isHostSide() || local) { -// if (activity instanceof EditorActivity) { -// EditorActivity editor = (EditorActivity) activity; -// /* if new editor opened */ -// if (editor.getType() == Type.Activated) { -// /* no jupiter client exists for this editor */ -// if (!clientDocs.containsKey(editor.getPath())) { -// // TODO: add Request forwarder -// JupiterClient jupiter = new JupiterDocumentClient( -// myJID, null); -// jupiter.setEditor(editor.getPath()); -// /* add to current docs */ -// clientDocs.put(editor.getPath(), jupiter); -// } -// // send EditorActivity to project host. -// -// } -// if (editor.getType() == Type.Closed) { -// /* remove editor form jupiter concurrent mechanism. */ -// if (clientDocs.containsKey(editor.getPath())) { -// clientDocs.remove(editor.getPath()); -// } -// } -// } -// } -// /* managing of jupiter server documents. */ -// if (isHostSide()) { -// /* Editor activities. */ -// if (activity instanceof EditorActivity) { -// EditorActivity editor = (EditorActivity) activity; -// /* if new editor opened */ -// if (editor.getType() == Type.Activated) { -// /* create new jupiter document server. */ -// if (!concurrentDocuments.containsKey(editor.getPath())) { -// JupiterDocumentServer jup = new JupiterDocumentServer( -// forwarder); -// jup.setEditor(editor.getPath()); -// -// /* create host proxy */ -// jup.addProxyClient(host.getJid()); -// /* create client proxy if remote activity. */ -// if (!local) { -// jup.addProxyClient(new JID(editor.getSource())); -// } -// /* add to server list. */ -// concurrentDocuments.put(editor.getPath(), jup); -// -// /* -// * create host jupiter client for local request -// * handling. -// */ -// if (!clientDocs.containsKey(editor.getPath())) { -// JupiterClient jupiter = new JupiterDocumentClient( -// myJID, null); -// jupiter.setEditor(editor.getPath()); -// } -// -// } -// } -// /* if document closed. */ -// if (editor.getType() == Type.Closed) { -// if (!local) { -// /* remove remote client from proxy list. */ -// JupiterDocumentServer serverDoc = concurrentDocuments -// .get(editor.getPath()); -// if (serverDoc != null) { -// /* remove remote client. */ -// serverDoc.removeProxyClient(new JID(editor -// .getSource())); -// /* TODO: if only host is exists. */ -// // if(serverDoc.getProxies().size() == 1){ -// // -// // } -// } -// } -// } -// } -// } -// } - - /* - * 1. hinzufügen und löschen von jupiter servern 2. list mit transmitter - * threads, die Nachrichten aus den outgoing queues versenden. 3. - * Schnittstelle vom Itransmitter zu den einzelnen jupiter document servern, - * um die Nachrichten vom Itransmitter weiterzuleiten. - * - * - */ - - /** - * sync received request with right jupiter server document and local - * client. - * - */ - public IActivity receiveRequest(Request request) { - - /* 1. Sync with jupiter server component. */ - if (isHostSide()) { - /* if host side and server jupiter side of request */ - if (isHost(request.getJID()) && request.getSiteId() == 0) { - /* request already has transformed and have to be execute. */ - return execTextEditActivity(request); - } - - JupiterDocumentServer docServer = null; - /** - * if no jupiter document server exists. - */ - if (!concurrentDocuments.containsKey(request.getEditorPath())) { - /* create new document server. */ - docServer = new JupiterDocumentServer(forwarder); -// docServer = new JupiterDocumentServer(); - docServer.setEditor(request.getEditorPath()); - /* create new local host document client. */ - docServer.addProxyClient(host.getJid()); - if(!isHost(request.getJID())){ - docServer.addProxyClient(request.getJID()); - } - concurrentDocuments.put(request.getEditorPath(), docServer); - } - docServer = concurrentDocuments.get(request - .getEditorPath()); - try{ - /* check if sender id exists in proxy list. */ - if(!docServer.getProxies().containsKey(request.getJID())){ - docServer.addProxyClient(request.getJID()); - } - } catch(InterruptedException ie){ - logger.error("Error during get proxy list of jupiter server.",ie); - } - - /* sync request with jupiter document server. */ - docServer.addRequest(request); - - return null; - } else { - /* - * 2. receive request in local client component and return the - * transformed operation as IActivity. - */ - - return execTextEditActivity(request); - } - } -} diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/annotations/AnnotationSaros.java b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/annotations/AnnotationSaros.java deleted file mode 100644 index 66cc236d0b5f29761cbc56e8982229e992ae2384..0000000000000000000000000000000000000000 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/annotations/AnnotationSaros.java +++ /dev/null @@ -1,27 +0,0 @@ -package de.fu_berlin.inf.dpp.editor.annotations; - -import org.eclipse.jface.text.source.Annotation; - -public class AnnotationSaros extends Annotation { - - private String source; - - AnnotationSaros(String type, boolean isPersistent, String text, String source) { - super(type, isPersistent, text); - this.source=source; - } - - AnnotationSaros(String type, boolean isPersistent, String text) { - super(type, isPersistent, text); - this.source=null; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - -} diff --git a/de.fu_berlin.inf.dpp/header.txt b/header.txt similarity index 100% rename from de.fu_berlin.inf.dpp/header.txt rename to header.txt diff --git a/de.fu_berlin.inf.dpp/icons/add.png b/icons/add.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/add.png rename to icons/add.png diff --git a/de.fu_berlin.inf.dpp/icons/bullet_feed.png b/icons/bullet_feed.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/bullet_feed.png rename to icons/bullet_feed.png diff --git a/de.fu_berlin.inf.dpp/icons/bullet_green.png b/icons/bullet_green.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/bullet_green.png rename to icons/bullet_green.png diff --git a/de.fu_berlin.inf.dpp/icons/bullet_yellow.png b/icons/bullet_yellow.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/bullet_yellow.png rename to icons/bullet_yellow.png diff --git a/de.fu_berlin.inf.dpp/icons/comment.png b/icons/comment.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/comment.png rename to icons/comment.png diff --git a/de.fu_berlin.inf.dpp/icons/connect.png b/icons/connect.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/connect.png rename to icons/connect.png diff --git a/de.fu_berlin.inf.dpp/icons/disconnect.png b/icons/disconnect.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/disconnect.png rename to icons/disconnect.png diff --git a/de.fu_berlin.inf.dpp/icons/door_open.png b/icons/door_open.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/door_open.png rename to icons/door_open.png diff --git a/de.fu_berlin.inf.dpp/icons/group.png b/icons/group.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/group.png rename to icons/group.png diff --git a/de.fu_berlin.inf.dpp/icons/invites.png b/icons/invites.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/invites.png rename to icons/invites.png diff --git a/de.fu_berlin.inf.dpp/icons/monitor_add.png b/icons/monitor_add.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/monitor_add.png rename to icons/monitor_add.png diff --git a/de.fu_berlin.inf.dpp/icons/monitor_delete.png b/icons/monitor_delete.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/monitor_delete.png rename to icons/monitor_delete.png diff --git a/de.fu_berlin.inf.dpp/icons/monitor_edit.png b/icons/monitor_edit.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/monitor_edit.png rename to icons/monitor_edit.png diff --git a/de.fu_berlin.inf.dpp/icons/monitor_go.png b/icons/monitor_go.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/monitor_go.png rename to icons/monitor_go.png diff --git a/de.fu_berlin.inf.dpp/icons/monitor_lightning.png b/icons/monitor_lightning.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/monitor_lightning.png rename to icons/monitor_lightning.png diff --git a/de.fu_berlin.inf.dpp/icons/read_only.gif b/icons/read_only.gif similarity index 100% rename from de.fu_berlin.inf.dpp/icons/read_only.gif rename to icons/read_only.gif diff --git a/de.fu_berlin.inf.dpp.ecg/icons/sample.gif b/icons/sample.gif similarity index 100% rename from de.fu_berlin.inf.dpp.ecg/icons/sample.gif rename to icons/sample.gif diff --git a/de.fu_berlin.inf.dpp/icons/stop.gif b/icons/stop.gif similarity index 100% rename from de.fu_berlin.inf.dpp/icons/stop.gif rename to icons/stop.gif diff --git a/de.fu_berlin.inf.dpp/icons/table_edit.png b/icons/table_edit.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/table_edit.png rename to icons/table_edit.png diff --git a/de.fu_berlin.inf.dpp/icons/telephone.png b/icons/telephone.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/telephone.png rename to icons/telephone.png diff --git a/de.fu_berlin.inf.dpp/icons/transmit.png b/icons/transmit.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/transmit.png rename to icons/transmit.png diff --git a/de.fu_berlin.inf.dpp/icons/transmit_add.png b/icons/transmit_add.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/transmit_add.png rename to icons/transmit_add.png diff --git a/de.fu_berlin.inf.dpp/icons/transmit_blue.png b/icons/transmit_blue.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/transmit_blue.png rename to icons/transmit_blue.png diff --git a/de.fu_berlin.inf.dpp/icons/user.png b/icons/user.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/user.png rename to icons/user.png diff --git a/de.fu_berlin.inf.dpp/icons/user_add.png b/icons/user_add.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/user_add.png rename to icons/user_add.png diff --git a/de.fu_berlin.inf.dpp/icons/user_edit.png b/icons/user_edit.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/user_edit.png rename to icons/user_edit.png diff --git a/de.fu_berlin.inf.dpp/icons/vcard_add.png b/icons/vcard_add.png similarity index 100% rename from de.fu_berlin.inf.dpp/icons/vcard_add.png rename to icons/vcard_add.png diff --git a/de.fu_berlin.inf.dpp.test/lib/easymock.jar b/lib/easymock.jar similarity index 100% rename from de.fu_berlin.inf.dpp.test/lib/easymock.jar rename to lib/easymock.jar diff --git a/de.fu_berlin.inf.dpp.test/lib/junit.jar b/lib/junit.jar similarity index 100% rename from de.fu_berlin.inf.dpp.test/lib/junit.jar rename to lib/junit.jar diff --git a/de.fu_berlin.inf.dpp/lib/junitsrc.zip b/lib/junitsrc.zip similarity index 100% rename from de.fu_berlin.inf.dpp/lib/junitsrc.zip rename to lib/junitsrc.zip diff --git a/de.fu_berlin.inf.dpp.test/lib/log4j-1.2.15.jar b/lib/log4j-1.2.15.jar similarity index 100% rename from de.fu_berlin.inf.dpp.test/lib/log4j-1.2.15.jar rename to lib/log4j-1.2.15.jar diff --git a/de.fu_berlin.inf.dpp.test/lib/smack.jar b/lib/smack.jar similarity index 100% rename from de.fu_berlin.inf.dpp.test/lib/smack.jar rename to lib/smack.jar diff --git a/de.fu_berlin.inf.dpp/lib/smackx-debug.jar b/lib/smackx-debug.jar similarity index 100% rename from de.fu_berlin.inf.dpp/lib/smackx-debug.jar rename to lib/smackx-debug.jar diff --git a/de.fu_berlin.inf.dpp.test/lib/smackx-jingle.jar b/lib/smackx-jingle.jar similarity index 100% rename from de.fu_berlin.inf.dpp.test/lib/smackx-jingle.jar rename to lib/smackx-jingle.jar diff --git a/de.fu_berlin.inf.dpp/lib/smackx.jar b/lib/smackx.jar similarity index 100% rename from de.fu_berlin.inf.dpp/lib/smackx.jar rename to lib/smackx.jar diff --git a/de.fu_berlin.inf.dpp/log4j.properties b/log4j.properties similarity index 50% rename from de.fu_berlin.inf.dpp/log4j.properties rename to log4j.properties index 4de8196e35c1a19bf3f3cda3e5f5746829e38da7..daff52077360bfee594a131f03b8d6ce19a478eb 100644 --- a/de.fu_berlin.inf.dpp/log4j.properties +++ b/log4j.properties @@ -7,17 +7,25 @@ log4j.appender.MeinConsoleAppender.layout.ConversionPattern=%-5p %d{yyyy-MM-dd : #log4j.appender.MeinConsoleAppender.layout.ConversionPattern=%-5p %d %l:%n%m%n #log4j.appender.MeinConsoleAppender.layout.ConversionPattern=%d{MM-dd@HH:mm:ss} %-5p (%13F:%L) %3x - %m%n -log4j.appender.MeinDaRoFiAppender=org.apache.log4j.FileAppender -#log4j.appender.MeinDaRoFiAppender=org.apache.log4j.DailyRollingFileAppender +#log4j.appender.MeinDaRoFiAppender=org.apache.log4j.FileAppender +log4j.appender.MeinDaRoFiAppender=org.apache.log4j.RollingFileAppender #log4j.appender.MeinDaRoFiAppender.datePattern='.'yyyy-MM-dd_HH-mm -log4j.appender.MeinDaRoFiAppender.file=Saros-Log-Teilnehmer-1.log +log4j.appender.MeinDaRoFiAppender.file=Saros.log +log4j.appender.MeinDaRoFiAppender.Append=false log4j.appender.MeinDaRoFiAppender.layout=org.apache.log4j.PatternLayout log4j.appender.MeinDaRoFiAppender.layout.ConversionPattern=%-5p %d{yyyy-MM-dd : HH:mm:ss} (%F:%L) : %m%n #log4j.appender.MeinDaRoFiAppender.layout.ConversionPattern=%-5p %d %l: %n%m%n log4j.logger.de.fu_berlin.inf.dpp=ERROR -log4j.logger.de.fu_berlin.inf.dpp.invitation.internal=INFO -log4j.logger.de.fu_berlin.inf.dpp.net=INFO -log4j.logger.de.fu_berlin.inf.dpp.util=INFO -log4j.logger.de.fu_berlin.inf.dpp.net.internal=INFO -log4j.logger.de.fu_berlin.inf.dpp.net.jingle=DEBUG +log4j.logger.de.fu_berlin.inf.dpp.concurrent=WARN +log4j.logger.de.fu_berlin.inf.dpp.project.internal=ERROR +log4j.logger.de.fu_berlin.inf.dpp.invitation.internal=ERROR +log4j.logger.de.fu_berlin.inf.dpp.net=ERROR +log4j.logger.de.fu_berlin.inf.dpp.util=ERROR +log4j.logger.de.fu_berlin.inf.dpp.net.internal=ERROR +log4j.logger.de.fu_berlin.inf.dpp.net.internal.XMPPChatTransmitter=INFO +log4j.logger.de.fu_berlin.inf.dpp.net.internal.MultiUserChatManager=ERROR +log4j.logger.de.fu_berlin.inf.dpp.net.internal.PrivateChatManager=ERROR +log4j.logger.de.fu_berlin.inf.dpp.net.internal.ActivitySequencer=DEBUG +log4j.logger.de.fu_berlin.inf.dpp.net.internal.ExecuterQueue=INFO +log4j.logger.de.fu_berlin.inf.dpp.net.jingle=ERROR diff --git a/de.fu_berlin.inf.dpp/plugin.xml b/plugin.xml similarity index 67% rename from de.fu_berlin.inf.dpp/plugin.xml rename to plugin.xml index 11209eddd61b8eba116700c39f7c1fb63cfc9813..3985cb2de8eec61dad7c91ea13a7bb6985b4f61e 100644 --- a/de.fu_berlin.inf.dpp/plugin.xml +++ b/plugin.xml @@ -123,7 +123,22 @@ name="de.fu_berlin.inf.dpp.annotations.viewport"/> <type markerType="de.fu_berlin.inf.dpp.annotations.contribution" - name="de.fu_berlin.inf.dpp.annotations.contribution"/> + name="de.fu_berlin.inf.dpp.annotations.contribution"/> + <type + markerType="de.fu_berlin.inf.dpp.annotations.contribution.1" + name="de.fu_berlin.inf.dpp.annotations.contribution.1"/> + <type + markerType="de.fu_berlin.inf.dpp.annotations.contribution.2" + name="de.fu_berlin.inf.dpp.annotations.contribution.2"/> + <type + markerType="de.fu_berlin.inf.dpp.annotations.contribution3" + name="de.fu_berlin.inf.dpp.annotations.contribution.3"/> + <type + markerType="de.fu_berlin.inf.dpp.annotations.contribution.4" + name="de.fu_berlin.inf.dpp.annotations.contribution.4"/> + <type + markerType="de.fu_berlin.inf.dpp.annotations.contribution.5" + name="de.fu_berlin.inf.dpp.annotations.contribution.5"/> <type markerType="de.fu_berlin.inf.dpp.annotations.selection.1" name="de.fu_berlin.inf.dpp.annotations.selection.1"/> @@ -176,6 +191,97 @@ presentationLayer="7" textPreferenceValue="true" textStylePreferenceValue="NONE" + verticalRulerPreferenceValue="false"/> + + <specification + annotationType="de.fu_berlin.inf.dpp.annotations.contribution.1" + colorPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.color.1" + highlightPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.highlight.1" + overviewRulerPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.overview.1" + textPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.text.1" + textStylePreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.textstyle.1" + verticalRulerPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.ruler.1" + colorPreferenceValue="255,0,0" + contributesToHeader="false" + highlightPreferenceValue="true" + includeOnPreferencePage="true" + label="DPP User" + overviewRulerPreferenceValue="false" + presentationLayer="7" + textPreferenceValue="true" + textStylePreferenceValue="UNDERLINE" + verticalRulerPreferenceValue="false"/> + <specification + annotationType="de.fu_berlin.inf.dpp.annotations.contribution.2" + colorPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.color.2" + highlightPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.highlight.2" + overviewRulerPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.overview.2" + textPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.text.2" + textStylePreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.textstyle.2" + verticalRulerPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.ruler.2" + colorPreferenceValue="0,255,0" + contributesToHeader="false" + highlightPreferenceValue="true" + includeOnPreferencePage="true" + label="DPP User" + overviewRulerPreferenceValue="false" + presentationLayer="7" + textPreferenceValue="true" + textStylePreferenceValue="UNDERLINE" + verticalRulerPreferenceValue="false"/> + <specification + annotationType="de.fu_berlin.inf.dpp.annotations.contribution.3" + colorPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.color.3" + highlightPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.highlight.3" + overviewRulerPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.overview.3" + textPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.text.3" + textStylePreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.textstyle.3" + verticalRulerPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.ruler.3" + colorPreferenceValue="0,0,255" + contributesToHeader="false" + highlightPreferenceValue="true" + includeOnPreferencePage="true" + label="DPP User" + overviewRulerPreferenceValue="false" + presentationLayer="7" + textPreferenceValue="true" + textStylePreferenceValue="UNDERLINE" + verticalRulerPreferenceValue="false"/> + <specification + annotationType="de.fu_berlin.inf.dpp.annotations.contribution.4" + colorPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.color.4" + highlightPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.highlight.4" + overviewRulerPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.overview.4" + textPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.text.4" + textStylePreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.textstyle.4" + verticalRulerPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.ruler.4" + colorPreferenceValue="255,255,0" + contributesToHeader="false" + highlightPreferenceValue="true" + includeOnPreferencePage="true" + label="DPP User" + overviewRulerPreferenceValue="false" + presentationLayer="7" + textPreferenceValue="true" + textStylePreferenceValue="UNDERLINE" + verticalRulerPreferenceValue="false"/> + <specification + annotationType="de.fu_berlin.inf.dpp.annotations.contribution.5" + colorPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.color.5" + highlightPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.highlight.5" + overviewRulerPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.overview.5" + textPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.text.5" + textStylePreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.textstyle.5" + verticalRulerPreferenceKey="de.fu_berlin.inf.dpp.annotations.contribution.ruler.5" + colorPreferenceValue="0,255,255" + contributesToHeader="false" + highlightPreferenceValue="true" + includeOnPreferencePage="true" + label="DPP User" + overviewRulerPreferenceValue="false" + presentationLayer="7" + textPreferenceValue="true" + textStylePreferenceValue="UNDERLINE" verticalRulerPreferenceValue="false"/> <specification annotationType="de.fu_berlin.inf.dpp.annotations.selection.1" diff --git a/de.fu_berlin.inf.dpp/readme.html b/readme.html similarity index 100% rename from de.fu_berlin.inf.dpp/readme.html rename to readme.html diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/FileList.java b/src/de/fu_berlin/inf/dpp/FileList.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/FileList.java rename to src/de/fu_berlin/inf/dpp/FileList.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/MessagingManager.java b/src/de/fu_berlin/inf/dpp/MessagingManager.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/MessagingManager.java rename to src/de/fu_berlin/inf/dpp/MessagingManager.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/PreferenceConstants.java b/src/de/fu_berlin/inf/dpp/PreferenceConstants.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/PreferenceConstants.java rename to src/de/fu_berlin/inf/dpp/PreferenceConstants.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/PreferenceInitializer.java b/src/de/fu_berlin/inf/dpp/PreferenceInitializer.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/PreferenceInitializer.java rename to src/de/fu_berlin/inf/dpp/PreferenceInitializer.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/Saros.java b/src/de/fu_berlin/inf/dpp/Saros.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/Saros.java rename to src/de/fu_berlin/inf/dpp/Saros.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/SkypeManager.java b/src/de/fu_berlin/inf/dpp/SkypeManager.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/SkypeManager.java rename to src/de/fu_berlin/inf/dpp/SkypeManager.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/User.java b/src/de/fu_berlin/inf/dpp/User.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/User.java rename to src/de/fu_berlin/inf/dpp/User.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/EditorActivity.java b/src/de/fu_berlin/inf/dpp/activities/EditorActivity.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/EditorActivity.java rename to src/de/fu_berlin/inf/dpp/activities/EditorActivity.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/FileActivity.java b/src/de/fu_berlin/inf/dpp/activities/FileActivity.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/FileActivity.java rename to src/de/fu_berlin/inf/dpp/activities/FileActivity.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/FolderActivity.java b/src/de/fu_berlin/inf/dpp/activities/FolderActivity.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/FolderActivity.java rename to src/de/fu_berlin/inf/dpp/activities/FolderActivity.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/IActivity.java b/src/de/fu_berlin/inf/dpp/activities/IActivity.java similarity index 84% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/IActivity.java rename to src/de/fu_berlin/inf/dpp/activities/IActivity.java index 81a6dd7d93fcccb100632321cfff495df2ef2ed2..e600bcc5cfcd612e56b2e8876d197106221ae655 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/IActivity.java +++ b/src/de/fu_berlin/inf/dpp/activities/IActivity.java @@ -28,7 +28,15 @@ package de.fu_berlin.inf.dpp.activities; */ public interface IActivity { + /** + * set source jabber_id of producer of this IActivity. + * @param source jabber_id string + */ public void setSource(String source); + /** + * get jabber_id of remote producer + * @return jabber_id + */ public String getSource(); } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/RoleActivity.java b/src/de/fu_berlin/inf/dpp/activities/RoleActivity.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/RoleActivity.java rename to src/de/fu_berlin/inf/dpp/activities/RoleActivity.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/TextEditActivity.java b/src/de/fu_berlin/inf/dpp/activities/TextEditActivity.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/TextEditActivity.java rename to src/de/fu_berlin/inf/dpp/activities/TextEditActivity.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/TextSelectionActivity.java b/src/de/fu_berlin/inf/dpp/activities/TextSelectionActivity.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/TextSelectionActivity.java rename to src/de/fu_berlin/inf/dpp/activities/TextSelectionActivity.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/ViewportActivity.java b/src/de/fu_berlin/inf/dpp/activities/ViewportActivity.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/activities/ViewportActivity.java rename to src/de/fu_berlin/inf/dpp/activities/ViewportActivity.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/ConcurrentManager.java b/src/de/fu_berlin/inf/dpp/concurrent/ConcurrentManager.java similarity index 69% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/ConcurrentManager.java rename to src/de/fu_berlin/inf/dpp/concurrent/ConcurrentManager.java index f497937b7dd395b964703ebab7d4aaec16855169..2970b4e377764989f3b70739b293024347d70007 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/ConcurrentManager.java +++ b/src/de/fu_berlin/inf/dpp/concurrent/ConcurrentManager.java @@ -7,13 +7,15 @@ import de.fu_berlin.inf.dpp.activities.IActivity; import de.fu_berlin.inf.dpp.concurrent.jupiter.RequestForwarder; import de.fu_berlin.inf.dpp.net.IActivitySequencer; import de.fu_berlin.inf.dpp.net.JID; +import de.fu_berlin.inf.dpp.project.ISessionListener; +import de.fu_berlin.inf.dpp.project.ISharedProjectListener; /** * Interface for management controller class of all jupiter document server. * @author orieger * */ -public interface ConcurrentManager extends IRequestManager { +public interface ConcurrentManager extends IRequestManager, ISharedProjectListener { public static enum Side{ CLIENT_SIDE, @@ -26,19 +28,19 @@ public interface ConcurrentManager extends IRequestManager { public RequestForwarder getRequestForwarder(); - public void addDriver(User jid); + public void addDriver(JID jid); - public void removeDriver(User jid); + public void removeDriver(JID jid); - public List<User> getDriver(); + public List<JID> getDriver(); - public boolean isDriver(User jid); + public boolean isDriver(JID jid); public boolean isHostSide(); public boolean isHost(JID jid); - public void setHost(User jid); + public void setHost(JID jid); public IActivity activityCreated(IActivity activity); diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/IRequestManager.java b/src/de/fu_berlin/inf/dpp/concurrent/IRequestManager.java similarity index 84% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/IRequestManager.java rename to src/de/fu_berlin/inf/dpp/concurrent/IRequestManager.java index a49c3e7cbab7060287a1ed14725e16a3ec85606c..80b16496d5a965876780a38a4ccca1d363f09032 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/IRequestManager.java +++ b/src/de/fu_berlin/inf/dpp/concurrent/IRequestManager.java @@ -10,5 +10,5 @@ import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; */ public interface IRequestManager { - public IActivity receiveRequest(Request request); + public void receiveRequest(Request request); } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Algorithm.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Algorithm.java similarity index 92% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Algorithm.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/Algorithm.java index 624a0fcc8970d624a597f345314f4577863b7403..d653d190022cf10e8a51bb28e1ee7c1540a6fd00 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Algorithm.java +++ b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Algorithm.java @@ -57,5 +57,10 @@ public interface Algorithm { */ int[] transformIndices(Timestamp timestamp, int[] indices) throws TransformationException; - public Operation receiveTransformedRequest(Request req) throws TransformationException; + /** + * + * @param timestamp + * @throws TransformationException + */ + void updateVectorTime(Timestamp timestamp) throws TransformationException; } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/InclusionTransformation.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/InclusionTransformation.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/InclusionTransformation.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/InclusionTransformation.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterClient.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterClient.java similarity index 67% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterClient.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterClient.java index 5f9218647c3de3996daa2f8e54b1459a959f5712..360e93a371c72032c2a5e2c59aa9546945b195e5 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterClient.java +++ b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterClient.java @@ -13,4 +13,12 @@ public interface JupiterClient extends JupiterEditor{ * @return */ public JID getJID(); + + /** + * get the current vector time. + * @return + */ + public Timestamp getTimestamp(); + + public void updateVectorTime(Timestamp timestamp) throws TransformationException; } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterEditor.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterEditor.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterEditor.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterEditor.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterServer.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterServer.java similarity index 91% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterServer.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterServer.java index 0fcc8b1bcc953a7ecd84375a6b2f9eb896ef1f58..5ecbb91534d95e9fe0d18a204a9f678fffdbb12d 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterServer.java +++ b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/JupiterServer.java @@ -25,5 +25,8 @@ public interface JupiterServer extends SynchronizedQueue, RequestForwarder, Jupi * @return */ public boolean isExist(JID jid); + + + public void updateVectorTime(JID source, JID dest); } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Operation.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Operation.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Operation.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/Operation.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/OperationSerializer.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/OperationSerializer.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/OperationSerializer.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/OperationSerializer.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Request.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Request.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Request.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/Request.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/RequestForwarder.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/RequestForwarder.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/RequestForwarder.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/RequestForwarder.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/SynchronizedQueue.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/SynchronizedQueue.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/SynchronizedQueue.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/SynchronizedQueue.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Timestamp.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Timestamp.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/Timestamp.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/Timestamp.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/TimestampFactory.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/TimestampFactory.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/TimestampFactory.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/TimestampFactory.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/TransformationException.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/TransformationException.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/TransformationException.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/TransformationException.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/VectorTime.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/VectorTime.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/VectorTime.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/VectorTime.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/Jupiter.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/Jupiter.java similarity index 95% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/Jupiter.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/Jupiter.java index 9c6864d84538850e9d7efc8aaf730c44c71b05a9..5a3009370585b5858a2877b4fa8069c11d183003 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/Jupiter.java +++ b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/Jupiter.java @@ -127,22 +127,6 @@ public class Jupiter implements Algorithm { return newOp; } - public Operation receiveTransformedRequest(Request req) throws TransformationException{ - Timestamp timestamp = req.getTimestamp(); - if (!(timestamp instanceof JupiterVectorTime)) { - throw new IllegalArgumentException("Jupiter expects timestamps of type JupiterVectorTime"); - } - //TODO: check preconditions -// try{ - checkPreconditions((JupiterVectorTime) timestamp); -// }catch(TransformationException e){ -// logger.warn(e); -// } - discardAcknowledgedOperations((JupiterVectorTime) timestamp); - vectorTime.incrementRemoteRequestCount(); - return req.getOperation(); - } - /** * @see de.fu_berlin.inf.dpp.concurrent.jupiter.Algorithm#acknowledge(int, de.fu_berlin.inf.dpp.concurrent.jupiter.Timestamp) */ @@ -375,5 +359,15 @@ public class Jupiter implements Algorithm { public boolean isClientSide() { return isClientSide; } + + public void updateVectorTime(Timestamp timestamp) throws TransformationException{ + if(ackRequestList.size()> 0){ + throw new TransformationException("ackRequestList have entries. Update Vector time failed."); + } + int local = timestamp.getComponents()[0]; + int remote = timestamp.getComponents()[1]; + this.vectorTime = new JupiterVectorTime(local, remote); + + } } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentClient.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentClient.java similarity index 88% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentClient.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentClient.java index f0b1128b5a271883a3c8536ab38ff16c1b0a61f5..23e7f9a59c421fca0ee82dd62b89900b7e9c7db6 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentClient.java +++ b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentClient.java @@ -8,6 +8,7 @@ import de.fu_berlin.inf.dpp.concurrent.jupiter.JupiterClient; import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; import de.fu_berlin.inf.dpp.concurrent.jupiter.RequestForwarder; +import de.fu_berlin.inf.dpp.concurrent.jupiter.Timestamp; import de.fu_berlin.inf.dpp.concurrent.jupiter.TransformationException; import de.fu_berlin.inf.dpp.net.JID; @@ -71,5 +72,13 @@ public class JupiterDocumentClient implements JupiterClient { } + public Timestamp getTimestamp() { + return jupiter.getTimestamp(); + } + + public void updateVectorTime(Timestamp timestamp) throws TransformationException { + jupiter.updateVectorTime(timestamp); + } + } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentServer.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentServer.java similarity index 87% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentServer.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentServer.java index 3c1e766d5adb4effac4786c4b0f86b31f672c8ab..f0e5cb640f6fed2a4ba8c046e5d9a403e2f8a166 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentServer.java +++ b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterDocumentServer.java @@ -14,6 +14,8 @@ import de.fu_berlin.inf.dpp.concurrent.jupiter.JupiterServer; import de.fu_berlin.inf.dpp.concurrent.jupiter.OperationSerializer; import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; import de.fu_berlin.inf.dpp.concurrent.jupiter.RequestForwarder; +import de.fu_berlin.inf.dpp.concurrent.jupiter.Timestamp; +import de.fu_berlin.inf.dpp.concurrent.jupiter.TransformationException; import de.fu_berlin.inf.dpp.concurrent.management.OutgoingMessageForwarder; import de.fu_berlin.inf.dpp.net.JID; @@ -46,6 +48,10 @@ public class JupiterDocumentServer implements JupiterServer{ // /** counter for remove client synchronization.*/ // public int requestSyncCounter = 0; + /** + * this forwarder reads request form the local outgoing queue and transmit + * the requests to the global outgoing queue. + */ class RequestTransmitter extends Thread{ private final RequestForwarder rf; @@ -151,7 +157,7 @@ public class JupiterDocumentServer implements JupiterServer{ */ public synchronized Request getNextRequestInSynchronizedQueue() throws InterruptedException { /* if queue is empty or proxy managing action is running. */ - if(!(requestList.size() > 0)){ + while(!(requestList.size() > 0)){ wait(); } logger.debug("read out next request in queue! "+requestList.get(0).getJID()+requestList.get(0)); @@ -227,6 +233,24 @@ public class JupiterDocumentServer implements JupiterServer{ return false; } + public void updateVectorTime(JID source, JID dest) { + JupiterClient proxy = proxies.get(source); + if(proxy != null){ + try { + Timestamp ts = proxy.getTimestamp(); + getProxies().get(dest).updateVectorTime(new JupiterVectorTime(ts.getComponents()[1],ts.getComponents()[0])); + } catch (TransformationException e) { + logger.error("Error during update vector time for "+dest,e); + } catch (InterruptedException e) { + logger.error("Error during update vector time for "+dest,e); + } + } + else{ + logger.error("No proxy found for given source jid: "+source); + } + + } + /* end transfer section */ diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterTimestampFactory.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterTimestampFactory.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterTimestampFactory.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterTimestampFactory.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterVectorTime.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterVectorTime.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterVectorTime.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/JupiterVectorTime.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/ProxyJupiterDocument.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/ProxyJupiterDocument.java similarity index 89% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/ProxyJupiterDocument.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/ProxyJupiterDocument.java index e4660299ec8a074e17aa2729c2e917ee09f06516..d4e12fb0fdc50f3118256a2e0b48c405e1be7dea 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/ProxyJupiterDocument.java +++ b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/ProxyJupiterDocument.java @@ -9,6 +9,7 @@ import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; import de.fu_berlin.inf.dpp.concurrent.jupiter.RequestForwarder; import de.fu_berlin.inf.dpp.concurrent.jupiter.SynchronizedQueue; +import de.fu_berlin.inf.dpp.concurrent.jupiter.Timestamp; import de.fu_berlin.inf.dpp.concurrent.jupiter.TransformationException; import de.fu_berlin.inf.dpp.net.JID; @@ -75,7 +76,16 @@ public class ProxyJupiterDocument implements JupiterClient{ public void setEditor(IPath path) { this.editor = path; - + } + + + public Timestamp getTimestamp() { + return jupiter.getTimestamp(); + } + + + public void updateVectorTime(Timestamp timestamp) throws TransformationException{ + jupiter.updateVectorTime(timestamp); } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/RequestImpl.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/RequestImpl.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/RequestImpl.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/RequestImpl.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/Serializer.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/Serializer.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/Serializer.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/Serializer.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/DeleteOperation.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/DeleteOperation.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/DeleteOperation.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/DeleteOperation.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/GOTOInclusionTransformation.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/GOTOInclusionTransformation.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/GOTOInclusionTransformation.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/GOTOInclusionTransformation.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/InsertOperation.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/InsertOperation.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/InsertOperation.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/InsertOperation.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/NoOperation.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/NoOperation.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/NoOperation.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/NoOperation.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/SplitOperation.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/SplitOperation.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/SplitOperation.java rename to src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/SplitOperation.java diff --git a/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/TimestampOperation.java b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/TimestampOperation.java new file mode 100644 index 0000000000000000000000000000000000000000..47695dcc89bf236f0e21c81d2612d24a63890756 --- /dev/null +++ b/src/de/fu_berlin/inf/dpp/concurrent/jupiter/internal/text/TimestampOperation.java @@ -0,0 +1,95 @@ +package de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text; + +import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; + +/** + * This operation update have new vector time for the algorithm. + * @author orieger + * + */ + +public class TimestampOperation implements Operation{ + + /** + * + */ + private static final long serialVersionUID = 2756378905499193184L; + + + /** + * Returns the position. + * + * @return the position + */ + public int getPosition() { + return 0; + } + + /** + * Sets the position of this operation. + * + * @param position + * the position to set + */ + public void setPosition(int position) { + throw new UnsupportedOperationException(); + } + + /** + * Returns the text length. + * + * @return the length of the text + */ + public int getTextLength() { + return 0; + } + + /** + * Returns the text to be deleted. + * + * @return the text to be deleted + */ + public String getText() { + return ""; + } + + /** + * Sets the text to be deleted. + * + * @param text + * the text to be deleted + */ + public void setText(String text) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public String toString() { + return "Timestamp(0,'')"; + } + + /** + * {@inheritDoc} + */ + public boolean equals(Object obj) { + if (obj == this) { + return true; + } else if (obj == null) { + return false; + } else if (obj.getClass().equals(getClass())) { + return true; + } else { + return false; + } + } + + /** + * {@inheritDoc} + */ + public int hashCode() { + int hashcode = 38; + return hashcode; + } +} diff --git a/src/de/fu_berlin/inf/dpp/concurrent/management/ConcurrentDocumentManager.java b/src/de/fu_berlin/inf/dpp/concurrent/management/ConcurrentDocumentManager.java new file mode 100644 index 0000000000000000000000000000000000000000..f2e4e49b34db5604817cc7d04a21ddf0c32b51b8 --- /dev/null +++ b/src/de/fu_berlin/inf/dpp/concurrent/management/ConcurrentDocumentManager.java @@ -0,0 +1,632 @@ +package de.fu_berlin.inf.dpp.concurrent.management; + +import java.util.HashMap; +import java.util.List; +import java.util.Vector; + +import org.apache.log4j.Logger; +import org.eclipse.core.runtime.IPath; + +import de.fu_berlin.inf.dpp.User; +import de.fu_berlin.inf.dpp.activities.EditorActivity; +import de.fu_berlin.inf.dpp.activities.IActivity; +import de.fu_berlin.inf.dpp.activities.TextEditActivity; +import de.fu_berlin.inf.dpp.activities.EditorActivity.Type; +import de.fu_berlin.inf.dpp.concurrent.ConcurrentManager; +import de.fu_berlin.inf.dpp.concurrent.jupiter.JupiterClient; +import de.fu_berlin.inf.dpp.concurrent.jupiter.JupiterServer; +import de.fu_berlin.inf.dpp.concurrent.jupiter.Operation; +import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; +import de.fu_berlin.inf.dpp.concurrent.jupiter.RequestForwarder; +import de.fu_berlin.inf.dpp.concurrent.jupiter.Timestamp; +import de.fu_berlin.inf.dpp.concurrent.jupiter.TransformationException; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.JupiterDocumentClient; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.JupiterDocumentServer; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.JupiterTimestampFactory; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.JupiterVectorTime; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.RequestImpl; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.SplitOperation; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.TimestampOperation; +import de.fu_berlin.inf.dpp.invitation.IIncomingInvitationProcess; +import de.fu_berlin.inf.dpp.net.IActivitySequencer; +import de.fu_berlin.inf.dpp.net.JID; +import de.fu_berlin.inf.dpp.project.IActivityListener; +import de.fu_berlin.inf.dpp.project.IActivityManager; +import de.fu_berlin.inf.dpp.project.IActivityProvider; +import de.fu_berlin.inf.dpp.project.ISessionListener; +import de.fu_berlin.inf.dpp.project.ISharedProject; + +public class ConcurrentDocumentManager implements ConcurrentManager { + + private static Logger logger = Logger.getLogger(Logger.class); + + /** Jupiter server instance documents */ + private HashMap<IPath, JupiterDocumentServer> concurrentDocuments; + + /** current open editor at client side. */ + private HashMap<IPath, JupiterClient> clientDocs; + + private List<JID> drivers; + + private JID host; + + private JID myJID; + + private Side side; + + private RequestForwarder forwarder; + + private IActivitySequencer sequencer; + + public ConcurrentDocumentManager(Side side, User host, JID myJID) { + + if (side == Side.HOST_SIDE) { + concurrentDocuments = new HashMap<IPath, JupiterDocumentServer>(); + } + + this.clientDocs = new HashMap<IPath, JupiterClient>(); + drivers = new Vector<JID>(); + this.side = side; + this.host = host.getJid(); + this.myJID = myJID; + } + + public void setActivitySequencer(IActivitySequencer sequencer) { + this.sequencer = sequencer; + } + + public void setRequestForwarder(RequestForwarder f) { + this.forwarder = f; + } + + public RequestForwarder getRequestForwarder() { + return this.forwarder; + } + + public void addDriver(JID jid) { + drivers.add(jid); + } + + public void removeDriver(JID jid) { + drivers.remove(jid); + } + + public List<JID> getDriver() { + + return drivers; + } + + public boolean isDriver(JID jid) { + return drivers.contains(jid); + } + + /** + * + */ + public IActivity activityCreated(IActivity activity) { + + // editorActivitiy(activity, true); + + editorActivitiy(activity); + + if (createdTextEditActivity(activity)) { + /* handled by jupiter and is sended by request transmitting. */ + return null; + } + return activity; + } + + /** + * handled closed editor activity to remove the local jupiter clients. + * + * @param activity + */ + private void editorActivitiy(IActivity activity) { + if (activity instanceof EditorActivity) { + EditorActivity editor = (EditorActivity) activity; + + if (!isHostSide()) { + if (editor.getType() == Type.Closed) { + // TODO: closing jupiter client for this document. + } + } + + } + } + + /** + * handles text edit activities with jupiter. + * + * @param activity + * @return true if activity is transformed with jupiter. + */ + private boolean createdTextEditActivity(IActivity activity) { + + if (activity instanceof TextEditActivity) { + TextEditActivity textEdit = (TextEditActivity) activity; + // if (!isHostSide()) { + /** + * lokal erzeugte operation beim client 1. Aufruf von + * generateRequest beim client. Änderungen wurden bereits im Editor + * geschrieben. 2. versenden der Änderungen an Server (später) + */ + JupiterClient jupClient = null; + /* no jupiter client already exists for this editor text edit */ + if (!clientDocs.containsKey(textEdit.getEditor())) { + jupClient = new JupiterDocumentClient(this.myJID, + this.forwarder); + jupClient.setEditor(textEdit.getEditor()); + clientDocs.put(textEdit.getEditor(), jupClient); + } + + /* generate request. */ + jupClient = clientDocs.get(textEdit.getEditor()); + if (jupClient != null) { + Operation op = getOperation(textEdit); + /* sync with local jupiter client */ + Request req = jupClient.generateRequest(op); + + /* already set and forward inside of jup client. */ + // /* add appropriate Editor path. */ + // req.setEditorPath(textEdit.getEditor()); + // /* transmit request */ + // forwarder.forwardOutgoingRequest(req); + return true; + } + // } + } + return false; + } + + private void execTextEditActivity(Request request) { + + // if (!isHostSide()) { + /** + * lokal erzeugte operation beim client 1. Aufruf von generateRequest + * beim client. Änderungen wurden bereits im Editor geschrieben. 2. + * versenden der Änderungen an Server (später) + */ + JupiterClient jupClient = null; + /* no jupiter client already exists for this editor text edit */ + if (!clientDocs.containsKey(request.getEditorPath())) { + jupClient = new JupiterDocumentClient(this.myJID, this.forwarder); + jupClient.setEditor(request.getEditorPath()); + clientDocs.put(request.getEditorPath(), jupClient); + } + + /* generate request. */ + jupClient = clientDocs.get(request.getEditorPath()); + if (jupClient != null) { + /* operational transformation. */ + Operation op; + try { + op = jupClient.receiveRequest(request); + } catch (TransformationException e) { + logger.error("Error during transformation: ", e); + return; + } + + for (TextEditActivity textEdit : getTextEditActivity(op)) { + textEdit.setEditor(request.getEditorPath()); + textEdit.setSource(request.getJID().toString()); + /* execute activity in activity sequencer. */ + sequencer.execTransformedActivity(textEdit); + } + // return textEdit; + } + // } + // return null; + } + + public IActivity exec(IActivity activity) { + + if (activity instanceof EditorActivity) { + EditorActivity editorAc = (EditorActivity) activity; + + if (isHostSide()) { + JID sourceJID = new JID(editorAc.getSource()); + + /* if one driver activate a new editor. */ + if (drivers.contains(sourceJID) + && (editorAc.getType() == Type.Activated || editorAc + .getType() == Type.Closed)) { + /* start jupiter proxy for this driver. */ + if (concurrentDocuments.containsKey(editorAc.getPath())) { + JupiterServer server = concurrentDocuments.get(editorAc + .getPath()); + + /* client has no proxy for this editor. */ + if (!server.isExist(sourceJID)) { + if (editorAc.getType() == Type.Activated) { + server.addProxyClient(sourceJID); + /* update vector time for new proxy. */ + // TODO: stop serializer and after this update + // vector time. + server.updateVectorTime(myJID, sourceJID); + // TODO: forward vector time method. + + /* get vector time of host for this editor path. */ + try { + + JupiterClient jupC = clientDocs.get(editorAc.getPath()); + if(jupC != null){ + Timestamp ts = jupC.getTimestamp(); + + /* create update vector time request. */ + Request updateRequest = new RequestImpl(0, + new JupiterVectorTime(ts + .getComponents()[1], ts + .getComponents()[0]), + new TimestampOperation()); + updateRequest.setEditorPath(editorAc + .getPath()); + updateRequest.setJID(sourceJID); + + forwarder + .forwardOutgoingRequest(updateRequest); + } + } catch (Exception e) { + + logger + .error("Error during get timestamp of host proxy for " + + editorAc.getPath(),e); + } + } + } else { + /* remove proxy for this jid. */ + if (editorAc.getType() == Type.Closed) { + server.removeProxyClient(sourceJID); + } + } + } else { + /* create new jupiter proxy client. */ + if (editorAc.getType() == Type.Activated) { + Request createRequest = new RequestImpl(0, + new JupiterVectorTime(0, 0), + new TimestampOperation()); + createRequest.setEditorPath(editorAc.getPath()); + createRequest.setJID(sourceJID); + + + } + } + } + } + } + + if (activity instanceof TextEditActivity) { + // check for jupiter client documents + TextEditActivity text = (TextEditActivity) activity; + if (clientDocs.containsKey(text.getEditor())) { + /* activity have to be transformed with jupiter on this client. */ + return null; + } + } + + return activity; + } + + public boolean isHostSide() { + if (side == Side.HOST_SIDE) { + return true; + } + return false; + } + + public boolean isHost(JID jid) { + if (jid.equals(host)) { + return true; + } + return false; + } + + public void setHost(JID host) { + this.host = host; + } + + /** + * convert TextEditActivity to Operation op + * + * @param text + * @return + */ + public Operation getOperation(TextEditActivity text) { + + Operation op = null; + // delete activity + if (text.replace > 0 && text.text.length() == 0) { + /* string placeholder in length of delete area. */ + String placeholder = ""; + for (int i = 0; i < text.replace; i++) { + placeholder += 1; + } + op = new DeleteOperation(text.offset, placeholder); + } + // insert activity + if (text.replace == 0 && text.text.length() > 0) { + op = new InsertOperation(text.offset, text.text); + } + // replace operation has to split into delete and insert operation + if(text.replace > 0 && text.text.length() > 0){ + /* string placeholder in length of delete area. */ + String placeholder = ""; + for (int i = 0; i < text.replace; i++) { + placeholder += 1; + } + op = new SplitOperation(new DeleteOperation(text.offset,placeholder),new InsertOperation(text.offset,text.text)); + } + return op; + } + + /** + * Convert Operation op to text edit activity. NoOperation will ignore. + * + * @param op + * incoming transformed operation. + * @return List with executable text edit activities. + */ + public List<TextEditActivity> getTextEditActivity(Operation op) { + List<TextEditActivity> result = new Vector<TextEditActivity>(); + TextEditActivity textEdit = null; + if (op instanceof DeleteOperation) { + DeleteOperation del = (DeleteOperation) op; + textEdit = new TextEditActivity(del.getPosition(), "", del + .getTextLength()); + result.add(textEdit); + } + if (op instanceof InsertOperation) { + InsertOperation ins = (InsertOperation) op; + textEdit = new TextEditActivity(ins.getPosition(), ins.getText(), 0); + result.add(textEdit); + } + if (op instanceof SplitOperation) { + SplitOperation split = (SplitOperation) op; + TextEditActivity op1 = getTextEditActivity(split.getFirst()).get(0); + TextEditActivity op2 = getTextEditActivity(split.getSecond()) + .get(0); + + /* + * if operation one is delete operation the offset of second + * operation has to modified. + */ + if (op1.replace > 0 && op1.text.length() == 0 && op2.replace > 0 && op2.text.length() == 0) { + op2 = new TextEditActivity(op2.offset - op1.replace, "", + op2.replace); + } + result.add(op1); + result.add(op2); + } + + return result; + } + + // private void editorActivitiy(IActivity activity, boolean local) { + // if (!isHostSide() || local) { + // if (activity instanceof EditorActivity) { + // EditorActivity editor = (EditorActivity) activity; + // /* if new editor opened */ + // if (editor.getType() == Type.Activated) { + // /* no jupiter client exists for this editor */ + // if (!clientDocs.containsKey(editor.getPath())) { + // // TODO: add Request forwarder + // JupiterClient jupiter = new JupiterDocumentClient( + // myJID, null); + // jupiter.setEditor(editor.getPath()); + // /* add to current docs */ + // clientDocs.put(editor.getPath(), jupiter); + // } + // // send EditorActivity to project host. + // + // } + // if (editor.getType() == Type.Closed) { + // /* remove editor form jupiter concurrent mechanism. */ + // if (clientDocs.containsKey(editor.getPath())) { + // clientDocs.remove(editor.getPath()); + // } + // } + // } + // } + // /* managing of jupiter server documents. */ + // if (isHostSide()) { + // /* Editor activities. */ + // if (activity instanceof EditorActivity) { + // EditorActivity editor = (EditorActivity) activity; + // /* if new editor opened */ + // if (editor.getType() == Type.Activated) { + // /* create new jupiter document server. */ + // if (!concurrentDocuments.containsKey(editor.getPath())) { + // JupiterDocumentServer jup = new JupiterDocumentServer( + // forwarder); + // jup.setEditor(editor.getPath()); + // + // /* create host proxy */ + // jup.addProxyClient(host.getJid()); + // /* create client proxy if remote activity. */ + // if (!local) { + // jup.addProxyClient(new JID(editor.getSource())); + // } + // /* add to server list. */ + // concurrentDocuments.put(editor.getPath(), jup); + // + // /* + // * create host jupiter client for local request + // * handling. + // */ + // if (!clientDocs.containsKey(editor.getPath())) { + // JupiterClient jupiter = new JupiterDocumentClient( + // myJID, null); + // jupiter.setEditor(editor.getPath()); + // } + // + // } + // } + // /* if document closed. */ + // if (editor.getType() == Type.Closed) { + // if (!local) { + // /* remove remote client from proxy list. */ + // JupiterDocumentServer serverDoc = concurrentDocuments + // .get(editor.getPath()); + // if (serverDoc != null) { + // /* remove remote client. */ + // serverDoc.removeProxyClient(new JID(editor + // .getSource())); + // /* TODO: if only host is exists. */ + // // if(serverDoc.getProxies().size() == 1){ + // // + // // } + // } + // } + // } + // } + // } + // } + + /* + * 1. hinzufügen und löschen von jupiter servern 2. list mit transmitter + * threads, die Nachrichten aus den outgoing queues versenden. 3. + * Schnittstelle vom Itransmitter zu den einzelnen jupiter document servern, + * um die Nachrichten vom Itransmitter weiterzuleiten. + * + * + */ + + /** + * sync received request with right jupiter server document and local + * client. + * + */ + public void receiveRequest(Request request) { + + /* 1. Sync with jupiter server component. */ + if (isHostSide()) { + + /* if host side and server jupiter side of request */ + if (isHost(request.getJID()) && request.getSiteId() == 0) { + /* request already has transformed and have to be execute. */ + // return execTextEditActivity(request); + execTextEditActivity(request); + return; + } + + JupiterDocumentServer docServer = null; + /** + * if no jupiter document server exists. + */ + if (!concurrentDocuments.containsKey(request.getEditorPath())) { + /* create new document server. */ + docServer = new JupiterDocumentServer(forwarder); + // docServer = new JupiterDocumentServer(); + docServer.setEditor(request.getEditorPath()); + /* create new local host document client. */ + docServer.addProxyClient(host); + if (!isHost(request.getJID())) { + docServer.addProxyClient(request.getJID()); + } + concurrentDocuments.put(request.getEditorPath(), docServer); + } + docServer = concurrentDocuments.get(request.getEditorPath()); + try { + /* check if sender id exists in proxy list. */ + if (!docServer.getProxies().containsKey(request.getJID())) { + docServer.addProxyClient(request.getJID()); + } + } catch (InterruptedException ie) { + logger.error("Error during get proxy list of jupiter server.", + ie); + } + + /* sync request with jupiter document server. */ + docServer.addRequest(request); + + return; + } else { + /* update timestamp of local jupiter client. */ + if (request.getOperation() instanceof TimestampOperation) { + if (clientDocs.containsKey(request.getEditorPath())) { + logger.info("update vector time : " + + request.getEditorPath()); + JupiterClient jupClient = clientDocs.get(request + .getEditorPath()); + try { + jupClient.updateVectorTime(request.getTimestamp()); + } catch (TransformationException e) { + logger.error("Error during update jupiter client for " + + request.getEditorPath(), e); + } + } + else{ + /* if no jupiter client exists.*/ + JupiterClient client = new JupiterDocumentClient(this.myJID, this.forwarder); + client.setEditor(request.getEditorPath()); + try { + client.updateVectorTime(request.getTimestamp()); + clientDocs.put(request.getEditorPath(), client); + } catch (TransformationException e) { + logger.error("Error during update jupiter client for " + + request.getEditorPath(), e); + } + + } + } + else{ + + /* + * 2. receive request in local client component and return the + * transformed operation as IActivity. + */ + execTextEditActivity(request); + // return execTextEditActivity(request); + } + } + } + + public void driverChanged(JID driver, boolean replicated) { + /* + * 1. check if driver exists. 2. add new driver or remove driver. 3. + */ + // HOST + if (isHostSide()) { + /* if driver changed to observer */ + if (drivers.contains(driver)) { + userLeft(driver); + } + /* new driver added to project. */ + else { + drivers.add(driver); + //TODO: add driver to current open document proxy ? + } + } + // CLIENT + else { + if (driver.equals(myJID)) { + clientDocs.clear(); + } + } + + } + + public void userJoined(JID user) { + // do nothing + + } + + public void userLeft(JID user) { + if (isHostSide()) { + /* remove user from driver list */ + drivers.remove(user); + + /* remove user proxies from jupiter server. */ + for (JupiterServer server : concurrentDocuments.values()) { + if (server.isExist(user)) { + server.removeProxyClient(user); + + /* if only host has an proxy */ + + } + } + } + } + +} diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/management/OutgoingMessageForwarder.java b/src/de/fu_berlin/inf/dpp/concurrent/management/OutgoingMessageForwarder.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/concurrent/management/OutgoingMessageForwarder.java rename to src/de/fu_berlin/inf/dpp/concurrent/management/OutgoingMessageForwarder.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/EditorManager.java b/src/de/fu_berlin/inf/dpp/editor/EditorManager.java similarity index 96% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/EditorManager.java rename to src/de/fu_berlin/inf/dpp/editor/EditorManager.java index 20079efb724b787108bc9138dde34edfca687b23..e989f13b9bd116932c246766308fa932f568edb2 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/EditorManager.java +++ b/src/de/fu_berlin/inf/dpp/editor/EditorManager.java @@ -508,8 +508,8 @@ public class EditorManager implements IActivityProvider, ISharedProjectListener file = sharedProject.getProject().getFile(textEdit.getEditor()); } String text = fixDelimiters(file, textEdit.text); - replaceText(file, textEdit.offset, textEdit.replace, text); - + replaceText(file, textEdit.offset, textEdit.replace, text,textEdit.getSource()); + Set<IEditorPart> editors = editorPool.getEditors(driverEditor); for (IEditorPart editorPart : editors) { editorAPI.setSelection(editorPart, @@ -705,7 +705,7 @@ public class EditorManager implements IActivityProvider, ISharedProjectListener return (sharedProject != null && resource.getProject() == sharedProject.getProject()); } - private void replaceText(IFile file, int offset, int replace, String text) { + private void replaceText(IFile file, int offset, int replace, String text, String source) { FileEditorInput input = new FileEditorInput(file); IDocumentProvider provider = editorAPI.getDocumentProvider(input); @@ -719,7 +719,7 @@ public class EditorManager implements IActivityProvider, ISharedProjectListener doc.replace(offset, replace, text); IAnnotationModel model = provider.getAnnotationModel(input); - ContributionHelper.insertAnnotation(model, offset, text.length()); + ContributionHelper.insertAnnotation(model, offset, text.length(),source); // Don't disconnect from provider yet, because otherwise the text // changes would be lost. We only disconnect when the document is diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/ISharedEditorListener.java b/src/de/fu_berlin/inf/dpp/editor/ISharedEditorListener.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/ISharedEditorListener.java rename to src/de/fu_berlin/inf/dpp/editor/ISharedEditorListener.java diff --git a/src/de/fu_berlin/inf/dpp/editor/annotations/AnnotationSaros.java b/src/de/fu_berlin/inf/dpp/editor/annotations/AnnotationSaros.java new file mode 100644 index 0000000000000000000000000000000000000000..5ab66c69958105972794bf7160c33f932d6a88b4 --- /dev/null +++ b/src/de/fu_berlin/inf/dpp/editor/annotations/AnnotationSaros.java @@ -0,0 +1,55 @@ +package de.fu_berlin.inf.dpp.editor.annotations; + +import org.eclipse.jface.text.source.Annotation; + +import de.fu_berlin.inf.dpp.Saros; +import de.fu_berlin.inf.dpp.User; +import de.fu_berlin.inf.dpp.net.JID; + +public class AnnotationSaros extends Annotation { + + private String source; + + AnnotationSaros(String type, boolean isPersistent, String text, String source) { + super(type, isPersistent, text); + this.source=source; + + if( +// type.equals(ContributionAnnotation.TYPE) +// || + type.equals(SelectionAnnotation.TYPE)){ + + // TODO: improve color assingment and dynamic handling + int colorid=getColorIdForUser(source) +1; + String mytype=type + "." + new Integer(colorid).toString(); + + setType(mytype); + } + } + + AnnotationSaros(String type, boolean isPersistent, String text) { + super(type, isPersistent, text); + this.source=null; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + protected int getColorIdForUser(String username){ + User user= Saros.getDefault().getSessionManager().getSharedProject(). + getParticipant(new JID(username)); + + int colorid=1; + if (user!=null) { + colorid=user.getColorID(); + } + + return colorid; + } + +} diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/annotations/ContributionAnnotation.java b/src/de/fu_berlin/inf/dpp/editor/annotations/ContributionAnnotation.java similarity index 95% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/annotations/ContributionAnnotation.java rename to src/de/fu_berlin/inf/dpp/editor/annotations/ContributionAnnotation.java index 4ea670c6f616bd674876b028863c20e2c4e48fff..5ea72ec92eb8e2f1fe5e294e35419eadb423d861 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/annotations/ContributionAnnotation.java +++ b/src/de/fu_berlin/inf/dpp/editor/annotations/ContributionAnnotation.java @@ -14,5 +14,6 @@ public class ContributionAnnotation extends AnnotationSaros { public ContributionAnnotation(String label, String source) { super(TYPE, false, label, source); + } } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/annotations/SelectionAnnotation.java b/src/de/fu_berlin/inf/dpp/editor/annotations/SelectionAnnotation.java similarity index 53% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/annotations/SelectionAnnotation.java rename to src/de/fu_berlin/inf/dpp/editor/annotations/SelectionAnnotation.java index f4b7f8eb3aae54e0336ba6b923260b15ae20cf37..4650ed307eb2f81546b127495ce6a2af3364e33a 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/annotations/SelectionAnnotation.java +++ b/src/de/fu_berlin/inf/dpp/editor/annotations/SelectionAnnotation.java @@ -20,24 +20,9 @@ public class SelectionAnnotation extends AnnotationSaros { } public SelectionAnnotation(String label, String username) { - super(TYPE, false, label,username); + super(TYPE, false, label,username); - // TODO: improve color assingment and dynamic handling - int colorid=getColorIdForUser(username) +1; - String mytype=TYPE + "." + new Integer(colorid).toString(); - - setType(mytype); } - int getColorIdForUser(String username){ - User user= Saros.getDefault().getSessionManager().getSharedProject(). - getParticipant(new JID(username)); - int colorid=1; - if (user!=null) { - colorid=user.getColorID(); - } - - return colorid; - } } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/annotations/ViewportAnnotation.java b/src/de/fu_berlin/inf/dpp/editor/annotations/ViewportAnnotation.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/annotations/ViewportAnnotation.java rename to src/de/fu_berlin/inf/dpp/editor/annotations/ViewportAnnotation.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/internal/ContributionHelper.java b/src/de/fu_berlin/inf/dpp/editor/internal/ContributionHelper.java similarity index 63% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/internal/ContributionHelper.java rename to src/de/fu_berlin/inf/dpp/editor/internal/ContributionHelper.java index 1dd0614dff4e78d4455db538a8b137f0f5ce20c5..9e044f6f5b3567e973b5c8b6cbfc37ed71dfdebe 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/internal/ContributionHelper.java +++ b/src/de/fu_berlin/inf/dpp/editor/internal/ContributionHelper.java @@ -40,6 +40,29 @@ public class ContributionHelper { } } + /** + * Inserts a contribution annotation to given model if there is not already + * a contribution annotation at given position. This method should be called + * after the text has changed. + */ + public static void insertAnnotation(IAnnotationModel model, int offset, int length, String source) { + for (Iterator it = model.getAnnotationIterator(); it.hasNext();) { + Annotation annotation = (Annotation) it.next(); + + if (!annotation.getType().equals(ContributionAnnotation.TYPE)) + continue; + + if (model.getPosition(annotation).includes(offset)) + return; + } + + if (length > 0) { + Position position = new Position(offset, length); + AnnotationSaros annotation = new ContributionAnnotation("",source); + model.addAnnotation(annotation, position); + } + } + /** * Splits the contribution annotation at given position, so that the * following text change won't expand the annotation. This needs to be @@ -59,8 +82,9 @@ public class ContributionHelper { Position pos2 = new Position(offset, pos.length - (offset - pos.offset)); model.removeAnnotation(annotation); - model.addAnnotation(new ContributionAnnotation(), pos1); - model.addAnnotation(new ContributionAnnotation(), pos2); + /* get source information and create an split annotation.*/ + model.addAnnotation(new ContributionAnnotation("",((ContributionAnnotation)annotation).getSource()), pos1); + model.addAnnotation(new ContributionAnnotation("",((ContributionAnnotation)annotation).getSource()), pos2); } } } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/internal/EditorAPI.java b/src/de/fu_berlin/inf/dpp/editor/internal/EditorAPI.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/internal/EditorAPI.java rename to src/de/fu_berlin/inf/dpp/editor/internal/EditorAPI.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/internal/IEditorAPI.java b/src/de/fu_berlin/inf/dpp/editor/internal/IEditorAPI.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/internal/IEditorAPI.java rename to src/de/fu_berlin/inf/dpp/editor/internal/IEditorAPI.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/internal/SharedDocumentProvider.java b/src/de/fu_berlin/inf/dpp/editor/internal/SharedDocumentProvider.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/editor/internal/SharedDocumentProvider.java rename to src/de/fu_berlin/inf/dpp/editor/internal/SharedDocumentProvider.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/IIncomingInvitationProcess.java b/src/de/fu_berlin/inf/dpp/invitation/IIncomingInvitationProcess.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/IIncomingInvitationProcess.java rename to src/de/fu_berlin/inf/dpp/invitation/IIncomingInvitationProcess.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/IInvitationProcess.java b/src/de/fu_berlin/inf/dpp/invitation/IInvitationProcess.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/IInvitationProcess.java rename to src/de/fu_berlin/inf/dpp/invitation/IInvitationProcess.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/IOutgoingInvitationProcess.java b/src/de/fu_berlin/inf/dpp/invitation/IOutgoingInvitationProcess.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/IOutgoingInvitationProcess.java rename to src/de/fu_berlin/inf/dpp/invitation/IOutgoingInvitationProcess.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/internal/IncomingInvitationProcess.java b/src/de/fu_berlin/inf/dpp/invitation/internal/IncomingInvitationProcess.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/internal/IncomingInvitationProcess.java rename to src/de/fu_berlin/inf/dpp/invitation/internal/IncomingInvitationProcess.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/internal/InvitationProcess.java b/src/de/fu_berlin/inf/dpp/invitation/internal/InvitationProcess.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/internal/InvitationProcess.java rename to src/de/fu_berlin/inf/dpp/invitation/internal/InvitationProcess.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/internal/OutgoingInvitationProcess.java b/src/de/fu_berlin/inf/dpp/invitation/internal/OutgoingInvitationProcess.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/invitation/internal/OutgoingInvitationProcess.java rename to src/de/fu_berlin/inf/dpp/invitation/internal/OutgoingInvitationProcess.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IActivitySequencer.java b/src/de/fu_berlin/inf/dpp/net/IActivitySequencer.java similarity index 82% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IActivitySequencer.java rename to src/de/fu_berlin/inf/dpp/net/IActivitySequencer.java index e047e39744ab6b764f699e671dd11ac48d746092..4d18350180c78aa056a914dbaee871e9eb622336 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IActivitySequencer.java +++ b/src/de/fu_berlin/inf/dpp/net/IActivitySequencer.java @@ -3,6 +3,7 @@ package de.fu_berlin.inf.dpp.net; import java.util.List; import de.fu_berlin.inf.dpp.activities.IActivity; +import de.fu_berlin.inf.dpp.concurrent.IRequestManager; import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; import de.fu_berlin.inf.dpp.project.IActivityListener; @@ -13,7 +14,7 @@ import de.fu_berlin.inf.dpp.project.IActivityListener; * @author rdjemili * */ -public interface IActivitySequencer extends IActivityListener { +public interface IActivitySequencer extends IActivityListener,IRequestManager { /** * Gets all activities since last flush. * @@ -52,5 +53,5 @@ public interface IActivitySequencer extends IActivityListener { public int getQueuedActivities(); - public IActivity receiveRequest(Request request); +// public IActivity receiveRequest(Request request); } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IChatManager.java b/src/de/fu_berlin/inf/dpp/net/IChatManager.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IChatManager.java rename to src/de/fu_berlin/inf/dpp/net/IChatManager.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IConnectionListener.java b/src/de/fu_berlin/inf/dpp/net/IConnectionListener.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IConnectionListener.java rename to src/de/fu_berlin/inf/dpp/net/IConnectionListener.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IFileTransferCallback.java b/src/de/fu_berlin/inf/dpp/net/IFileTransferCallback.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IFileTransferCallback.java rename to src/de/fu_berlin/inf/dpp/net/IFileTransferCallback.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IOptimizer.java b/src/de/fu_berlin/inf/dpp/net/IOptimizer.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IOptimizer.java rename to src/de/fu_berlin/inf/dpp/net/IOptimizer.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IReceiver.java b/src/de/fu_berlin/inf/dpp/net/IReceiver.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/IReceiver.java rename to src/de/fu_berlin/inf/dpp/net/IReceiver.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/ITransmitter.java b/src/de/fu_berlin/inf/dpp/net/ITransmitter.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/ITransmitter.java rename to src/de/fu_berlin/inf/dpp/net/ITransmitter.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/JID.java b/src/de/fu_berlin/inf/dpp/net/JID.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/JID.java rename to src/de/fu_berlin/inf/dpp/net/JID.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/MUCForbiddenException.java b/src/de/fu_berlin/inf/dpp/net/MUCForbiddenException.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/MUCForbiddenException.java rename to src/de/fu_berlin/inf/dpp/net/MUCForbiddenException.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/RoomNotExistException.java b/src/de/fu_berlin/inf/dpp/net/RoomNotExistException.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/RoomNotExistException.java rename to src/de/fu_berlin/inf/dpp/net/RoomNotExistException.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/TimedActivity.java b/src/de/fu_berlin/inf/dpp/net/TimedActivity.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/TimedActivity.java rename to src/de/fu_berlin/inf/dpp/net/TimedActivity.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/ActivitiesPacketExtension.java b/src/de/fu_berlin/inf/dpp/net/internal/ActivitiesPacketExtension.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/ActivitiesPacketExtension.java rename to src/de/fu_berlin/inf/dpp/net/internal/ActivitiesPacketExtension.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/ActivitiesProvider.java b/src/de/fu_berlin/inf/dpp/net/internal/ActivitiesProvider.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/ActivitiesProvider.java rename to src/de/fu_berlin/inf/dpp/net/internal/ActivitiesProvider.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/ActivitySequencer.java b/src/de/fu_berlin/inf/dpp/net/internal/ActivitySequencer.java similarity index 67% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/ActivitySequencer.java rename to src/de/fu_berlin/inf/dpp/net/internal/ActivitySequencer.java index 2898916c75dfc7d110d8830ee8378da838f4244c..61207e56bfaf2f0d78097ec870f0c2f013ed8e70 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/ActivitySequencer.java +++ b/src/de/fu_berlin/inf/dpp/net/internal/ActivitySequencer.java @@ -26,11 +26,12 @@ import java.util.Vector; import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Level; - import org.apache.log4j.Logger; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.TextSelection; +import de.fu_berlin.inf.dpp.Saros; +import de.fu_berlin.inf.dpp.activities.EditorActivity; import de.fu_berlin.inf.dpp.activities.IActivity; import de.fu_berlin.inf.dpp.activities.TextEditActivity; import de.fu_berlin.inf.dpp.activities.TextSelectionActivity; @@ -44,16 +45,76 @@ import de.fu_berlin.inf.dpp.net.JID; import de.fu_berlin.inf.dpp.net.TimedActivity; import de.fu_berlin.inf.dpp.project.IActivityManager; import de.fu_berlin.inf.dpp.project.IActivityProvider; +import de.fu_berlin.inf.dpp.project.ISharedProject; /** * Implements {@link IActivitySequencer} and {@link IActivityManager}. * * @author rdjemili */ -public class ActivitySequencer implements IRequestManager, RequestForwarder, - IActivitySequencer, IActivityManager { +public class ActivitySequencer implements RequestForwarder, IActivitySequencer, + IActivityManager { // TODO separate into two classes!? + private static Logger logger = Logger.getLogger(ExecuterQueue.class); + /**/ + public class ExecuterQueue { + + + /** Queue with IActivity Elements */ + private List<TextEditActivity> executerQueue; + + private TextEditActivity currentExecutedActivity; + + private boolean executed = true; + + public ExecuterQueue() { + this.executerQueue = new Vector<TextEditActivity>(); + } + + /** + * check status of created activity. After execution in ActivitySequencer + * activity has created new call of activityCreated. + * @param activity + */ + public synchronized boolean checkCreatedActivity(IActivity activity){ + if(currentExecutedActivity != null){ + if(activity instanceof TextEditActivity && currentExecutedActivity.sameLike(activity)){ + logger.debug("TextEditActivity "+activity+ " is executed."); +// System.out.println("Check"); + executed = true; + notify(); + } + } + return executed; + } + + public synchronized void addActivity(IActivity activity) { + if(activity instanceof TextEditActivity){ + logger.debug("Add new Activity "+activity+ " to executer queue."); + executerQueue.add((TextEditActivity)activity); + notify(); + } + } + + public synchronized IActivity getNextActivity() { + try { + while (executerQueue.size() < 1 && !executed) { + wait(); + } + currentExecutedActivity = executerQueue.remove(0); + executed = false; + logger.debug("Remove "+currentExecutedActivity+" form executer queue."); + /* get next activity in queue. */ + return currentExecutedActivity; + } catch (InterruptedException e) { + e.printStackTrace(); + return null; + } + + } + } + private static final int UNDEFINED_TIME = -1; private static Logger log = Logger.getLogger(ActivitySequencer.class @@ -75,9 +136,15 @@ public class ActivitySequencer implements IRequestManager, RequestForwarder, /** outgoing queue for direct client sync messages for all driver. */ private List<Request> outgoingSyncActivities = new Vector<Request>(); - + private IActivity executedJupiterActivity; + + private ExecuterQueue executer; + public ActivitySequencer(){ + executer = new ExecuterQueue(); + } + /* * (non-Javadoc) * @@ -86,12 +153,16 @@ public class ActivitySequencer implements IRequestManager, RequestForwarder, public void exec(IActivity activity) { try { + if(activity instanceof EditorActivity){ + concurrentManager.exec(activity); + } + if (activity instanceof TextEditActivity) { /* check if document is already managed by jupiter mechanism. */ if (!concurrentManager.isHostSide() && concurrentManager.exec(activity) != null) { // CLIENT SIDE - // TODO: siehe 6 + logger.debug("Execute received activity (without jupiter): "+activity); for (IActivityProvider executor : providers) { executor.exec(activity); } @@ -200,45 +271,55 @@ public class ActivitySequencer implements IRequestManager, RequestForwarder, */ public void activityCreated(IActivity activity) { - if (activity instanceof TextEditActivity) { + if(activity instanceof EditorActivity){ + /* Host: start and stop jupiter server process depending on editor activities + * of remote clients. + * Client: start and stop local jupiter clients depending on editor activities. + * */ + concurrentManager.activityCreated(activity); + } + + if (activity instanceof TextEditActivity){ + + /* + * 1. if activity received from remote client and just executed, + * then send to all observer. + */ + // TextEditActivity ac = (TextEditActivity) activity; + // if(concurrentManager.isHostSide() && ac.getSource() != null){ + // activities.add(activity); + // return; + // } - /*1. if activity received from remote client and - * just executed, then send to all observer. */ -// TextEditActivity ac = (TextEditActivity) activity; -// if(concurrentManager.isHostSide() && ac.getSource() != null){ -// activities.add(activity); -// return; -// } + /* check for execute next activity in queue.*/ + log.debug("activity created : "+activity); + executer.checkCreatedActivity(activity); /* activity is already managed by jupiter and executed now. */ - if(executedJupiterActivity != null && concurrentManager.isHostSide() && ((TextEditActivity)activity).sameLike(executedJupiterActivity)){ - /* Send message to all.*/ + if (executedJupiterActivity != null + && isHostSide() + && ((TextEditActivity) activity) + .sameLike(executedJupiterActivity)) { + /* Send message to all. */ activities.add(activity); return; - } - else{ - /* new text edit activity has created and has to sync with jupiter logic. */ - IActivity resultAC = concurrentManager.activityCreated(activity); + } else { + /* + * new text edit activity has created and has to sync with + * jupiter logic. + */ + IActivity resultAC = concurrentManager + .activityCreated(activity); /** * host activity: put into outgoing queue and send to all if - * activity is generated by host. otherwise: send request to host. + * activity is generated by host. otherwise: send request to + * host. */ if (resultAC != null || concurrentManager.isHostSide()) { activities.add(activity); } } - -// -// // /* sync with jupiter logic. */ -// IActivity resultAC = concurrentManager.activityCreated(activity); -// -// /** -// * host activity: put into outgoing queue and send to all if -// * activity is generated by host. otherwise: send request to host. -// */ -// if (resultAC != null || concurrentManager.isHostSide()) { -// activities.add(activity); -// } + } else { activities.add(activity); @@ -381,8 +462,10 @@ public class ActivitySequencer implements IRequestManager, RequestForwarder, public void initConcurrentManager( de.fu_berlin.inf.dpp.concurrent.ConcurrentManager.Side side, - de.fu_berlin.inf.dpp.User host, JID myJID) { + de.fu_berlin.inf.dpp.User host, JID myJID, + ISharedProject sharedProject) { concurrentManager = new ConcurrentDocumentManager(side, host, myJID); + sharedProject.addListener(concurrentManager); concurrentManager.setRequestForwarder(this); concurrentManager.setActivitySequencer(this); } @@ -392,41 +475,10 @@ public class ActivitySequencer implements IRequestManager, RequestForwarder, } public synchronized void forwardOutgoingRequest(Request req) { - // System.out.println("get request: "+req.toString()); - /** - * if request form host: send to jupiter server to sync with proxies. - */ -// if (concurrentManager.isHost(req.getJID())) { - /* send req to jupiter document server */ - /* - * Wichtig über sideID kann ermittelt werden, ob es sich um eine - * client oder server nachricht vom host handelt! - */ - // if(req.getSiteId()== 1){ - /* request is generated by jupiter client of host. */ - -// IActivity activity = concurrentManager.receiveRequest(req); -// if (activity != null) { -// /* execute transformed activity */ -// execTransformedActivity(activity); -// } - -// concurrentManager.receiveRequest(req); - - // }else{ - // /*request is generate by jupiter server and have to execute - // * in host client. */ - // log.info("mal schauen?"); - // } - -// } else { - /* put request into outgoing queue. */ - outgoingSyncActivities.add(req); -// } + /* put request into outgoing queue. */ + outgoingSyncActivities.add(req); - // logger.debug("add request to outgoing queue : "+req.getJID()+" - // "+req.getOperation()); notify(); } @@ -446,22 +498,26 @@ public class ActivitySequencer implements IRequestManager, RequestForwarder, /** * Receive request from ITransmitter and transfer to concurrent control. */ - public IActivity receiveRequest(Request request) { + public void receiveRequest(Request request) { /* * sync with jupiter server on host side and transform operation with * jupiter client side. */ - log.debug("Receive request : "+request+ " from "+request.getJID()); + log.debug("Receive request : " + request + " from " + request.getJID()); concurrentManager.receiveRequest(request); - return null; -// IActivity activity = concurrentManager.receiveRequest(request); -// if (activity != null) { -// /* execute transformed activity */ -// execTransformedActivity(activity); -// } -// return activity; + // return null; + // IActivity activity = concurrentManager.receiveRequest(request); + // if (activity != null) { + // /* execute transformed activity */ + // execTransformedActivity(activity); + // } + // return activity; } + private boolean isHostSide(){ + return concurrentManager.isHostSide(); + } + /** * Execute activity after jupiter transforming process. * @@ -469,16 +525,25 @@ public class ActivitySequencer implements IRequestManager, RequestForwarder, */ public void execTransformedActivity(IActivity activity) { try { - log.debug("execute transformed activity: "+activity); - //mark current execute activity - executedJupiterActivity = activity; + log.debug("execute transformed activity: " + activity); - for (IActivityProvider executor : providers) { - executor.exec(activity); + /* add new activity to executer queue. */ + executer.addActivity(activity); + + /* get next activity from queue or waiting for finishing of + * current execute activity.*/ + IActivity queueActivity = executer.getNextActivity(); + + // mark current execute activity +// executedJupiterActivity = activity; + executedJupiterActivity = queueActivity; + + for (IActivityProvider exec : providers) { + exec.exec(activity); } /* send activity to all observer. */ - if(concurrentManager.isHostSide()){ - log.debug("send transformed activity: "+activity); + if (concurrentManager.isHostSide()) { + log.debug("send transformed activity: " + activity); activities.add(activity); } } catch (Exception e) { diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/FileTransferProcessMonitor.java b/src/de/fu_berlin/inf/dpp/net/internal/FileTransferProcessMonitor.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/FileTransferProcessMonitor.java rename to src/de/fu_berlin/inf/dpp/net/internal/FileTransferProcessMonitor.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/JingleFileTransferData.java b/src/de/fu_berlin/inf/dpp/net/internal/JingleFileTransferData.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/JingleFileTransferData.java rename to src/de/fu_berlin/inf/dpp/net/internal/JingleFileTransferData.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/MultiUserChatManager.java b/src/de/fu_berlin/inf/dpp/net/internal/MultiUserChatManager.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/MultiUserChatManager.java rename to src/de/fu_berlin/inf/dpp/net/internal/MultiUserChatManager.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/PacketExtensions.java b/src/de/fu_berlin/inf/dpp/net/internal/PacketExtensions.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/PacketExtensions.java rename to src/de/fu_berlin/inf/dpp/net/internal/PacketExtensions.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/PrivateChatManager.java b/src/de/fu_berlin/inf/dpp/net/internal/PrivateChatManager.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/PrivateChatManager.java rename to src/de/fu_berlin/inf/dpp/net/internal/PrivateChatManager.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/RequestExtensionProvider.java b/src/de/fu_berlin/inf/dpp/net/internal/RequestExtensionProvider.java similarity index 97% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/RequestExtensionProvider.java rename to src/de/fu_berlin/inf/dpp/net/internal/RequestExtensionProvider.java index b2b0e1bbb834b08fc572e1338837fbc261dc5ec7..558b1e29b769448bac69c90967ce743b27e06f47 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/RequestExtensionProvider.java +++ b/src/de/fu_berlin/inf/dpp/net/internal/RequestExtensionProvider.java @@ -19,6 +19,7 @@ import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.NoOperation; import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.SplitOperation; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.TimestampOperation; import de.fu_berlin.inf.dpp.net.JID; import de.fu_berlin.inf.dpp.net.TimedActivity; import de.fu_berlin.inf.dpp.project.ActivityRegistry; @@ -161,6 +162,9 @@ public class RequestExtensionProvider implements PacketExtensionProvider{ if(parser.getName().equals(RequestPacketExtension.NO_OP)){ return new NoOperation(); } + if(parser.getName().equals(RequestPacketExtension.TIMESTAMP_OP)){ + return new TimestampOperation(); + } return op; } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/RequestPacketExtension.java b/src/de/fu_berlin/inf/dpp/net/internal/RequestPacketExtension.java similarity index 95% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/RequestPacketExtension.java rename to src/de/fu_berlin/inf/dpp/net/internal/RequestPacketExtension.java index d7ca0aeb5eca71b11f2cfe833931970c82ef5bde..394e0e7f785c2a20a18a2c1e442a7679879609e9 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/RequestPacketExtension.java +++ b/src/de/fu_berlin/inf/dpp/net/internal/RequestPacketExtension.java @@ -12,6 +12,7 @@ import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.DeleteOperation; import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.InsertOperation; import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.NoOperation; import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.SplitOperation; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.TimestampOperation; public class RequestPacketExtension implements PacketExtension{ @@ -35,6 +36,8 @@ public class RequestPacketExtension implements PacketExtension{ public static final String SPLIT_OP = "split"; + public static final String TIMESTAMP_OP = "time"; + public static final String LOCAL_TIME = "localtime"; @@ -130,6 +133,9 @@ public class RequestPacketExtension implements PacketExtension{ // NoOperation no = (NoOperation) op; xml += "<"+NO_OP+ "/>"; } + if(op instanceof TimestampOperation){ + xml += "<"+TIMESTAMP_OP+ "/>"; + } if(op instanceof SplitOperation){ SplitOperation split = (SplitOperation) op; diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/RosterListenerImpl.java b/src/de/fu_berlin/inf/dpp/net/internal/RosterListenerImpl.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/RosterListenerImpl.java rename to src/de/fu_berlin/inf/dpp/net/internal/RosterListenerImpl.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/SkypeIQ.java b/src/de/fu_berlin/inf/dpp/net/internal/SkypeIQ.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/SkypeIQ.java rename to src/de/fu_berlin/inf/dpp/net/internal/SkypeIQ.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/XMPPChatTransmitter.java b/src/de/fu_berlin/inf/dpp/net/internal/XMPPChatTransmitter.java similarity index 95% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/XMPPChatTransmitter.java rename to src/de/fu_berlin/inf/dpp/net/internal/XMPPChatTransmitter.java index 043f51bc9059038b0034f8c99ae2960a3c945dba..3565727c159ac84ffc83c8cce8eea2e3c2ea3b97 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/internal/XMPPChatTransmitter.java +++ b/src/de/fu_berlin/inf/dpp/net/internal/XMPPChatTransmitter.java @@ -1004,7 +1004,7 @@ public class XMPPChatTransmitter implements ITransmitter, public void processMessage(Chat chat, Message message) { // TODO: new method für smack 3 - log.debug("incomming message : " + message.getBody()); +// log.debug("incomming message : " + message.getBody()); // processPacket(message); } @@ -1066,7 +1066,7 @@ public class XMPPChatTransmitter implements ITransmitter, List<TimedActivity> timedActivities = activitiesPacket .getActivities(); - log.info("Received activities from " + fromJID.toString() + ": " + log.debug("Received activities from " + fromJID.toString() + ": " + timedActivities); if (!isProjectParticipant) { @@ -1598,7 +1598,7 @@ public class XMPPChatTransmitter implements ITransmitter, description = description + ':' + transferData.timestamp; } - if (getFileTransferModeViaChat()) { + if (getFileTransferModeViaChat() || transferData.callback == null) { if (transferData.content == null) readFile(transferData); @@ -1612,11 +1612,13 @@ public class XMPPChatTransmitter implements ITransmitter, transferData.content, recipient); log.info("Sent file " + transferData.path + " (by ChatTransfer)"); - + return; } // try { + + if (jingle && (jingleManager.getState(recipient) != JingleConnectionState.ERROR)) { log.info("Sent file " + transferData.path + " (with Jingle)"); @@ -1975,8 +1977,8 @@ public class XMPPChatTransmitter implements ITransmitter, IPreferenceStore preferenceStore = Saros.getDefault() .getPreferenceStore(); // TODO: Änderung für smack 3 : filetransfer have to be implements new - fileTransferManager.getProperties().setProperty(FileTransferNegotiator.AVOID_SOCKS5, "true"); - fileTransferManager.getProperties().setProperty(IBBTransferNegotiator.PROPERTIES_BLOCK_SIZE, preferenceStore.getString(PreferenceConstants.CHATFILETRANSFER_CHUNKSIZE)); +// fileTransferManager.getProperties().setProperty(FileTransferNegotiator.AVOID_SOCKS5, "true"); +// fileTransferManager.getProperties().setProperty(IBBTransferNegotiator.PROPERTIES_BLOCK_SIZE, preferenceStore.getString(PreferenceConstants.CHATFILETRANSFER_CHUNKSIZE)); // fileTransferManager.getProperties().setProperty(Socks5TransferNegotiator.PROPERTIES_PORT, // preferenceStore.getString(PreferenceConstants.FILE_TRANSFER_PORT)); diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/FileTransferMediaManager.java b/src/de/fu_berlin/inf/dpp/net/jingle/FileTransferMediaManager.java similarity index 89% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/FileTransferMediaManager.java rename to src/de/fu_berlin/inf/dpp/net/jingle/FileTransferMediaManager.java index e99a92259ccb1a518e37da7be085608d9495f703..b7506496a63d666bbe1b914b86983b0163c39e2c 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/FileTransferMediaManager.java +++ b/src/de/fu_berlin/inf/dpp/net/jingle/FileTransferMediaManager.java @@ -12,6 +12,7 @@ import org.jivesoftware.smackx.jingle.JingleSession; import org.jivesoftware.smackx.jingle.media.JingleMediaManager; import org.jivesoftware.smackx.jingle.media.JingleMediaSession; import org.jivesoftware.smackx.jingle.media.PayloadType; +import org.jivesoftware.smackx.jingle.nat.JingleTransportManager; import org.jivesoftware.smackx.jingle.nat.TransportCandidate; import de.fu_berlin.inf.dpp.FileList; @@ -30,18 +31,34 @@ public class FileTransferMediaManager extends JingleMediaManager { private final XMPPConnection connection; private IJingleFileTransferListener listener; private HashMap<JID, FileTransferSession> sessions; + private JingleTransportManager transportManager; // private FileTransferSession session; /* tranfer data */ private JingleFileTransferData[] transferData; private JingleFileTransferProcessMonitor monitor; - public FileTransferMediaManager() { +// @Deprecated +// public FileTransferMediaManager() { +// setupPayloads(); +// this.connection = null; +// sessions = new HashMap<JID, FileTransferSession>(); +// } + + public FileTransferMediaManager(JingleTransportManager transportManager) { + + super(transportManager); + this.transportManager = transportManager; setupPayloads(); this.connection = null; sessions = new HashMap<JID, FileTransferSession>(); } + @Override + public JingleTransportManager getTransportManager(){ + return this.transportManager; + } + @Override public JingleMediaSession createMediaSession(PayloadType payloadType, TransportCandidate remote, TransportCandidate local, diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/FileTransferSession.java b/src/de/fu_berlin/inf/dpp/net/jingle/FileTransferSession.java similarity index 95% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/FileTransferSession.java rename to src/de/fu_berlin/inf/dpp/net/jingle/FileTransferSession.java index c0f569203feee1214cac456aca28073370f3cded..9cabeabc5a67b13a9e85cf7a1c433cbe0dfd0f30 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/FileTransferSession.java +++ b/src/de/fu_berlin/inf/dpp/net/jingle/FileTransferSession.java @@ -9,7 +9,7 @@ import java.net.ServerSocket; import java.net.UnknownHostException; import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smackx.jingle.IncomingJingleSession; +import org.jivesoftware.smackx.jingle.JingleSession; import org.jivesoftware.smackx.jingle.JingleSession; import org.jivesoftware.smackx.jingle.media.JingleMediaSession; import org.jivesoftware.smackx.jingle.media.PayloadType; @@ -58,7 +58,9 @@ public class FileTransferSession extends JingleMediaSession { @Override public void initialize() { - if (this.getJingleSession() instanceof IncomingJingleSession) { + JingleSession session = getJingleSession(); + if (!((session != null) && (session.getInitiator().equals(session.getConnection().getUser())))) { +// if (this.getJingleSession() instanceof JingleSession) { try { receiver = new FileTransferTCPReceiver(InetAddress diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/IFileTransferReceiver.java b/src/de/fu_berlin/inf/dpp/net/jingle/IFileTransferReceiver.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/IFileTransferReceiver.java rename to src/de/fu_berlin/inf/dpp/net/jingle/IFileTransferReceiver.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/IFileTransferTransmitter.java b/src/de/fu_berlin/inf/dpp/net/jingle/IFileTransferTransmitter.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/IFileTransferTransmitter.java rename to src/de/fu_berlin/inf/dpp/net/jingle/IFileTransferTransmitter.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/IJingleFileTransferConnection.java b/src/de/fu_berlin/inf/dpp/net/jingle/IJingleFileTransferConnection.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/IJingleFileTransferConnection.java rename to src/de/fu_berlin/inf/dpp/net/jingle/IJingleFileTransferConnection.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/IJingleFileTransferListener.java b/src/de/fu_berlin/inf/dpp/net/jingle/IJingleFileTransferListener.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/IJingleFileTransferListener.java rename to src/de/fu_berlin/inf/dpp/net/jingle/IJingleFileTransferListener.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferManager.java b/src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferManager.java similarity index 83% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferManager.java rename to src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferManager.java index 99ee97401d97b7e2799969ff7d989d790d24af44..a9f4cef331179bd2047c048010937106b07e6c68 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferManager.java +++ b/src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferManager.java @@ -1,21 +1,24 @@ package de.fu_berlin.inf.dpp.net.jingle; import java.util.HashMap; +import java.util.List; +import java.util.Vector; import org.apache.log4j.Logger; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smackx.jingle.IncomingJingleSession; +//import org.jivesoftware.smackx.jingle.IncomingJingleSession; import org.jivesoftware.smackx.jingle.JingleManager; import org.jivesoftware.smackx.jingle.JingleSession; import org.jivesoftware.smackx.jingle.JingleSessionRequest; -import org.jivesoftware.smackx.jingle.OutgoingJingleSession; -import org.jivesoftware.smackx.jingle.JingleNegotiator.JingleException; -import org.jivesoftware.smackx.jingle.JingleNegotiator.State; +//import org.jivesoftware.smackx.jingle.OutgoingJingleSession; +import org.jivesoftware.smackx.jingle.JingleException; +import org.jivesoftware.smackx.jingle.JingleNegotiatorState; import org.jivesoftware.smackx.jingle.listeners.JingleMediaListener; import org.jivesoftware.smackx.jingle.listeners.JingleSessionRequestListener; -import org.jivesoftware.smackx.jingle.listeners.JingleSessionStateListener; +//import org.jivesoftware.smackx.jingle.listeners.JingleSessionStateListener; import org.jivesoftware.smackx.jingle.listeners.JingleTransportListener; +import org.jivesoftware.smackx.jingle.media.JingleMediaManager; import org.jivesoftware.smackx.jingle.media.PayloadType; import org.jivesoftware.smackx.jingle.nat.ICETransportManager; import org.jivesoftware.smackx.jingle.nat.TransportCandidate; @@ -32,10 +35,10 @@ public class JingleFileTransferManager { private IJingleFileTransferListener transmitter; private JingleManager jm; - private HashMap<JID, IncomingJingleSession> incomingSessions = null; - private HashMap<JID, OutgoingJingleSession> outgoingSessions = null; + private HashMap<JID, JingleSession> incomingSessions = null; + private HashMap<JID, JingleSession> outgoingSessions = null; - public static int JINGLE_TIME_OUT = 10000; + public static int JINGLE_TIME_OUT = 1000000; /** * this map contains for all incoming and outgoing jingle sessions the @@ -53,8 +56,8 @@ public class JingleFileTransferManager { IJingleFileTransferListener transmitter) { this.xmppConnection = connection; this.transmitter = transmitter; - incomingSessions = new HashMap<JID, IncomingJingleSession>(); - outgoingSessions = new HashMap<JID, OutgoingJingleSession>(); + incomingSessions = new HashMap<JID, JingleSession>(); + outgoingSessions = new HashMap<JID, JingleSession>(); connectionStates = new HashMap<JID, JingleConnectionState>(); logger.debug("initialized jingle file transfer manager."); initialize(); @@ -117,24 +120,25 @@ public class JingleFileTransferManager { } }); - /* add state listener. */ - js.addStateListener(new JingleSessionStateListener() { - - public void afterChanged(State old, State newOne) { - // logger.debug("session state after change new state : - // "+newOne.toString()+" JID: "+jid_string); - - } - - public void beforeChange(State old, State newOne) - throws JingleException { - // logger.debug("session state before change : - // "+old.toString()+" new : "+newOne.toString()+" JID: - // "+jid_string); - - } - }); +// /* add state listener. */ +// js.addStateListener(new JingleSessionStateListener() { +// +// public void afterChanged(State old, State newOne) { +// // logger.debug("session state after change new state : +// // "+newOne.toString()+" JID: "+jid_string); +// +// } +// +// public void beforeChange(State old, State newOne) +// throws JingleException { +// // logger.debug("session state before change : +// // "+old.toString()+" new : "+newOne.toString()+" JID: +// // "+jid_string); +// +// } +// }); + /* transport events */ js.addTransportListener(new JingleTransportListener() { @@ -174,17 +178,20 @@ public class JingleFileTransferManager { ICETransportManager icetm0 = new ICETransportManager(xmppConnection, "jivesoftware.com", 3478); - mediaManager = new FileTransferMediaManager(); + mediaManager = new FileTransferMediaManager(icetm0); mediaManager.addJingleFileTransferListener(transmitter); - jm = new JingleManager(xmppConnection, icetm0, mediaManager); + List<JingleMediaManager> medias = new Vector<JingleMediaManager>(); + medias.add(mediaManager); + + jm = new JingleManager(xmppConnection, medias); jm.addCreationListener(icetm0); jm.addJingleSessionRequestListener(new JingleSessionRequestListener() { public void sessionRequested(JingleSessionRequest request) { JID jid = new JID(request.getFrom()); - IncomingJingleSession incoming = incomingSessions.get(jid); + JingleSession incoming = incomingSessions.get(jid); if (incoming != null) return; @@ -199,7 +206,7 @@ public class JingleFileTransferManager { /* put to current session list. */ incomingSessions.put(jid, incoming); // Start the call - incoming.start(); + incoming.startIncoming(); } catch (XMPPException e) { e.printStackTrace(); } @@ -222,7 +229,7 @@ public class JingleFileTransferManager { final String jid_string = jid.toString(); - IncomingJingleSession incoming = incomingSessions.get(jid); + JingleSession incoming = incomingSessions.get(jid); if (incoming != null) { /* an incoming session already exist. */ try { @@ -235,7 +242,7 @@ public class JingleFileTransferManager { return; } - OutgoingJingleSession outgoing = outgoingSessions.get(jid); + JingleSession outgoing = outgoingSessions.get(jid); if (outgoing != null) { /* send new data with current connection. */ try { @@ -255,7 +262,7 @@ public class JingleFileTransferManager { /* add to outgoing session list. */ outgoingSessions.put(jid, outgoing); - outgoing.start(); + outgoing.startOutgoing(); } catch (XMPPException e1) { e1.printStackTrace(); } @@ -284,7 +291,7 @@ public class JingleFileTransferManager { logger.debug("Terminate all jingle sessions."); - OutgoingJingleSession outgoing = null; + JingleSession outgoing = null; for (JID jid : outgoingSessions.keySet()) { outgoing = outgoingSessions.get(jid); if (outgoing != null) { @@ -300,7 +307,7 @@ public class JingleFileTransferManager { } } - IncomingJingleSession incoming = null; + JingleSession incoming = null; for (JID jid : incomingSessions.keySet()) { incoming = incomingSessions.get(jid); if (incoming != null) { @@ -326,7 +333,7 @@ public class JingleFileTransferManager { * @param jid */ public void terminateJingleSession(JID jid) { - OutgoingJingleSession outgoing = outgoingSessions.get(jid); + JingleSession outgoing = outgoingSessions.get(jid); if (outgoing != null) { try { outgoing.terminate(); @@ -341,7 +348,7 @@ public class JingleFileTransferManager { } } - IncomingJingleSession incoming = incomingSessions.get(jid); + JingleSession incoming = incomingSessions.get(jid); if (incoming != null) { try { incoming.terminate(); diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferProcessMonitor.java b/src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferProcessMonitor.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferProcessMonitor.java rename to src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferProcessMonitor.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferTCPConnection.java b/src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferTCPConnection.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferTCPConnection.java rename to src/de/fu_berlin/inf/dpp/net/jingle/JingleFileTransferTCPConnection.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/JingleSessionException.java b/src/de/fu_berlin/inf/dpp/net/jingle/JingleSessionException.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/JingleSessionException.java rename to src/de/fu_berlin/inf/dpp/net/jingle/JingleSessionException.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/receiver/FileTransferTCPReceiver.java b/src/de/fu_berlin/inf/dpp/net/jingle/receiver/FileTransferTCPReceiver.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/receiver/FileTransferTCPReceiver.java rename to src/de/fu_berlin/inf/dpp/net/jingle/receiver/FileTransferTCPReceiver.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/transmitter/FileTransferTCPTransmitter.java b/src/de/fu_berlin/inf/dpp/net/jingle/transmitter/FileTransferTCPTransmitter.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/net/jingle/transmitter/FileTransferTCPTransmitter.java rename to src/de/fu_berlin/inf/dpp/net/jingle/transmitter/FileTransferTCPTransmitter.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ActivityRegistry.java b/src/de/fu_berlin/inf/dpp/project/ActivityRegistry.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ActivityRegistry.java rename to src/de/fu_berlin/inf/dpp/project/ActivityRegistry.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/IActivityListener.java b/src/de/fu_berlin/inf/dpp/project/IActivityListener.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/IActivityListener.java rename to src/de/fu_berlin/inf/dpp/project/IActivityListener.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/IActivityManager.java b/src/de/fu_berlin/inf/dpp/project/IActivityManager.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/IActivityManager.java rename to src/de/fu_berlin/inf/dpp/project/IActivityManager.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/IActivityProvider.java b/src/de/fu_berlin/inf/dpp/project/IActivityProvider.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/IActivityProvider.java rename to src/de/fu_berlin/inf/dpp/project/IActivityProvider.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISessionListener.java b/src/de/fu_berlin/inf/dpp/project/ISessionListener.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISessionListener.java rename to src/de/fu_berlin/inf/dpp/project/ISessionListener.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISharedProject.java b/src/de/fu_berlin/inf/dpp/project/ISharedProject.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISharedProject.java rename to src/de/fu_berlin/inf/dpp/project/ISharedProject.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISharedProjectListener.java b/src/de/fu_berlin/inf/dpp/project/ISharedProjectListener.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISharedProjectListener.java rename to src/de/fu_berlin/inf/dpp/project/ISharedProjectListener.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/SessionManager.java b/src/de/fu_berlin/inf/dpp/project/SessionManager.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/SessionManager.java rename to src/de/fu_berlin/inf/dpp/project/SessionManager.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/SharedResourcesManager.java b/src/de/fu_berlin/inf/dpp/project/SharedResourcesManager.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/SharedResourcesManager.java rename to src/de/fu_berlin/inf/dpp/project/SharedResourcesManager.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/internal/RoleManager.java b/src/de/fu_berlin/inf/dpp/project/internal/RoleManager.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/internal/RoleManager.java rename to src/de/fu_berlin/inf/dpp/project/internal/RoleManager.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/internal/SharedModelProvider.java b/src/de/fu_berlin/inf/dpp/project/internal/SharedModelProvider.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/internal/SharedModelProvider.java rename to src/de/fu_berlin/inf/dpp/project/internal/SharedModelProvider.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/internal/SharedProject.java b/src/de/fu_berlin/inf/dpp/project/internal/SharedProject.java similarity index 57% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/internal/SharedProject.java rename to src/de/fu_berlin/inf/dpp/project/internal/SharedProject.java index cec3bf7fb39df18b67c74726033b5c436dc942d4..b8f3878a5e5161781ced075e9a96e895333483b5 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/internal/SharedProject.java +++ b/src/de/fu_berlin/inf/dpp/project/internal/SharedProject.java @@ -26,7 +26,6 @@ import java.util.Timer; import java.util.TimerTask; import java.util.logging.Level; - import org.apache.log4j.Logger; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -54,6 +53,7 @@ import de.fu_berlin.inf.dpp.User; import de.fu_berlin.inf.dpp.User.UserRole; import de.fu_berlin.inf.dpp.concurrent.ConcurrentManager; import de.fu_berlin.inf.dpp.concurrent.jupiter.Request; +import de.fu_berlin.inf.dpp.concurrent.jupiter.internal.text.TimestampOperation; import de.fu_berlin.inf.dpp.concurrent.management.ConcurrentDocumentManager; import de.fu_berlin.inf.dpp.invitation.IOutgoingInvitationProcess; import de.fu_berlin.inf.dpp.invitation.IInvitationProcess.IInvitationUI; @@ -91,15 +91,15 @@ public class SharedProject implements ISharedProject { private ActivitySequencer activitySequencer = new ActivitySequencer(); private static final int MAX_USERCOLORS = 5; - private int colorlist[] = new int[MAX_USERCOLORS +1]; + private int colorlist[] = new int[MAX_USERCOLORS + 1]; + + // private ConcurrentManager concurrentManager; -// private ConcurrentManager concurrentManager; - public SharedProject(ITransmitter transmitter, IProject project, JID myID) { // host this.transmitter = transmitter; - -// concurrentManager = new ConcurrentDocumentManager(); - + + // concurrentManager = new ConcurrentDocumentManager(); + this.myID = myID; User u = new User(myID); u.setUserRole(UserRole.DRIVER); @@ -108,15 +108,16 @@ public class SharedProject implements ISharedProject { participants.add(host); /* add host to driver list. */ - activitySequencer.initConcurrentManager(ConcurrentManager.Side.HOST_SIDE,host, myID); - activitySequencer.getConcurrentManager().addDriver(host); - + activitySequencer.initConcurrentManager( + ConcurrentManager.Side.HOST_SIDE, host, myID, this); + activitySequencer.getConcurrentManager().addDriver(host.getJid()); + this.project = project; setProjectReadonly(false); } public SharedProject(ITransmitter transmitter, IProject project, JID myID, // guest - JID host, JID driver, List<JID> allParticipants) { + JID host, JID driver, List<JID> allParticipants) { this.transmitter = transmitter; @@ -124,11 +125,12 @@ public class SharedProject implements ISharedProject { this.host = new User(host); this.driver = new User(driver); - - activitySequencer.initConcurrentManager(ConcurrentManager.Side.CLIENT_SIDE,this.host,myID); - + + activitySequencer.initConcurrentManager( + ConcurrentManager.Side.CLIENT_SIDE, this.host, myID, this); + for (JID jid : allParticipants) { // HACK - User user=new User(jid); + User user = new User(jid); participants.add(user); assignColorId(user); } @@ -171,42 +173,72 @@ public class SharedProject implements ISharedProject { public void setDriver(User driver, boolean replicated) { assert driver != null; - /* set new driver status in participant list of sharedProject. */ - getParticipant(driver.getJid()).setUserRole(UserRole.DRIVER); - - /*TODO: 1. actual the host never lost the driver status - * and added new driver to driverlist*/ - - //host - if(activitySequencer.getConcurrentManager() != null && activitySequencer.getConcurrentManager().isHostSide()){ - // if replicated=false check for privileges - if (driver.equals(this.driver)) - return; - - /* add new driver to list. */ - //TODO: durch hinzufügen von isharedprojectlistener zum concurrentmanager - //könnte dieser punkt ausgelagert werden. - activitySequencer.getConcurrentManager().addDriver(driver); - } - //client - else{ - // if replicated=false check for privileges - if (driver.equals(this.driver)) - return; - - /* set driver in client to observe driver actions - * or to set the local driver status. */ - this.driver = driver; + /* if user has current role observer */ + if (getParticipant(driver.getJid()).getUserRole() == UserRole.OBSERVER) { + + /* set new driver status in participant list of sharedProject. */ + getParticipant(driver.getJid()).setUserRole(UserRole.DRIVER); + + /* + * TODO: 1. actual the host never lost the driver status and added + * new driver to driverlist + */ + + // host + if (activitySequencer.getConcurrentManager() != null + && activitySequencer.getConcurrentManager().isHostSide()) { + // if replicated=false check for privileges + if (driver.equals(this.driver)) + return; + + /* add new driver to list. */ + // TODO: durch hinzufügen von isharedprojectlistener zum + // concurrentmanager + // könnte dieser punkt ausgelagert werden. +// activitySequencer.getConcurrentManager().addDriver(driver.getJid()); + } + // client + else { + // if replicated=false check for privileges + if (driver.equals(this.driver)) + return; + + /* + * set driver in client to observer driver actions or to set the + * local driver status. + */ +// if() + this.driver = driver; + } + + // // TODO if replicated=false check for privileges + // if (driver.equals(this.driver)) + // return; + // + // this.driver = driver; + + /* set local file settings. */ + if(driver.getJid().equals(myID)){ + setProjectReadonly(!isDriver()); + } + + } else { + /* changed state form observer to driver */ + if (getParticipant(driver.getJid()).getUserRole() == UserRole.DRIVER) { + + /* set the local driver state to observer */ + if (driver.getJid().equals(myID) && isDriver(new User(myID))) { + setProjectReadonly(true); + this.driver = host; + } + + /* set observer state. */ + getParticipant(driver.getJid()).setUserRole(UserRole.OBSERVER); + + } } - -// // TODO if replicated=false check for privileges -// if (driver.equals(this.driver)) -// return; -// -// this.driver = driver; - - setProjectReadonly(!isDriver()); + /* inform observer. */ JID jid = driver.getJid(); for (ISharedProjectListener listener : listeners) { listener.driverChanged(jid, replicated); @@ -214,9 +246,20 @@ public class SharedProject implements ISharedProject { } public void removeDriver(User driver, boolean replicated) { - - + /* set new observer status in participant list of sharedProject. */ + getParticipant(driver.getJid()).setUserRole(UserRole.OBSERVER); + + this.driver = host; + /** + * communicate driver role change to listener. + */ + JID jid = driver.getJid(); + for (ISharedProjectListener listener : listeners) { + listener.driverChanged(jid, replicated); + } + } + /* * (non-Javadoc) * @@ -232,24 +275,32 @@ public class SharedProject implements ISharedProject { * @see de.fu_berlin.inf.dpp.ISharedProject */ public boolean isDriver() { - //HOST - if(activitySequencer.getConcurrentManager() != null && activitySequencer.getConcurrentManager().isHostSide()){ - return activitySequencer.getConcurrentManager().isDriver(driver); + // TODO: change driver status request to userrole request of + // participient list. + + // HOST + if (activitySequencer.getConcurrentManager() != null + && activitySequencer.getConcurrentManager().isHostSide()) { + return activitySequencer.getConcurrentManager().isDriver(driver.getJid()); } - //CLIENT - return driver.getJid().equals(myID); + // CLIENT + return (getParticipant(myID).getUserRole() == UserRole.DRIVER); +// return driver.getJid().equals(myID); + } /* * (non-Javadoc) + * * @see de.fu_berlin.inf.dpp.project.ISharedProject#isDriver(de.fu_berlin.inf.dpp.User) */ public boolean isDriver(User user) { - if(getParticipant(user.getJid()).getUserRole() == UserRole.DRIVER){ + if (getParticipant(user.getJid()).getUserRole() == UserRole.DRIVER) { return true; } return false; } + /* * (non-Javadoc) * @@ -274,14 +325,14 @@ public class SharedProject implements ISharedProject { * @see de.fu_berlin.inf.dpp.project.ISharedProject */ public void addUser(User user) { - addUser(user,-1); + addUser(user, -1); } - + public void addUser(User user, int index) { if (participants.contains(user)) { - if (index>=0 && participants.indexOf(user)!=index) { + if (index >= 0 && participants.indexOf(user) != index) { participants.remove(user); - participants.add(index, user); + participants.add(index, user); } /* update exists user. */ participants.remove(user); @@ -296,7 +347,7 @@ public class SharedProject implements ISharedProject { // find free color and assign it to user assignColorId(user); - + for (ISharedProjectListener listener : listeners) { listener.userJoined(user.getJid()); } @@ -313,7 +364,7 @@ public class SharedProject implements ISharedProject { participants.remove(user); // free colorid - colorlist[user.getColorID()]=0; + colorlist[user.getColorID()] = 0; if (driver.equals(user)) { setDriver(participants.get(0), true); @@ -322,7 +373,7 @@ public class SharedProject implements ISharedProject { for (ISharedProjectListener listener : listeners) { listener.userLeft(user.getJid()); } - + log.info("User " + user.getJid() + " left session"); } @@ -331,8 +382,10 @@ public class SharedProject implements ISharedProject { * * @see de.fu_berlin.inf.dpp.project.ISharedProject */ - public IOutgoingInvitationProcess invite(JID jid, String description, boolean inactive, IInvitationUI inviteUI) { - return new OutgoingInvitationProcess(transmitter, jid, this, description, inactive, inviteUI); + public IOutgoingInvitationProcess invite(JID jid, String description, + boolean inactive, IInvitationUI inviteUI) { + return new OutgoingInvitationProcess(transmitter, jid, this, + description, inactive, inviteUI); } /* @@ -375,7 +428,8 @@ public class SharedProject implements ISharedProject { public Timer flushTimer = new Timer(true); public Thread requestTransmitter = null; - private static int queuedsince=0; + private static int queuedsince = 0; + /* * (non-Javadoc) * @@ -390,44 +444,46 @@ public class SharedProject implements ISharedProject { activitySequencer.flush(); } else { - List<TimedActivity> activities = activitySequencer.flushTimed(); + List<TimedActivity> activities = activitySequencer + .flushTimed(); if (activities != null) - transmitter.sendActivities(SharedProject.this, activities); + transmitter.sendActivities(SharedProject.this, + activities); } - + // missing activities? (cant execute all) - if ( activitySequencer.getQueuedActivities()>0) { + if (activitySequencer.getQueuedActivities() > 0) { queuedsince++; - // if i am missing activities for REQUEST_ACTIVITY_ON_AGE seconds, ask all (because I dont know the origin) + // if i am missing activities for REQUEST_ACTIVITY_ON_AGE + // seconds, ask all (because I dont know the origin) // to send it to me again. - if (queuedsince >= REQUEST_ACTIVITY_ON_AGE ) { - - transmitter.sendRequestForActivity( SharedProject.this, - activitySequencer.getTimestamp() , - false); - - queuedsince=0; - + if (queuedsince >= REQUEST_ACTIVITY_ON_AGE) { + + transmitter.sendRequestForActivity(SharedProject.this, + activitySequencer.getTimestamp(), false); + + queuedsince = 0; + // TODO: forever? } - + } else - queuedsince=0; + queuedsince = 0; } }, 0, MILLIS_UPDATE); - - /* 2. start thread for sending jupiter requests.*/ - requestTransmitter = new Thread(new Runnable(){ + + /* 2. start thread for sending jupiter requests. */ + requestTransmitter = new Thread(new Runnable() { public void run() { - while(true){ + while (true) { sendRequest(); } - + } - + }); requestTransmitter.start(); } @@ -457,38 +513,41 @@ public class SharedProject implements ISharedProject { return null; } - boolean assignColorId(User user){ - + boolean assignColorId(User user) { + // already has a color assigned - if (user.getColorID()==-1) + if (user.getColorID() == -1) return true; - - for (int i=0;i<MAX_USERCOLORS;i++){ - if (colorlist[i]==0) { + + for (int i = 0; i < MAX_USERCOLORS; i++) { + if (colorlist[i] == 0) { user.setColorID(i); - colorlist[user.getColorID()]=1; + colorlist[user.getColorID()] = 1; return true; } } - - return false; + + return false; } - + public void startInvitation(final JID jid) { - + Shell shell = Display.getDefault().getActiveShell(); - - if (searchUnsavedChangesInProject(false)) - { - if (MessageDialog.openQuestion(shell, "Unsaved file modifications", - "Before inviting users and therefore synchronizing files, "+ - "this project needs to be saved to disk. "+ - "Do you want to save all unsaved files of this project now?")) { - + + if (searchUnsavedChangesInProject(false)) { + if (MessageDialog + .openQuestion( + shell, + "Unsaved file modifications", + "Before inviting users and therefore synchronizing files, " + + "this project needs to be saved to disk. " + + "Do you want to save all unsaved files of this project now?")) { + // save - // PlatformUI.getWorkbench().saveAllEditors(false); // saves all editors + // PlatformUI.getWorkbench().saveAllEditors(false); // saves all + // editors searchUnsavedChangesInProject(true); - + } else return; } @@ -497,12 +556,19 @@ public class SharedProject implements ISharedProject { public void run() { try { Shell shell = Display.getDefault().getActiveShell(); - Window iw = new InvitationDialog(shell,jid); + Window iw = new InvitationDialog(shell, jid); iw.open(); } catch (Exception e) { - Saros.getDefault().getLog().log( - new Status(IStatus.ERROR, Saros.SAROS, IStatus.ERROR, - "Error while running invitation helper", e)); + Saros + .getDefault() + .getLog() + .log( + new Status( + IStatus.ERROR, + Saros.SAROS, + IStatus.ERROR, + "Error while running invitation helper", + e)); } } }); @@ -510,8 +576,8 @@ public class SharedProject implements ISharedProject { } boolean searchUnsavedChangesInProject(boolean save) { - FileList flist=null; - + FileList flist = null; + try { flist = new FileList(getProject()); } catch (CoreException e) { @@ -519,24 +585,27 @@ public class SharedProject implements ISharedProject { e.printStackTrace(); return false; } - - + try { - IWorkbenchWindow[] wbWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); + IWorkbenchWindow[] wbWindows = PlatformUI.getWorkbench() + .getWorkbenchWindows(); for (IWorkbenchWindow window : wbWindows) { IWorkbenchPage activePage = window.getActivePage(); - IEditorReference[] editorRefs = activePage.getEditorReferences(); + IEditorReference[] editorRefs = activePage + .getEditorReferences(); for (IEditorReference editorRef : editorRefs) { - if (editorRef.isDirty() && editorRef.getEditorInput() instanceof IFileEditorInput) { - - IPath fp = ((IFileEditorInput)editorRef.getEditorInput()). - getFile().getProjectRelativePath(); - + if (editorRef.isDirty() + && editorRef.getEditorInput() instanceof IFileEditorInput) { + + IPath fp = ((IFileEditorInput) editorRef + .getEditorInput()).getFile() + .getProjectRelativePath(); + // is that dirty file in my project? if (flist.getPaths().contains(fp)) { if (save) editorRef.getEditor(false).doSave(null); - else + else return true; } } @@ -545,95 +614,100 @@ public class SharedProject implements ISharedProject { } catch (CoreException e1) { System.out.println(e1.getMessage()); } - + return false; } - public void setProjectReadonly(final boolean readonly) { - + /* run project read only settings in progress monitor thread. */ Display.getDefault().syncExec(new Runnable() { public void run() { - ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getDefault().getActiveShell()); + ProgressMonitorDialog dialog = new ProgressMonitorDialog( + Display.getDefault().getActiveShell()); try { - dialog.run(true, false, new IRunnableWithProgress(){ - public void run(IProgressMonitor monitor){ - + dialog.run(true, false, new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) { + FileList flist; try { - flist = new FileList( project ); - - monitor.beginTask("Project settings ... ", flist.getPaths().size()); - - ResourceAttributes attributes = new ResourceAttributes(); - attributes.setReadOnly(readonly); - attributes.setArchive (readonly); - - for (int i=0;i<flist.getPaths().size(); i++) { - IPath path = flist.getPaths().get(i); - path = path.makeAbsolute(); - IFile file = getProject().getFile(path); - if (file!=null && file.exists()) { - file.setResourceAttributes(attributes); + flist = new FileList(project); + + monitor.beginTask("Project settings ... ", + flist.getPaths().size()); + + ResourceAttributes attributes = new ResourceAttributes(); + attributes.setReadOnly(readonly); + attributes.setArchive(readonly); + + for (int i = 0; i < flist.getPaths().size(); i++) { + IPath path = flist.getPaths().get(i); + path = path.makeAbsolute(); + IFile file = getProject().getFile(path); + if (file != null && file.exists()) { + file.setResourceAttributes(attributes); + } + + monitor.worked(1); } - - monitor.worked(1); - } } catch (CoreException e) { -// log.log(Level.WARNING, "",e); - log.warn("",e); + // log.log(Level.WARNING, "",e); + log.warn("", e); monitor.done(); } - + monitor.done(); } - + }); } catch (InvocationTargetException e) { -// log.log(Level.WARNING, "",e); - log.warn("",e); + // log.log(Level.WARNING, "",e); + log.warn("", e); e.printStackTrace(); } catch (InterruptedException e) { -// log.log(Level.WARNING, "",e); - log.warn("",e); + // log.log(Level.WARNING, "",e); + log.warn("", e); e.printStackTrace(); } - + } }); } - - public void sendRequest(){ + + public void sendRequest() { try { -// Request request = outgoing.getNextOutgoingRequest(); + // Request request = outgoing.getNextOutgoingRequest(); Request request = activitySequencer.getNextOutgoingRequest(); - - if(isHost()){ - /* if jupiter server request to has to execute locally on host side.*/ - if(request.getJID().equals(host.getJid())){ - log.debug("Send host request back for local execution: "+request); + + if (isHost()) { + + /* + * if jupiter server request to has to execute locally on host + * side. + */ + if (request.getJID().equals(host.getJid())) { + log.debug("Send host request back for local execution: " + + request); activitySequencer.receiveRequest(request); - }else{ + } else { /* send operation to client. */ - log.debug("Send request to client: "+request+request.getJID()); - transmitter.sendJupiterRequest(this, request, request.getJID()); + log.debug("Send request to client: " + request + + request.getJID()); + transmitter.sendJupiterRequest(this, request, request + .getJID()); } - } - else{ - log.debug("Send request to host : "+request); + } else { + log.debug("Send request to host : " + request); transmitter.sendJupiterRequest(this, request, host.getJid()); } -// connection.sendOperation(new NetworkRequest(this.jid,request.getJID(),request), 0); + // connection.sendOperation(new + // NetworkRequest(this.jid,request.getJID(),request), 0); } catch (InterruptedException e) { e.printStackTrace(); } } - - - } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/AdvancedPreferencePage.java b/src/de/fu_berlin/inf/dpp/ui/AdvancedPreferencePage.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/AdvancedPreferencePage.java rename to src/de/fu_berlin/inf/dpp/ui/AdvancedPreferencePage.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/ErrorMessageDialog.java b/src/de/fu_berlin/inf/dpp/ui/ErrorMessageDialog.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/ErrorMessageDialog.java rename to src/de/fu_berlin/inf/dpp/ui/ErrorMessageDialog.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/IRosterTree.java b/src/de/fu_berlin/inf/dpp/ui/IRosterTree.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/IRosterTree.java rename to src/de/fu_berlin/inf/dpp/ui/IRosterTree.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/InvitationDialog.java b/src/de/fu_berlin/inf/dpp/ui/InvitationDialog.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/InvitationDialog.java rename to src/de/fu_berlin/inf/dpp/ui/InvitationDialog.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/MessagingWindow.java b/src/de/fu_berlin/inf/dpp/ui/MessagingWindow.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/MessagingWindow.java rename to src/de/fu_berlin/inf/dpp/ui/MessagingWindow.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/PreferencePage.java b/src/de/fu_berlin/inf/dpp/ui/PreferencePage.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/PreferencePage.java rename to src/de/fu_berlin/inf/dpp/ui/PreferencePage.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/RosterView.java b/src/de/fu_berlin/inf/dpp/ui/RosterView.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/RosterView.java rename to src/de/fu_berlin/inf/dpp/ui/RosterView.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/SarosUI.java b/src/de/fu_berlin/inf/dpp/ui/SarosUI.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/SarosUI.java rename to src/de/fu_berlin/inf/dpp/ui/SarosUI.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/SessionView.java b/src/de/fu_berlin/inf/dpp/ui/SessionView.java similarity index 94% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/SessionView.java rename to src/de/fu_berlin/inf/dpp/ui/SessionView.java index 7d5d25ed8afeb52902f92fed35b406d9fa57fc1b..b53c6053d97fe7dfddf04f6d5b1b42e7a9b00ace 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/SessionView.java +++ b/src/de/fu_berlin/inf/dpp/ui/SessionView.java @@ -64,6 +64,7 @@ import de.fu_berlin.inf.dpp.ui.actions.FollowModeAction; import de.fu_berlin.inf.dpp.ui.actions.GiveDriverRoleAction; import de.fu_berlin.inf.dpp.ui.actions.OpenInviteInterface; import de.fu_berlin.inf.dpp.ui.actions.LeaveSessionAction; +import de.fu_berlin.inf.dpp.ui.actions.RemoveAllDriverRoleAction; import de.fu_berlin.inf.dpp.ui.actions.TakeDriverRoleAction; @@ -75,6 +76,8 @@ public class SessionView extends ViewPart private ISharedProject sharedProject; private GiveDriverRoleAction giveDriverRoleAction; + + private TakeDriverRoleAction takeDriverRoleAction; private IPreferenceStore store = null; @@ -266,6 +269,7 @@ public class SessionView extends ViewPart viewer.setInput(null); giveDriverRoleAction = new GiveDriverRoleAction(viewer); + takeDriverRoleAction = new TakeDriverRoleAction(viewer); contributeToActionBars(); hookContextMenu(); @@ -303,7 +307,7 @@ public class SessionView extends ViewPart IToolBarManager toolBar = bars.getToolBarManager(); toolBar.add(new OpenInviteInterface()); - toolBar.add(new TakeDriverRoleAction()); + toolBar.add(new RemoveAllDriverRoleAction()); toolBar.add(new FollowModeAction()); toolBar.add(new LeaveSessionAction()); } @@ -325,6 +329,7 @@ public class SessionView extends ViewPart private void fillContextMenu(IMenuManager manager) { manager.add(giveDriverRoleAction); + manager.add(takeDriverRoleAction); // Other plug-ins can contribute there actions here manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/ConnectDisconnectAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/ConnectDisconnectAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/ConnectDisconnectAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/ConnectDisconnectAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/DeleteContactAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/DeleteContactAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/DeleteContactAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/DeleteContactAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/FollowModeAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/FollowModeAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/FollowModeAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/FollowModeAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/GiveDriverRoleAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/GiveDriverRoleAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/GiveDriverRoleAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/GiveDriverRoleAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/InviteAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/InviteAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/InviteAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/InviteAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/JumpToDriverPositionAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/JumpToDriverPositionAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/JumpToDriverPositionAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/JumpToDriverPositionAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/LeaveSessionAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/LeaveSessionAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/LeaveSessionAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/LeaveSessionAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/MessagingAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/MessagingAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/MessagingAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/MessagingAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewAccountAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/NewAccountAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewAccountAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/NewAccountAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewContactAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/NewContactAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewContactAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/NewContactAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewSessionAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/NewSessionAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewSessionAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/NewSessionAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/OpenInviteInterface.java b/src/de/fu_berlin/inf/dpp/ui/actions/OpenInviteInterface.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/OpenInviteInterface.java rename to src/de/fu_berlin/inf/dpp/ui/actions/OpenInviteInterface.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/TakeDriverRoleAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/RemoveAllDriverRoleAction.java similarity index 71% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/TakeDriverRoleAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/RemoveAllDriverRoleAction.java index 7dbc75fe7fa99a505cb2e4f1bc44b0a0c5347c19..ab4b8003d02639f2fb79af530070c4862568028b 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/TakeDriverRoleAction.java +++ b/src/de/fu_berlin/inf/dpp/ui/actions/RemoveAllDriverRoleAction.java @@ -22,20 +22,27 @@ package de.fu_berlin.inf.dpp.ui.actions; import org.eclipse.jface.action.Action; import de.fu_berlin.inf.dpp.Saros; +import de.fu_berlin.inf.dpp.User; +import de.fu_berlin.inf.dpp.User.UserRole; import de.fu_berlin.inf.dpp.invitation.IIncomingInvitationProcess; import de.fu_berlin.inf.dpp.net.JID; import de.fu_berlin.inf.dpp.project.ISessionListener; import de.fu_berlin.inf.dpp.project.ISharedProject; import de.fu_berlin.inf.dpp.project.ISharedProjectListener; import de.fu_berlin.inf.dpp.ui.SarosUI; - -public class TakeDriverRoleAction extends Action implements ISharedProjectListener, +/** + * this action remove all remote driver from project. Only the project host has + * the driver role after this action is executed. + * @author orieger + * + */ +public class RemoveAllDriverRoleAction extends Action implements ISharedProjectListener, ISessionListener { - public TakeDriverRoleAction() { - super("Take user driver role"); + public RemoveAllDriverRoleAction() { + super("Take remote user driver roles"); setImageDescriptor(SarosUI.getImageDescriptor("icons/user_edit.png")); - setToolTipText("Take driver role"); + setToolTipText("Take remote driver roles"); Saros.getDefault().getSessionManager().addSessionListener(this); updateEnablement(); @@ -43,7 +50,14 @@ public class TakeDriverRoleAction extends Action implements ISharedProjectListen @Override public void run() { - getSharedProject().setDriver(getSharedProject().getHost(), false); +// getSharedProject().setDriver(getSharedProject().getHost(), false); + ISharedProject project = Saros.getDefault().getSessionManager().getSharedProject(); + for(User user : project.getParticipants()){ + + if(user.getUserRole() == UserRole.DRIVER && !project.getHost().equals(user)){ + project.removeDriver(user, false); + } + } } /* @@ -104,7 +118,9 @@ public class TakeDriverRoleAction extends Action implements ISharedProjectListen private void updateEnablement() { ISharedProject project = getSharedProject(); - setEnabled(project != null && project.isHost() && !project.isDriver()); + boolean enabled = (project != null && project.isHost()); + setEnabled(enabled); +// setEnabled(project != null && project.isHost() && !project.isDriver()); } private ISharedProject getSharedProject() { diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/RenameContactAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/RenameContactAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/RenameContactAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/RenameContactAction.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/SkypeAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/SkypeAction.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/SkypeAction.java rename to src/de/fu_berlin/inf/dpp/ui/actions/SkypeAction.java diff --git a/src/de/fu_berlin/inf/dpp/ui/actions/TakeDriverRoleAction.java b/src/de/fu_berlin/inf/dpp/ui/actions/TakeDriverRoleAction.java new file mode 100644 index 0000000000000000000000000000000000000000..ddca1f014efc3b3f4b6848b4e58e2521e83924b9 --- /dev/null +++ b/src/de/fu_berlin/inf/dpp/ui/actions/TakeDriverRoleAction.java @@ -0,0 +1,109 @@ +package de.fu_berlin.inf.dpp.ui.actions; + +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.actions.SelectionProviderAction; + +import de.fu_berlin.inf.dpp.Saros; +import de.fu_berlin.inf.dpp.User; +import de.fu_berlin.inf.dpp.invitation.IIncomingInvitationProcess; +import de.fu_berlin.inf.dpp.net.JID; +import de.fu_berlin.inf.dpp.project.ISessionListener; +import de.fu_berlin.inf.dpp.project.ISharedProject; +import de.fu_berlin.inf.dpp.project.ISharedProjectListener; +import de.fu_berlin.inf.dpp.ui.SarosUI; + +public class TakeDriverRoleAction extends SelectionProviderAction implements +ISharedProjectListener, ISessionListener { + private User selectedUser; + + public TakeDriverRoleAction(ISelectionProvider provider) { + super(provider, "Take driver role"); + setImageDescriptor(SarosUI.getImageDescriptor("icons/user.png")); + setToolTipText("Take the driver role from this user."); + + Saros.getDefault().getSessionManager().addSessionListener(this); + updateEnablemnet(); + } + + @Override + public void run() { + ISharedProject project = Saros.getDefault().getSessionManager().getSharedProject(); +// project.setDriver(selectedUser, false); + project.removeDriver(selectedUser, false); + } + + @Override + public void selectionChanged(IStructuredSelection selection) { + selectedUser = (selection.size() == 1) ? (User) selection.getFirstElement() : null; + + updateEnablemnet(); + } + + /* + * (non-Javadoc) + * + * @see de.fu_berlin.inf.dpp.listeners.ISessionListener + */ + public void sessionStarted(ISharedProject session) { + session.addListener(this); + } + + /* + * (non-Javadoc) + * + * @see de.fu_berlin.inf.dpp.listeners.ISessionListener + */ + public void sessionEnded(ISharedProject session) { + session.removeListener(this); + } + + /* + * (non-Javadoc) + * + * @see de.fu_berlin.inf.dpp.listeners.ISessionListener + */ + public void invitationReceived(IIncomingInvitationProcess process) { + // ignore + } + + /* + * (non-Javadoc) + * + * @see de.fu_berlin.inf.dpp.listeners.ISharedProjectListener + */ + public void driverChanged(JID driver, boolean replicated) { + updateEnablemnet(); + } + + /* + * (non-Javadoc) + * + * @see de.fu_berlin.inf.dpp.listeners.ISharedProjectListener + */ + public void userJoined(JID user) { + // ignore + } + + /* + * (non-Javadoc) + * + * @see de.fu_berlin.inf.dpp.listeners.ISharedProjectListener + */ + public void userLeft(JID user) { + // ignore + } + + private void updateEnablemnet() { + ISharedProject project = Saros.getDefault().getSessionManager().getSharedProject(); + + boolean enabled = (project != null + && selectedUser != null + && project.isHost() + && !project.getHost().equals(selectedUser) + && project.isDriver(selectedUser)); + setEnabled(enabled); +// setEnabled(project != null && (project.isDriver() /*|| project.isHost()*/) +// && selectedUser != null && !project.getDriver().equals(selectedUser)); + } +} diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/decorators/SharedProjectDecorator.java b/src/de/fu_berlin/inf/dpp/ui/decorators/SharedProjectDecorator.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/decorators/SharedProjectDecorator.java rename to src/de/fu_berlin/inf/dpp/ui/decorators/SharedProjectDecorator.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/AddContactWizard.java b/src/de/fu_berlin/inf/dpp/ui/wizards/AddContactWizard.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/AddContactWizard.java rename to src/de/fu_berlin/inf/dpp/ui/wizards/AddContactWizard.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/ConfigurationWizard.java b/src/de/fu_berlin/inf/dpp/ui/wizards/ConfigurationWizard.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/ConfigurationWizard.java rename to src/de/fu_berlin/inf/dpp/ui/wizards/ConfigurationWizard.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/CreateAccountWizard.java b/src/de/fu_berlin/inf/dpp/ui/wizards/CreateAccountWizard.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/CreateAccountWizard.java rename to src/de/fu_berlin/inf/dpp/ui/wizards/CreateAccountWizard.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/IWizardPage2.java b/src/de/fu_berlin/inf/dpp/ui/wizards/IWizardPage2.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/IWizardPage2.java rename to src/de/fu_berlin/inf/dpp/ui/wizards/IWizardPage2.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/JoinSessionWizard.java b/src/de/fu_berlin/inf/dpp/ui/wizards/JoinSessionWizard.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/JoinSessionWizard.java rename to src/de/fu_berlin/inf/dpp/ui/wizards/JoinSessionWizard.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/NetworkSettingsPage.java b/src/de/fu_berlin/inf/dpp/ui/wizards/NetworkSettingsPage.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/NetworkSettingsPage.java rename to src/de/fu_berlin/inf/dpp/ui/wizards/NetworkSettingsPage.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/PrivacyPage.java b/src/de/fu_berlin/inf/dpp/ui/wizards/PrivacyPage.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/PrivacyPage.java rename to src/de/fu_berlin/inf/dpp/ui/wizards/PrivacyPage.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/PropertyConfigurationWizard.java b/src/de/fu_berlin/inf/dpp/ui/wizards/PropertyConfigurationWizard.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/PropertyConfigurationWizard.java rename to src/de/fu_berlin/inf/dpp/ui/wizards/PropertyConfigurationWizard.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/RegisterAccountPage.java b/src/de/fu_berlin/inf/dpp/ui/wizards/RegisterAccountPage.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/RegisterAccountPage.java rename to src/de/fu_berlin/inf/dpp/ui/wizards/RegisterAccountPage.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/WizardDialogAccessable.java b/src/de/fu_berlin/inf/dpp/ui/wizards/WizardDialogAccessable.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/wizards/WizardDialogAccessable.java rename to src/de/fu_berlin/inf/dpp/ui/wizards/WizardDialogAccessable.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/util/FileZipper.java b/src/de/fu_berlin/inf/dpp/util/FileZipper.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/util/FileZipper.java rename to src/de/fu_berlin/inf/dpp/util/FileZipper.java diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/util/PacketProtokollLogger.java b/src/de/fu_berlin/inf/dpp/util/PacketProtokollLogger.java similarity index 100% rename from de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/util/PacketProtokollLogger.java rename to src/de/fu_berlin/inf/dpp/util/PacketProtokollLogger.java