jenkins-bot has submitted this change and it was merged.

Change subject: Follow up on compatibility breaks in Wikibase.
......................................................................


Follow up on compatibility breaks in Wikibase.

Change-Id: I56cf650f98e88c2cba7ad6ec78438b02ae807ded
---
M api/RunCrossCheck.php
M specials/SpecialExternalDbs.php
M tests/phpunit/Api/RunCrossCheckTest.php
M tests/phpunit/EvaluateCrossCheckJobServiceTest.php
M tests/phpunit/Specials/SpecialCrossCheckTest.php
5 files changed, 46 insertions(+), 41 deletions(-)

Approvals:
  Soeren.oldag: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/api/RunCrossCheck.php b/api/RunCrossCheck.php
index 4df22d1..b92eb63 100644
--- a/api/RunCrossCheck.php
+++ b/api/RunCrossCheck.php
@@ -4,14 +4,14 @@
 
 use ApiBase;
 use ApiMain;
-use DataValues\Serializers;
 use RequestContext;
+use DataValues\Serializers;
+use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Services\EntityId\EntityIdParser;
 use Wikibase\DataModel\Services\Statement\StatementGuidValidator;
 use Wikibase\Repo\Api\ApiErrorReporter;
 use Wikibase\Repo\Api\ApiHelperFactory;
 use Wikibase\Repo\Api\ResultBuilder;
-use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\Repo\WikibaseRepo;
 use WikibaseQuality\ExternalValidation\CrossCheck\CrossCheckInteractor;
 use WikibaseQuality\ExternalValidation\ExternalValidationServices;
@@ -28,6 +28,11 @@
  * @license GNU GPL v2+
  */
 class RunCrossCheck extends ApiBase {
+
+       /**
+        * @var EntityIdParser
+        */
+       private $entityIdParser;
 
        /**
         * @var StatementGuidValidator
@@ -55,11 +60,6 @@
        private $resultBuilder;
 
        /**
-        * @var EntityIdParser
-        */
-       private $idParser;
-
-       /**
         * Creates new instance from global state.
         *
         * @param ApiMain $main
@@ -75,11 +75,11 @@
                        $main,
                        $name,
                        $prefix,
+                       $repo->getEntityIdParser(),
                        $repo->getStatementGuidValidator(),
                        $externalValidationServices->getCrossCheckInteractor(),
                        $externalValidationServices->getSerializerFactory(),
-                       $repo->getApiHelperFactory( RequestContext::getMain() ),
-                       $repo->getEntityIdParser()
+                       $repo->getApiHelperFactory( RequestContext::getMain() )
                );
        }
 
@@ -87,18 +87,23 @@
         * @param ApiMain $main
         * @param string $name
         * @param string $prefix
+        * @param EntityIdParser $entityIdParser
+        * @param StatementGuidValidator $statementGuidValidator
+        * @param CrossCheckInteractor $crossCheckInteractor
+        * @param SerializerFactory $serializerFactory
+        * @param ApiHelperFactory $apiHelperFactory
         */
-       public function __construct( ApiMain $main, $name, $prefix = '', 
StatementGuidValidator $claimGuidValidator,
-                                                                
CrossCheckInteractor $crossCheckInteractor, SerializerFactory 
$serializerFactory,
-                                                                
ApiHelperFactory $apiHelperFactory, EntityIdParser $idParser ) {
+       public function __construct( ApiMain $main, $name, $prefix = '', 
EntityIdParser $entityIdParser,
+                                                                
StatementGuidValidator $statementGuidValidator, CrossCheckInteractor 
$crossCheckInteractor,
+                                                                
SerializerFactory $serializerFactory, ApiHelperFactory $apiHelperFactory ) {
                parent::__construct( $main, $name, $prefix );
 
-               $this->statementGuidValidator = $claimGuidValidator;
+               $this->entityIdParser = $entityIdParser;
+               $this->statementGuidValidator = $statementGuidValidator;
                $this->crossCheckInteractor = $crossCheckInteractor;
                $this->serializerFactory = $serializerFactory;
-               $this->errorReporter = $apiHelperFactory->getErrorReporter( 
$this );
                $this->resultBuilder = $apiHelperFactory->getResultBuilder( 
$this );
-               $this->idParser = $idParser;
+               $this->errorReporter = $apiHelperFactory->getErrorReporter( 
$this );
        }
 
        /**
@@ -142,7 +147,7 @@
         */
        private function parseEntityIds( array $entityIds ) {
                return array_map(
-                       array( $this->idParser, 'parse' ),
+                       array( $this->entityIdParser, 'parse' ),
                        $entityIds
                );
        }
diff --git a/specials/SpecialExternalDbs.php b/specials/SpecialExternalDbs.php
index abae13a..5da0a24 100644
--- a/specials/SpecialExternalDbs.php
+++ b/specials/SpecialExternalDbs.php
@@ -6,12 +6,8 @@
 use Language;
 use Linker;
 use SpecialPage;
-use Wikibase\DataModel\Services\EntityId\EntityIdFormatter;
 use Wikibase\DataModel\Services\Lookup\LanguageLabelDescriptionLookup;
 use Wikibase\DataModel\Services\Lookup\TermLookup;
-use Wikibase\Lib\EntityIdHtmlLinkFormatter;
-use Wikibase\Lib\LanguageNameLookup;
-use Wikibase\Lib\Store\EntityTitleLookup;
 use Wikibase\Repo\EntityIdHtmlLinkFormatterFactory;
 use Wikibase\Repo\WikibaseRepo;
 use WikibaseQuality\ExternalValidation\DumpMetaInformation\DumpMetaInformation;
@@ -25,7 +21,7 @@
 class SpecialExternalDbs extends SpecialPage {
 
        /**
-        * @var EntityIdFormatter
+        * @var EntityIdHtmlLinkFormatterFactory
         */
        private $entityIdLinkFormatter;
 
diff --git a/tests/phpunit/Api/RunCrossCheckTest.php 
b/tests/phpunit/Api/RunCrossCheckTest.php
index 83b76e7..83c4265 100644
--- a/tests/phpunit/Api/RunCrossCheckTest.php
+++ b/tests/phpunit/Api/RunCrossCheckTest.php
@@ -9,8 +9,9 @@
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\Entity\Property;
 use Wikibase\DataModel\Entity\PropertyId;
-use Wikibase\DataModel\Services\Statement\GuidGenerator;
+use Wikibase\DataModel\Services\Statement\V4GuidGenerator;
 use Wikibase\DataModel\Snak\PropertyValueSnak;
+use Wikibase\DataModel\Statement\StatementGuid;
 use Wikibase\Repo\WikibaseRepo;
 use Wikibase\Test\Repo\Api\WikibaseApiTestCase;
 use 
WikibaseQuality\ExternalValidation\DumpMetaInformation\SqlDumpMetaInformationRepo;
@@ -45,7 +46,7 @@
  * @author BP2014N1
  * @license GNU GPL v2+
  */
-class RunCrossCheckTest extends WikibaseApiTestcase {
+class RunCrossCheckTest extends WikibaseApiTestCase {
 
        /**
         * Id of a item that (hopefully) does not exist.
@@ -90,29 +91,29 @@
                        $store->saveEntity( $itemQ1, 'TestEntityQ1', 
$GLOBALS['wgUser'], EDIT_NEW );
                        self::$idMap['Q1'] = $itemQ1->getId();
 
-                       $guidGenerator = new GuidGenerator();
+                       $guidGenerator = new V4GuidGenerator();
 
                        $dataValue = new EntityIdValue( new ItemId( 
IDENTIFIER_PROPERTY_QID ) );
                        $snak = new PropertyValueSnak( new PropertyId( 
INSTANCE_OF_PID ), $dataValue );
-                       $claimGuid = $guidGenerator->newGuid( 
self::$idMap['P3'] );
+                       $claimGuid = self::$idMap['P3']->getSerialization() . 
StatementGuid::SEPARATOR . $guidGenerator->newGuid();
                        $propertyP3->getStatements()->addNewStatement( $snak, 
null, null, $claimGuid );
                        $store->saveEntity( $propertyP3, 'TestEntityP3',  
$GLOBALS['wgUser'], EDIT_UPDATE );
 
                        $dataValue = new StringValue( 'foo' );
                        $snak = new PropertyValueSnak( self::$idMap['P1'], 
$dataValue );
-                       $claimGuid = $guidGenerator->newGuid( 
self::$idMap['Q1'] );
+                       $claimGuid = self::$idMap['Q1']->getSerialization() . 
StatementGuid::SEPARATOR . $guidGenerator->newGuid();
                        self::$claimGuids['P1'] = $claimGuid;
                        $itemQ1->getStatements()->addNewStatement( $snak, null, 
null, $claimGuid );
 
                        $dataValue = new StringValue( 'baz' );
                        $snak = new PropertyValueSnak( self::$idMap['P2'], 
$dataValue );
-                       $claimGuid = $guidGenerator->newGuid( 
self::$idMap['Q1'] );
+                       $claimGuid = self::$idMap['Q1']->getSerialization() . 
StatementGuid::SEPARATOR . $guidGenerator->newGuid();
                        self::$claimGuids['P2'] = $claimGuid;
                        $itemQ1->getStatements()->addNewStatement( $snak, null, 
null, $claimGuid );
 
                        $dataValue = new StringValue( '1234' );
                        $snak = new PropertyValueSnak( self::$idMap['P3'], 
$dataValue );
-                       $claimGuid = $guidGenerator->newGuid( 
self::$idMap['Q1'] );
+                       $claimGuid = self::$idMap['Q1']->getSerialization() . 
StatementGuid::SEPARATOR . $guidGenerator->newGuid();
                        self::$claimGuids['P3'] = $claimGuid;
                        $itemQ1->getStatements()->addNewStatement( $snak, null, 
null, $claimGuid );
 
diff --git a/tests/phpunit/EvaluateCrossCheckJobServiceTest.php 
b/tests/phpunit/EvaluateCrossCheckJobServiceTest.php
index b09003d..289c227 100644
--- a/tests/phpunit/EvaluateCrossCheckJobServiceTest.php
+++ b/tests/phpunit/EvaluateCrossCheckJobServiceTest.php
@@ -3,7 +3,10 @@
 namespace WikibaseQuality\ExternalValidation\Tests;
 
 use Wikibase\DataModel\Entity\Item;
-use Wikibase\DataModel\Services\Statement\GuidGenerator;
+use Wikibase\DataModel\Entity\ItemId;
+use Wikibase\DataModel\Entity\PropertyId;
+use Wikibase\DataModel\Services\Statement\V4GuidGenerator;
+use Wikibase\DataModel\Statement\StatementGuid;
 use WikibaseQuality\ExternalValidation\EvaluateCrossCheckJobService;
 use WikibaseQuality\ExternalValidation\DumpMetaInformation\DumpMetaInformation;
 use WikibaseQuality\ExternalValidation\CrossCheck\Result\ComparisonResult;
@@ -11,8 +14,6 @@
 use Wikibase\DataModel\Reference;
 use WikibaseQuality\ExternalValidation\CrossCheck\Result\CrossCheckResult;
 use WikibaseQuality\ExternalValidation\CrossCheck\Result\CrossCheckResultList;
-use Wikibase\DataModel\Entity\PropertyId;
-use Wikibase\DataModel\Entity\ItemId;
 use DataValues\StringValue;
 
 
@@ -38,10 +39,11 @@
                $this->entity->setId( new ItemId( 'Q23' ) );
 
                $propertyId = new PropertyId( 'P188' );
-               $guidGenerator = new GuidGenerator();
-               $itemId = new ItemId( 'Q42' );
                $identifierPropertyIds = array( new PropertyId( 'P42' ) );
-               $claimGuid = $guidGenerator->newGuid( $itemId );
+
+               $guidGenerator = new V4GuidGenerator();
+               $itemId = new ItemId( 'Q42' );
+               $claimGuid = $itemId->getSerialization() . 
StatementGuid::SEPARATOR . $guidGenerator->newGuid();
 
                $externalId = 'foobar';
 
diff --git a/tests/phpunit/Specials/SpecialCrossCheckTest.php 
b/tests/phpunit/Specials/SpecialCrossCheckTest.php
index 79734d3..e861174 100644
--- a/tests/phpunit/Specials/SpecialCrossCheckTest.php
+++ b/tests/phpunit/Specials/SpecialCrossCheckTest.php
@@ -5,7 +5,8 @@
 use Wikibase\DataModel\Entity\EntityIdValue;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\Entity\PropertyId;
-use Wikibase\DataModel\Services\Statement\GuidGenerator;
+use Wikibase\DataModel\Services\Statement\V4GuidGenerator;
+use Wikibase\DataModel\Statement\StatementGuid;
 use Wikibase\Repo\EntityIdLabelFormatterFactory;
 use Wikibase\Test\SpecialPageTestBase;
 use 
WikibaseQuality\ExternalValidation\DumpMetaInformation\SqlDumpMetaInformationRepo;
@@ -125,17 +126,17 @@
                        $store->saveEntity($itemQ1, 'TestEntityQ1', 
$GLOBALS['wgUser'], EDIT_NEW);
                        self::$idMap['Q1'] = $itemQ1->getId();
 
-                       $statementGuidGenerator = new GuidGenerator();
+                       $guidGenerator = new V4GuidGenerator();
 
                        $dataValue = new EntityIdValue(new 
ItemId(IDENTIFIER_PROPERTY_QID));
                        $snak = new PropertyValueSnak(new 
PropertyId(INSTANCE_OF_PID), $dataValue);
-                       $claimGuid = 
$statementGuidGenerator->newGuid(self::$idMap['P3']);
+                       $claimGuid = self::$idMap['P3']->getSerialization() . 
StatementGuid::SEPARATOR . $guidGenerator->newGuid();
                        $propertyP3->getStatements()->addNewStatement($snak, 
null, null, $claimGuid);
                        $store->saveEntity($propertyP3, 'TestEntityP3', 
$GLOBALS['wgUser'], EDIT_UPDATE);
 
                        $dataValue = new StringValue('foo');
                        $snak = new PropertyValueSnak(self::$idMap['P1'], 
$dataValue);
-                       $statementGuid = 
$statementGuidGenerator->newGuid(self::$idMap['Q1']);
+                       $statementGuid = self::$idMap['Q1']->getSerialization() 
. StatementGuid::SEPARATOR . $guidGenerator->newGuid();
                        $statement = new Statement($snak);
                        self::$statementGuids['P1'] = $statementGuid;
                        $statement->setGuid($statementGuid);
@@ -143,7 +144,7 @@
 
                        $dataValue = new StringValue('baz');
                        $snak = new PropertyValueSnak(self::$idMap['P2'], 
$dataValue);
-                       $statementGuid = 
$statementGuidGenerator->newGuid(self::$idMap['Q1']);
+                       $statementGuid = self::$idMap['Q1']->getSerialization() 
. StatementGuid::SEPARATOR . $guidGenerator->newGuid();
                        $statement = new Statement($snak);
                        self::$statementGuids['P2'] = $statementGuid;
                        $statement->setGuid($statementGuid);
@@ -152,7 +153,7 @@
                        $dataValue = new StringValue('1234');
                        $snak = new PropertyValueSnak(self::$idMap['P3'], 
$dataValue);
                        $statement = new Statement($snak);
-                       $statementGuid = 
$statementGuidGenerator->newGuid(self::$idMap['Q1']);
+                       $statementGuid = self::$idMap['Q1']->getSerialization() 
. StatementGuid::SEPARATOR . $guidGenerator->newGuid();
                        self::$statementGuids['P3'] = $statementGuid;
                        $statement->setGuid($statementGuid);
                        $itemQ1->getStatements()->addStatement($statement);
@@ -160,7 +161,7 @@
                        $dataValue = new StringValue('partiall');
                        $snak = new PropertyValueSnak(self::$idMap['P4'], 
$dataValue);
                        $statement = new Statement($snak);
-                       $statementGuid = 
$statementGuidGenerator->newGuid(self::$idMap['Q1']);
+                       $statementGuid = self::$idMap['Q1']->getSerialization() 
. StatementGuid::SEPARATOR . $guidGenerator->newGuid();
                        self::$statementGuids['P4'] = $statementGuid;
                        $statement->setGuid($statementGuid);
                        $itemQ1->getStatements()->addStatement($statement);

-- 
To view, visit https://gerrit.wikimedia.org/r/233696
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I56cf650f98e88c2cba7ad6ec78438b02ae807ded
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityExternalValidation
Gerrit-Branch: master
Gerrit-Owner: Soeren.oldag <[email protected]>
Gerrit-Reviewer: Soeren.oldag <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to