public function test1()
    {
        // pages creation
        // Form:author
        $pageName = 'Form:Author';
        $formauthor = '<noinclude>
This is the &quot;Author&quot; form.
To add a page with this form, enter the page name below;
if a page with that name already exists, you will be sent to a form to edit that page.


{{#forminput:Author}}

</noinclude><includeonly>
<div id=&quot;wikiPreview&quot; style=&quot;display: none; border-bottom: 1px solid #AAAAAA;&quot;></div>
{{{for template|Author}}}
{| class=&quot;formtable&quot;
! Country:
| {{{field|Country}}}
|}
{{{end template}}}

\'\'\'Free text:\'\'\'

{{{standard input|free text|rows=10}}}


{{{standard input|summary}}}

{{{standard input|minor edit}}} {{{standard input|watch}}}

{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}}
</includeonly>
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName, $formauthor), 'Failed to create page ' . $pageName . ' (' . $this->p2pBot1->bot->results . ')');
        // Form:book
        $pageName1 = 'Form:Book';
        $formbook = '<noinclude>
This is the &quot;Book&quot; form.
To add a page with this form, enter the page name below;
if a page with that name already exists, you will be sent to a form to edit that page.


{{#forminput:Book}}

</noinclude><includeonly>
<div id=&quot;wikiPreview&quot; style=&quot;display: none; border-bottom: 1px solid #AAAAAA;&quot;></div>
{{{for template|Book}}}
{| class=&quot;formtable&quot;
! Authors:
| {{{field|Authors}}}
|-
! Genres:
| {{{field|Genres}}}
|-
! Year:
| {{{field|Year}}}
|-
! Number of pages:
| {{{field|Number of pages}}}
|}
{{{end template}}}

\'\'\'Free text:\'\'\'

{{{standard input|free text|rows=10}}}


{{{standard input|summary}}}

{{{standard input|minor edit}}} {{{standard input|watch}}}

{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}}
</includeonly>
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName1, $formbook), 'Failed to create page ' . $pageName1 . ' (' . $this->p2pBot1->bot->results . ')');
        // Property:Has genre
        $pageName2 = 'Property:Has_genre';
        $hasgenre = 'This is a property of type [[Has type::String]].

The allowed values for this property are:
* [[Allows value::Art]]
* [[Allows value::Cookbook]]
* [[Allows value::Fiction]]
* [[Allows value::History]]
* [[Allows value::Poetry]]
* [[Allows value::Science]]
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName2, $hasgenre), 'Failed to create page ' . $pageName2 . ' (' . $this->p2pBot1->bot->results . ')');
        // Property:Has number of pages
        $pageName3 = 'Property:Has_number_of_pages';
        $nbpages = 'This is a property of type [[Has type::Number]].
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName3, $nbpages), 'Failed to create page ' . $pageName3 . ' (' . $this->p2pBot1->bot->results . ')');
        // Property:Is from country
        $pageName4 = 'Property:Is_from_country';
        $isfromcountry = 'This is a property of type [[Has type::String]].
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName4, $isfromcountry), 'Failed to create page ' . $pageName4 . ' (' . $this->p2pBot1->bot->results . ')');
        // Property:Was published in year
        $pageName5 = 'Property:Was_published_in_year';
        $pubyear = 'This is a property of type [[Has type::Number]].
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName5, $pubyear), 'Failed to create page ' . $pageName5 . ' (' . $this->p2pBot1->bot->results . ')');
        // Property:Was written by
        $pageName6 = 'Property:Was_written_by';
        $written = 'This is a property of type [[Has type::Page]].
[[Category:package]]
This property uses the form [[Has default form::Form:Author]].';
        $this->assertTrue($this->p2pBot1->createPage($pageName6, $written), 'Failed to create page ' . $pageName6 . ' (' . $this->p2pBot1->bot->results . ')');
        // Template:Book
        //        $pageName7 = 'Template:Book';
        //        $tampBook = '<noinclude>
        // This is the &quot;Book&quot; template.
        // It should be called in the following format:
        // <pre>
        // {{Book
        // |Authors=
        // |Genres=
        // |Year=
        // |Number of pages=
        // }}
        // </pre>
        // Edit the page to see the template text.
        // </noinclude><includeonly>
        // {| class=&quot;wikitable&quot;
        // ! Author(s)
        // | {{#arraymap:{{{Authors|}}}|,|x|[[Was written by::x]]}}
        // |-
        // ! Genre(s)
        // | {{#arraymap:{{{Genres|}}}|,|x|[[Has genre::x]]}}
        // |-
        // ! Year of publication
        // | [[Was published in year::{{{Year|}}}]]
        // |-
        // ! Number of pages
        // | [[Has number of pages::{{{Number of pages|}}}]]
        // |}
        //
        // [[Category:Books]]
        // </includeonly>
        // [[Category:package]]
        // ';
        //        $this->assertTrue($this->p2pBot1->createPage($pageName7,$tampBook),
        //            'Failed to create page '.$pageName7.' ('.$this->p2pBot1->bot->results.')');
        //
        //        //Template:Author
        //        $pageName8 = 'Template:Author';
        //        $tampAuthor = '<noinclude>
        // This is the &quot;Author&quot; template.
        // It should be called in the following format:
        // <pre>
        // {{Author
        // |Country=
        // }}
        // </pre>
        // Edit the page to see the template text.
        // </noinclude><includeonly>
        // {| class=&quot;wikitable&quot;
        // ! Country of origin
        // | [[Is from country::{{{Country|}}}]]
        // |-
        // ! Books by this author
        // | {{#ask:[[Was written by::{{SUBJECTPAGENAME}}]]|format=list}}
        // |}
        //
        // [[Category:Authors]]
        // </includeonly>
        // [[Category:package]]';
        //
        // $this->assertTrue($this->p2pBot1->createPage($pageName8,$tampAuthor),
        //            'Failed to create page '.$pageName8.' ('.$this->p2pBot1->bot->results.')');
        // create push on wiki1
        $pushName = 'PushPackage';
        $pushRequest = '[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPush($pushName, $pushRequest), 'Failed to create push : ' . $pushName . ' (' . $this->p2pBot1->bot->results . ')');
        // push on wiki1
        $this->assertTrue($this->p2pBot1->push('PushFeed:' . $pushName), 'failed to push ' . $pushName . ' (' . $this->p2pBot2->bot->results . ')');
        // create pull on wiki2
        $pullName = 'PullPackage';
        $this->assertTrue($this->p2pBot2->createPull($pullName, $this->wiki1, $pushName), 'failed to create pull ' . $pullName . ' (' . $this->p2pBot2->bot->results . ')');
        // pull
        $this->assertTrue($this->p2pBot2->Pull('PullFeed:' . $pullName), 'failed to pull ' . $pullName . ' (' . $this->p2pBot2->bot->results . ')');
        // assert pages exist
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName1);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName2);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName3);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName4);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName5);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName6);
        //        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName7);
        //        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName8);
        // assert that there is the same changeSet on the 2 wikis
        $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID');
        $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID');
        $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis');
        // assert that there is the same patch on the 2 wikis
        $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID');
        $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]]', '-3FpatchID');
        $PatchonWiki1 = arraytolower($PatchonWiki1);
        $PatchonWiki2 = arraytolower($PatchonWiki2);
        $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis');
        // assert that wiki1/page == wiki2/page
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName1);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName2);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName3);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName4);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName5);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName6);
    }
 /**
  * Create one page with tow attachment, push it
  * pull it on wiki2
  * modify the attachment on wiki2 , push it
  * pull it on wiki1
  * the tow wiki must have the same page and attachment
  */
 public function testSimple1()
 {
     // create page
     $this->assertTrue($this->p2pBot1->createPage($this->pageName, $this->content), 'Failed to create page ' . $this->pageName . ' (' . $this->p2pBot1->bot->results . ')');
     // assert page Ours exist on wiki1
     assertPageExist($this->p2pBot1->bot->wikiServer, $this->pageName);
     // upload the file on wiki1
     $this->assertTrue($this->p2pBot1->uploadFile($this->fileDir . $this->file11, $this->file, '0'));
     // test if the good file was upload on wiki1
     $this->assertTrue($this->p2pBot1->getFileFeatures($this->file, $this->file_size1));
     // edit File:Ours.jpg on wiki1
     $this->assertTrue($this->p2pBot1->editPage($this->filePage, $this->pushRequest), 'failed to edit page ' . $this->filePage . ' ( ' . $this->p2pBot1->bot->results . ' )');
     // upload the second file on wiki1
     $this->assertTrue($this->p2pBot1->uploadFile($this->fileDir . $this->file21, $this->file2, '0'));
     // test if the good file was upload on wiki1
     $this->assertTrue($this->p2pBot1->getFileFeatures($this->file2, $this->file_size3));
     // edit File:Ours.pdf on wiki1
     $this->assertTrue($this->p2pBot1->editPage($this->filePage2, $this->pushRequest), 'failed to edit page ' . $this->filePage . ' ( ' . $this->p2pBot1->bot->results . ' )');
     // create push on wiki1
     $this->assertTrue($this->p2pBot1->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot1->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot1->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create pull on wiki2
     $this->assertTrue($this->p2pBot2->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot2->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot2->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // change file on wiki2
     $this->assertTrue($this->p2pBot2->uploadFile($this->fileDir . $this->file12, $this->file, '1'));
     // test if the good file was upload on wiki2
     $this->assertTrue($this->p2pBot2->getFileFeatures($this->file, $this->file_size2));
     // change second file on wiki2
     $this->assertTrue($this->p2pBot2->uploadFile($this->fileDir . $this->file22, $this->file2, '1'));
     // test if the good file was upload on wiki2
     $this->assertTrue($this->p2pBot2->getFileFeatures($this->file2, $this->file_size4));
     // create push on wiki2
     $this->assertTrue($this->p2pBot2->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot2->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot2->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create pull on wiki1
     $this->assertTrue($this->p2pBot1->createPull($this->pullName, $this->wiki2, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot1->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')');
     // test if the good file was upload on wiki1
     $this->assertTrue($this->p2pBot1->getFileFeatures($this->file, $this->file_size2));
     // test if the good file was upload on wiki1
     $this->assertTrue($this->p2pBot1->getFileFeatures($this->file2, $this->file_size4));
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID');
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals(count($PatchonWiki1), count($PatchonWiki2));
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage2 . ']]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage2 . ']]', '-3FpatchID');
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals(count($PatchonWiki1), count($PatchonWiki2));
     // assert that wiki1/File:Ours == wiki2/File:Ours
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->filePage);
     // assert that wiki1/File:Ours == wiki2/File:Ours
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->filePage2);
 }
Example #3
0
 public function testSimple2()
 {
     $text = "DSMW implements the Logoot algorithm (see [[Presentation_and_Papers|Papers and presentations]]).\nThis algorithm allows automatic resolution of edition conflicts.\n\nWhat we call \"conflict\" is when there is a concurrent editing on an article i.e. the same article has been modified by many users. For instance, this is the case when a user  edits her local copy of a page and pulls remote modifications on this page.\n\n==Summary==\n\n\nIn the following table, we summarize the different cases of concurrent editing and the result produced by the merge algorithm.\nThe first column presents the content of the  '''initial state''' of the page.\n'''DSMW server1''' and '''DSMW server2''' represent two concurrent modifications on the same initial state.\n'''Results''' is the convergent state i.e. the state that will reached on all servers after complete propagation of concurrent changes...\n\n\n{|  border='1' cellpadding='5' cellspacing='0'\n|   valign='top' |  Scenario\n|   valign='top' |  Initial state\n|   valign='top' |  DSMW server1\n|   valign='top' |  DSMW server2\n|   valign='top' |  Results\n|   valign='top' |  Comments\n<div class='vspace'></div>\n|-\n|   valign='top' |   Insert/Insert at different lines\n|   valign='top' |  initial_line\n|   valign='top' | <span  style='color: red;'>inserted_line1 <br clear='all' /></span><span  style='color: black;'>initial_line </span>\n|   valign='top' | <span  style='color: black;'>initial_line <br clear='all' /></span><span  style='color: green;'>inserted_line2 </span>\n|   valign='top' | <span  style='color: red;'>inserted_line1 <br clear='all' /></span><span  style='color: black;'>initial_line <br clear='all' /></span><span  style='color: green;'>inserted_line2 </span>\n|   valign='top' | <ul><li>DSMW server1 inserts a line before the initial line and DSMW server2 inserts a line after the initial line\n</li></ul><div class='vspace'></div>\n|-\n|   valign='top' |  Ins/ins the same line\n|   valign='top' |  initial_line1 <br clear='all' /> initial_line2\n|   valign='top' |  initial_line1 <br clear='all' /><span  style='color: red;'>inserted_line1 <br clear='all' /></span><span  style='color: black;'>initial_line2 </span>\n|   valign='top' |  initial_line1 <br clear='all' /><span  style='color: green;'>inserted_line2 <br clear='all' /></span><span  style='color: black;'>initial_line2 </span>\n|   valign='top' | <ul><li>initial_line1 <br clear='all' /><span  style='color: red;'>inserted_line1 <br clear='all' /></span><span  style='color: green;'>inserted_line2 <br clear='all' /></span><span  style='color: black;'>initial_line2 </span></li></ul><p>or\n</p><ul><li>initial_line1 <br clear='all' /><span  style='color: green;'>inserted_line2  <br clear='all' /></span><span  style='color: red;'>inserted_line1 <br clear='all' /></span><span  style='color: black;'>initial_line2 </span></li></ul>\n|   valign='top' | <ul><li>DSMW server1 and 2 insert a different line between the initial lines\n</li></ul><div class='vspace'></div>\n|-\n|   valign='top' | update/update the same line\n|   valign='top' |  XXX\n|   valign='top' |  XX<span  style='color: red;'>Y </span>\n|   valign='top' |  XX<span  style='color: green;'>Z </span>\n|   valign='top' | <ul><li>XX<span  style='color: red;'>Y <br clear='all' /></span><span  style='color: black;'>XX</span><span  style='color: green;'>Z </span></li></ul><p>or\n</p><ul><li><span  style='color: black;'>XX</span><span  style='color: green;'>Z <br clear='all' /></span><span  style='color: black;'>XX</span><span  style='color: red;'>Y </span></li></ul>\n|   valign='top' | <ul><li>DSMW server1 and 2 update the initial line with a different letter\n</li><li>There is no update operation in DSMW, update is equivalent to delete old line and insert a new one with the new content\n</li><li>The *or* does not means that we can have one value in one site and another in another site. Logoot will decide the convergent state by choosing one solution\n</li></ul><div class='vspace'></div>\n|-\n|   valign='top' |  update/delete same line\n|   valign='top' |  XXX\n|   valign='top' |  XX<span  style='color: red;'>Y </span>\n|   valign='top' | <span  style='color: red;'><em><del>line deleted</del></em></span>\n|   valign='top' |  XX<span  style='color: red;'>Y </span>\n|   valign='top' | <ul><li>DSMW server1 updates the initial line and DSMW server2 deletes the initial line\n</li></ul><div class='vspace'></div>\n|-\n|   valign='top' |  Del/Del the same line\n|   valign='top' |  initial_line\n|   valign='top' | <span  style='color: red;'><em><del>line deleted</del></em></span>\n|   valign='top' | <span  style='color: red;'><em><del>line deleted</del></em></span>\n|   valign='top' | <span  style='color: red;'><em><del>line deleted</del></em></span>\n|   valign='top' | <ul><li>DSMW server1 and server2 delete the &ldquo;initial_line&rdquo;\n</li></ul>\n|}\n\n[[Category:DSMWDocumentation]]\n";
     $text1 = "* DSMW2 will subscribe to the DSMW1 push feed. Go to the and tp '''DSMW Admin functions'''  on the '''special pages''' and click on '''[ADD]''' beside   PULL. This leads to the following form:\n\n\n[[Image:2-1addpull1.png]]\n\n\n* Complete this form with the Server URL, the PushFeed name (informations received from DSMW1 user) and the PullFeed name. In this tutorial, the server URL is: \"http://localhost/wiki1\", the PushFeed Name is: \"PushTutorial\" and the  PullFeedName is \"PullTutorial\" as showing below:\n\nNote that the PullFeed name is free, we use this one only for the example.\n\n\n[[Image:2-2addpull1.png]]\n----\n'''''Since DSMW-0.6, this page has been modified and has the layout represented by the image below'''''\n\n[[Image:pullpagecreation.png]]\n----\n\n\n'''Important:''' the PushFeed name is case sensitive, if you do not respect that  (and you will not get the expected informations).\n\n* Click on the '''ADD''' button to create  the PullFeed \"PullTutorial\".\n\n\n[[Image:pulltutorial2.png]]\n\n\nNote that we could \"pull\" the informations directly in this page, but we will use Administration page, so follow the link '''Special:ArticleAdminPage''' under the \"PULL\" button.\n\nRemark: We pull from the DSMW Administration page because we wanted to show you that you can see more informations on this page (and that you could pull more than one pullFeed, if they were more than one...).\n\n\n[[Image:2-4adminpage.png]]\n\n\nIf you want to see how many patches are available on remote server  click on \"'''[Display]'''\" and the pullfeed table will appear like this:\n\n\n[[Image:2-4-1adminpage.png]]\n\n\n* Select the PullFeed you have just created by check the checkbox and click on the '''PULL''' button. A ChangeSet page that  recapitulates the \"pulled\" informations (including the identifier of patches) is created.\n\n\n[[Image:changeset2.png]]\n\n\n* Now the \"pull\" procedure is completed on DSMW2, you should have the 2 articles \"Hello\" and \"World\" on DSMW2. Let's check it...\n\nWrite \"Hello\" in the search box and click on the button \"go\".\n\n\n[[Image:2-6hellopage.png]]\n\n\n...and...\n\n\n[[Image:2-8worldpage.png]]\n\n\n* Let us take a look to the Administration tab informations:\n\n\n[[Image:DSMWonHello2b.png]]\n\n\n...and...\n\n\n[[Image:DSMWonWorld2.png]]\n\n\n'''Remark: '''we have  the right informations, a  grey tinted patch means that a remote patch has been locally integrated.\n\nWe have the right informations because we made one modifications on Hello that are 2 insertions and one modification with 4 inserts.\n\n* Let us take a look to the \"DSMW Admin functions\" page informations:\n\n\n[[Image:2-10adminpage.png]]\n\n\nThe informations are updated!  You can  display remote patches:\n\n\n[[Image:2-10-1adminpage.png]]\n\n\n''Congratulations, you finished the first execution scenario with DSMW. Now you can enjoy playing with DSMW. If you want to learn more about the using of DSMW see the different [[DSMW User Manual|documentations]]''.\n\n[[Category:DSMWDocumentation]]\n";
     $this->assertTrue($this->p2pBot1->createPage('Conflict_Management1', $text));
     $this->p2pBot1->createPage('Subscription_Procedure1', $text1);
     $this->p2pBot1->createPush('PushDSMWDoc1', '[[Category:DSMWDocumentation]]');
     $this->p2pBot1->push('PushFeed:PushDSMWDoc1');
     $this->p2pBot2->createPull('PullDSMWDoc1', $this->p2pBot1->bot->wikiServer, 'PushDSMWDoc1');
     $this->p2pBot2->pull('PullFeed:PullDSMWDoc1');
     //assert that there is the same changeSet on the 2 wikis
     $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]][[inPushFeed::PushFeed:PushDSMWDoc1]]', '-3FchangeSetID');
     $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]][[inPullFeed::PullFeed:PullDSMWDoc1]]', '-3FchangeSetID');
     $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis');
     //assert that there is the same patch on the 2 wikis
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::Conflict_Management1]]', '-3FpatchID');
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::Conflict_Management1]]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis');
     $PatchonWiki3 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::Subscription_Procedure1]]', '-3FpatchID');
     $PatchonWiki4 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::Subscription_Procedure1]]', '-3FpatchID');
     $PatchonWiki3 = arraytolower($PatchonWiki3);
     $PatchonWiki4 = arraytolower($PatchonWiki4);
     $this->assertEquals($PatchonWiki3, $PatchonWiki4, 'patch are not equals on the 2 wikis');
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, 'Conflict_Management1');
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, 'Subscription_Procedure1');
 }
 /**
  * execute criss cross merge
 
 W1|W2
 1  2 - make change in 2 wiki
 |\/|
 |/\|
 3==4
 */
 public function testSimple3()
 {
     // create page
     $this->assertTrue($this->p2pBot1->createPage($this->pageName, $this->content), 'Failed to create page ' . $this->pageName . ' (' . $this->p2pBot1->bot->results . ')');
     // assert page Ours exist on wiki1
     assertPageExist($this->p2pBot1->bot->wikiServer, $this->pageName);
     // create push on wiki1
     $this->assertTrue($this->p2pBot1->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot1->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot1->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create page
     $this->assertTrue($this->p2pBot2->createPage($this->pageName, $this->content), 'Failed to create page ' . $this->pageName . ' (' . $this->p2pBot2->bot->results . ')');
     // assert page Ours exist on wiki2
     assertPageExist($this->p2pBot2->bot->wikiServer, $this->pageName);
     // create push on wiki2
     $this->assertTrue($this->p2pBot2->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot2->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot2->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create pull on wiki2
     $this->assertTrue($this->p2pBot2->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot2->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot2->pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create pull on wiki1
     $this->assertTrue($this->p2pBot1->createPull($this->pullName, $this->wiki2, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot1->pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')');
     // assert that there is the same changeSet on the 2 wikis
     $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]][[inPushFeed::' . $this->pushFeed . ']]', '-3FchangeSetID');
     $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]][[inPullFeed::' . $this->pullFeed . ']]', '-3FchangeSetID');
     $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis');
     // assert that there is the same patch on the 2 wikis
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->pageName . ']]', '-3FpatchID');
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->pageName . ']]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis');
     // assert that wiki1/File:Ours == wiki2/File:Ours
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->pageName);
 }
Example #5
0
 function testSimple3()
 {
     $this->testSimple1();
     $countCSonWiki1 = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'));
     //create push on wiki2
     $pushName = 'PushCity10';
     $pushRequest = '[[category:Lambach]]';
     $this->assertTrue($this->p2pBot2->createPush($pushName, $pushRequest), 'Failed to create push : ' . $pushName . ' (' . $this->p2pBot2->bot->results . ')');
     $this->assertTrue($this->p2pBot2->push('PushFeed:' . $pushName), 'failed to push ' . $pushName . ' (' . $this->p2pBot2->bot->results . ')');
     // assert that wiki1/Category:Lambach == wiki2/Category:Lambach
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, 'Category:Lambach');
     //create pull on wiki1
     $pullName = 'pullCity';
     $this->assertTrue($this->p2pBot1->createPull($pullName, $this->wiki2, $pushName), 'failed to create pull ' . $pullName . ' (' . $this->p2pBot1->bot->results . ')');
     //pull
     $this->assertTrue($this->p2pBot1->Pull('PullFeed:' . $pullName), 'failed to pull ' . $pullName . ' (' . $this->p2pBot1->bot->results . ')');
     $countCS = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'));
     //assert no patch created on wiki1
     $this->assertTrue($countCSonWiki1 == $countCS);
     // assert that wiki1/Category:Lambach == wiki2/Category:Lambach
     $contentWiki1 = getContentPage($this->p2pBot1->bot->wikiServer, 'Category:Lambach');
     $contentWiki2 = getContentPage($this->p2pBot2->bot->wikiServer, 'Category:Lambach');
     assertPageExist($this->p2pBot2->bot->wikiServer, 'Category:Lambach');
     $this->assertEquals($contentWiki1, $contentWiki2, 'Failed content page Lambach');
     //assert that there is the same patch on the 2 wikis
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID');
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals($PatchonWiki1, $PatchonWiki2);
     //assert that there is the same changeSet on the 2 wikis
     $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID');
     $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID');
     $this->assertEquals($CSonWiki1, $CSonWiki2);
 }
 /**
  * Create one page with an attachment, push it
  * pull it on wiki2
  * wiki2 change the file, pull the page
  * wiki1 push the page and must have the new attachment on local
  */
 public function testSimple4()
 {
     $this->testSimple3();
     // change file on wiki2
     $this->assertTrue($this->p2pBot2->uploadFile($this->fileDir . $this->file2, $this->file, '1'));
     $PatchonWiki1 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $this->assertEquals(count($PatchonWiki1), 3);
     // test si le fichier a été uploder sur le wiki2
     $this->assertTrue($this->p2pBot2->getFileFeatures($this->file, $this->file_size2));
     // create push on wiki2
     $this->assertTrue($this->p2pBot2->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot1->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot2->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create pull on wiki1 from wiki2
     $this->assertTrue($this->p2pBot1->createPull($this->pullName, $this->wiki2, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot1->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')');
     // test if the good file was upload on wiki1 from wiki2
     $this->assertTrue($this->p2pBot1->getFileFeatures($this->file, $this->file_size2));
     assertPageExist($this->p2pBot1->bot->wikiServer, $this->filePage);
     // assert that there is the same changeSet on the 2 wikis
     $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]][[inPullFeed::' . $this->pullFeed . ']]', '-3FchangeSetID');
     $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]][[inPushFeed::' . $this->pushFeed . ']]', '-3FchangeSetID');
     $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis');
     // assert that there is the same patch on the 2 wikis
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID');
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis');
     // assert that wiki1/File:Ours == wiki2/File:Ours
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->filePage);
 }
 public function testSimple()
 {
     // wiki1 = prof1
     // wiki2 = prof2
     // wiki3 = student
     // create page on wiki1
     $pageNameLesson1 = 'Lesson1';
     $this->assertTrue($this->p2pBot1->createPage($pageNameLesson1, 'Intro.... [[type::Lesson]][[forYear::2009]]'), 'Failed to create page Exercises1 (' . $this->p2pBot1->bot->results . ')');
     $contentWiki1 = "test wiki1";
     echo sleep(10);
     $this->p2pBot1->editPage($pageNameLesson1, $contentWiki1);
     $this->assertTrue($this->p2pBot1->createPage('Exercises1', 'content exercises1 [[forYear::2009]] [[type::Exercise]]'), 'Failed to create page Exercises1 (' . $this->p2pBot1->bot->results . ')');
     $this->assertTrue($this->p2pBot1->createPage('Exam1', 'content exam1 [[forYear::2009]] [[type::Exam]]'), 'Failed to create page Exercises1 (' . $this->p2pBot1->bot->results . ')');
     $pageContentLesson1 = getContentPage($this->p2pBot1->bot->wikiServer, $pageNameLesson1);
     // push on wiki1 for prof2, only the lesson
     $this->assertTrue($this->p2pBot1->createPush('Course1', '[[type::Lesson]][[forYear::2009]]'), 'Failed to create push : Course1 (' . $this->p2pBot1->bot->results . ')');
     $this->assertTrue($this->p2pBot1->push('PushFeed:Course1'), 'failed to push ' . 'Course1' . ' (' . $this->p2pBot1->bot->results . ')');
     // pull on wiki2 from prof1 push
     $this->assertTrue($this->p2pBot2->createPull('Prof1Course1', $this->p2pBot1->bot->wikiServer, 'Course1'), 'failed to create pull Prof1Course1 (' . $this->p2pBot2->bot->results . ')');
     // sleep(10);
     $this->assertTrue($this->p2pBot2->Pull('PullFeed:Prof1Course1'), 'failed to pull Prof1Course1 (' . $this->p2pBot2->bot->results . ')');
     assertPageExist($this->p2pBot2->bot->wikiServer, 'Lesson1');
     assertContentEquals($this->p2pBot2->bot->wikiServer, $this->p2pBot1->bot->wikiServer, $pageNameLesson1);
     // edit page lesson1 on wiki2
     $addContent1 = 'edition on wiki2';
     $this->p2pBot2->editPage($pageNameLesson1, $addContent1);
     $pageContentLesson1 = getContentPage($this->p2pBot2->bot->wikiServer, $pageNameLesson1);
     // push on wiki2 for prof1 only the lesson
     $this->assertTrue($this->p2pBot2->createPush('Course1', '[[type::Lesson]][[forYear::2009]]'), 'Failed to create push : Course1 (' . $this->p2pBot2->bot->results . ')');
     $this->assertTrue($this->p2pBot2->push('PushFeed:Course1'), 'failed to push S1Course1 (' . $this->p2pBot2->bot->results . ')');
     // pull on wiki1 from prof2 push
     $this->assertTrue($this->p2pBot1->createPull('Prof2Course1', $this->p2pBot2->bot->wikiServer, 'Course1'), 'failed to create pull Prof2Course1 (' . $this->p2pBot1->bot->results . ')');
     $this->assertTrue($this->p2pBot1->Pull('PullFeed:Prof2Course1'), 'failed to pull Prof2Course1 (' . $this->p2pBot1->bot->results . ')');
     assertPageExist($this->p2pBot1->bot->wikiServer, 'Lesson1');
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageNameLesson1);
     // push on wiki1 for student, lessons and exercises
     $this->assertTrue($this->p2pBot1->createPush('S1Course1', '[[type::!Exam]][[forYear::2009]]'), 'Failed to create push : S1Course1 (' . $this->p2pBot1->bot->results . ')');
     $this->assertTrue($this->p2pBot1->push('PushFeed:S1Course1'), 'failed to push S1Course1 (' . $this->p2pBot2->bot->results . ')');
     // pull on wiki3 from prof1
     $this->assertTrue($this->p2pBot3->createPull('Prof1Course1', $this->p2pBot1->bot->wikiServer, 'S1Course1'), 'failed to create pull Prof1Course1 (' . $this->p2pBot3->bot->results . ')');
     $this->assertTrue($this->p2pBot3->Pull('PullFeed:Prof1Course1'), 'failed to pull Prof2Course1 (' . $this->p2pBot3->bot->results . ')');
     assertPageExist($this->p2pBot3->bot->wikiServer, 'Lesson1');
     assertContentEquals($this->p2pBot3->bot->wikiServer, $this->p2pBot1->bot->wikiServer, $pageNameLesson1);
     assertPageExist($this->p2pBot3->bot->wikiServer, 'Exercises1');
     assertContentEquals($this->p2pBot3->bot->wikiServer, $this->p2pBot1->bot->wikiServer, 'Exercises1');
     // edit page lesson1 on wiki3
     // $this->p2pBot3->bot->wikiLogin();
     $addContent = 'content from student';
     $this->assertTrue($this->p2pBot3->editPage('Lesson1', $addContent), 'failed to edit page Lesson1');
     $pageContentLesson1 = getContentPage($this->p2pBot3->bot->wikiServer, $pageNameLesson1);
     // push on wiki3 for prof1, lessons and exercises
     $this->assertTrue($this->p2pBot3->createPush('StudCourse1', '[[type::!Exam]][[forYear::2009]]'), 'failed to create push : StudCourse1 (' . $this->p2pBot3->bot->results . ')');
     $this->assertTrue($this->p2pBot3->push('PushFeed:StudCourse1'), 'failed to push StudCourse1 (' . $this->p2pBot3->bot->results . ')');
     // pull on wiki1 from student
     $this->assertTrue($this->p2pBot1->createPull('StudCourse1', $this->p2pBot3->bot->wikiServer, 'StudCourse1'), 'failed to create pull StudCourse1 (' . $this->p2pBot1->bot->results . ')');
     $this->assertTrue($this->p2pBot1->Pull('PullFeed:StudCourse1'), 'failed to pull StudCourse1 (' . $this->p2pBot1->bot->results . ')');
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot3->bot->wikiServer, $pageNameLesson1);
 }