← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/antibfjo-8-kill into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/antibfjo-8-kill into lp:launchpad with lp:~wgrant/launchpad/antibfjo-7-no-set-pls as a prerequisite.

Commit message:
Kill off IBuildFarmJobOld and all of its implementations.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/antibfjo-8-kill/+merge/196053

IBuildFarmJobOld and its implementations (BuildPackageJob, SourcePackageRecipeBuildJob, TranslationTemplatesBuildJob) are finally being replaced with an FK from BuildQueue to BuildFarmJob. Additionally, the two fields of Job that are used by BuildQueue are being inlined, and the FK to Job dropped, for performance reasons.

This branch drops the last of the model code.
-- 
https://code.launchpad.net/~wgrant/launchpad/antibfjo-8-kill/+merge/196053
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/antibfjo-8-kill into lp:launchpad.
=== modified file 'database/sampledata/current-dev.sql'
--- database/sampledata/current-dev.sql	2013-11-21 04:35:27 +0000
+++ database/sampledata/current-dev.sql	2013-11-21 04:35:28 +0000
@@ -2300,8 +2300,6 @@
 
 ALTER TABLE job DISABLE TRIGGER ALL;
 
-INSERT INTO job (id, requester, reason, status, progress, last_report_seen, next_report_due, attempt_count, max_retries, log, scheduled_start, lease_expires, date_created, date_started, date_finished, json_data, job_type) VALUES (1, NULL, NULL, 1, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, '2005-06-15 09:14:12.820778', '2005-06-15 09:20:12.820778', NULL, NULL, NULL);
-INSERT INTO job (id, requester, reason, status, progress, last_report_seen, next_report_due, attempt_count, max_retries, log, scheduled_start, lease_expires, date_created, date_started, date_finished, json_data, job_type) VALUES (2, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, '2005-06-15 10:14:12.820778', NULL, NULL, NULL, NULL);
 
 
 ALTER TABLE job ENABLE TRIGGER ALL;

=== modified file 'database/sampledata/current.sql'
--- database/sampledata/current.sql	2013-11-21 04:35:27 +0000
+++ database/sampledata/current.sql	2013-11-21 04:35:28 +0000
@@ -2296,8 +2296,6 @@
 
 ALTER TABLE job DISABLE TRIGGER ALL;
 
-INSERT INTO job (id, requester, reason, status, progress, last_report_seen, next_report_due, attempt_count, max_retries, log, scheduled_start, lease_expires, date_created, date_started, date_finished, json_data, job_type) VALUES (1, NULL, NULL, 1, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, '2005-06-15 09:14:12.820778', '2005-06-15 09:20:12.820778', NULL, NULL, NULL);
-INSERT INTO job (id, requester, reason, status, progress, last_report_seen, next_report_due, attempt_count, max_retries, log, scheduled_start, lease_expires, date_created, date_started, date_finished, json_data, job_type) VALUES (2, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, '2005-06-15 10:14:12.820778', NULL, NULL, NULL, NULL);
 
 
 ALTER TABLE job ENABLE TRIGGER ALL;

=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg	2013-10-03 04:37:30 +0000
+++ database/schema/security.cfg	2013-11-21 04:35:28 +0000
@@ -290,7 +290,6 @@
 public.sourcepackagepublishinghistory   = SELECT
 public.sourcepackagerecipe              = SELECT, INSERT, UPDATE, DELETE
 public.sourcepackagerecipebuild         = SELECT, INSERT, UPDATE, DELETE
-public.sourcepackagerecipebuildjob      = SELECT, INSERT, UPDATE, DELETE
 public.sourcepackagerecipedata          = SELECT, INSERT, UPDATE, DELETE
 public.sourcepackagerecipedatainstruction = SELECT, INSERT, UPDATE, DELETE
 public.sourcepackagerecipedistroseries  = SELECT, INSERT, DELETE
@@ -807,7 +806,6 @@
 public.sourcepackagename                        = SELECT
 public.sourcepackagerecipe                      = SELECT, UPDATE
 public.sourcepackagerecipebuild                 = SELECT, INSERT
-public.sourcepackagerecipebuildjob              = SELECT, INSERT
 public.sourcepackagerecipedata                  = SELECT
 public.sourcepackagerecipedistroseries          = SELECT
 public.teamparticipation                        = SELECT
@@ -919,7 +917,6 @@
 public.questionsubscription             = SELECT
 public.sourcepackagepublishinghistory   = SELECT, INSERT, UPDATE, DELETE
 public.sourcepackagerecipebuild         = SELECT
-public.sourcepackagerecipebuildjob      = SELECT, INSERT, UPDATE
 public.structuralsubscription           = SELECT
 public.translationgroup                 = SELECT
 public.validpersoncache                 = SELECT
@@ -938,10 +935,8 @@
 public.binarypackagepublishinghistory         = SELECT
 public.binarypackagerelease                   = SELECT
 public.branch                                 = SELECT
-public.branchjob                              = SELECT, DELETE
 public.builder                                = SELECT, INSERT, UPDATE
 public.buildfarmjob                           = SELECT, INSERT, UPDATE
-public.buildpackagejob                        = SELECT, INSERT, UPDATE, DELETE
 public.buildqueue                             = SELECT, INSERT, UPDATE, DELETE
 public.component                              = SELECT
 public.distribution                           = SELECT, UPDATE
@@ -951,7 +946,6 @@
 public.emailaddress                           = SELECT
 public.flatpackagesetinclusion                = SELECT
 public.gpgkey                                 = SELECT
-public.job                                    = SELECT, INSERT, UPDATE, DELETE
 public.libraryfilealias                       = SELECT, INSERT
 public.libraryfilecontent                     = SELECT, INSERT
 public.packageset                             = SELECT
@@ -970,7 +964,6 @@
 public.sourcepackagepublishinghistory         = SELECT
 public.sourcepackagerecipe                    = SELECT
 public.sourcepackagerecipebuild               = SELECT, UPDATE
-public.sourcepackagerecipebuildjob            = SELECT, INSERT, UPDATE, DELETE
 public.sourcepackagerecipedata                = SELECT
 public.sourcepackagerecipedatainstruction     = SELECT
 public.sourcepackagerelease                   = SELECT
@@ -1012,7 +1005,6 @@
 public.binarypackagepublishinghistory           = SELECT, INSERT
 public.binarypackagerelease                     = SELECT
 public.buildfarmjob                             = SELECT, INSERT
-public.buildpackagejob                          = SELECT, INSERT
 public.buildqueue                               = SELECT, INSERT, UPDATE
 public.component                                = SELECT
 public.componentselection                       = SELECT, INSERT
@@ -1066,7 +1058,6 @@
 public.binarypackagepublishinghistory         = SELECT, INSERT
 public.binarypackagerelease                   = SELECT
 public.buildfarmjob                           = SELECT, INSERT
-public.buildpackagejob                        = SELECT, INSERT, UPDATE, DELETE
 public.buildqueue                             = SELECT, INSERT, UPDATE
 public.component                              = SELECT
 public.componentselection                     = SELECT, INSERT
@@ -1167,7 +1158,6 @@
 public.bugwatchactivity                 = SELECT, INSERT, UPDATE, DELETE
 public.builder                          = SELECT, INSERT, UPDATE
 public.buildfarmjob                     = SELECT, INSERT, UPDATE
-public.buildpackagejob                  = SELECT, INSERT, UPDATE, DELETE
 public.buildqueue                       = SELECT, INSERT, UPDATE, DELETE
 public.component                        = SELECT, INSERT, UPDATE
 public.componentselection               = SELECT, INSERT, UPDATE
@@ -1336,7 +1326,6 @@
 public.bugwatch                         = SELECT, INSERT
 public.builder                          = SELECT
 public.buildfarmjob                     = SELECT, INSERT, UPDATE
-public.buildpackagejob                  = SELECT, INSERT, UPDATE
 public.buildqueue                       = SELECT, INSERT, UPDATE
 public.component                        = SELECT, INSERT
 public.componentselection               = SELECT
@@ -1392,7 +1381,6 @@
 public.sourcepackagepublishinghistory   = SELECT, INSERT
 public.sourcepackagerecipe              = SELECT, UPDATE
 public.sourcepackagerecipebuild         = SELECT, UPDATE
-public.sourcepackagerecipebuildjob      = SELECT, UPDATE
 public.sourcepackagerelease             = SELECT, INSERT, UPDATE
 public.sourcepackagereleasefile         = SELECT, INSERT
 public.structuralsubscription           = SELECT
@@ -1441,7 +1429,6 @@
 public.bugtrackeralias                  = SELECT, INSERT
 public.bugwatch                         = SELECT, INSERT
 public.buildfarmjob                     = SELECT, INSERT, UPDATE
-public.buildpackagejob                  = SELECT, INSERT, UPDATE
 public.buildqueue                       = SELECT, INSERT, UPDATE
 public.component                        = SELECT
 public.componentselection               = SELECT
@@ -1499,7 +1486,6 @@
 public.sourcepackagename                = SELECT
 public.sourcepackagepublishinghistory   = SELECT, INSERT, UPDATE
 public.sourcepackagerecipebuild         = SELECT
-public.sourcepackagerecipebuildjob      = SELECT, INSERT, UPDATE
 public.sourcepackagerelease             = SELECT, UPDATE
 public.sourcepackagereleasefile         = SELECT, UPDATE
 public.structuralsubscription           = SELECT
@@ -2316,7 +2302,6 @@
 public.binarypackagebuild               = SELECT
 public.branch                           = SELECT
 public.buildfarmjob                     = SELECT
-public.buildpackagejob                  = SELECT
 public.buildqueue                       = SELECT
 public.databasereplicationlag           = SELECT
 public.job                              = SELECT

=== modified file 'lib/lp/buildmaster/interfaces/buildfarmjob.py'
--- lib/lp/buildmaster/interfaces/buildfarmjob.py	2013-11-21 04:35:27 +0000
+++ lib/lp/buildmaster/interfaces/buildfarmjob.py	2013-11-21 04:35:28 +0000
@@ -7,7 +7,6 @@
 
 __all__ = [
     'IBuildFarmJob',
-    'IBuildFarmJobOld',
     'IBuildFarmJobSet',
     'IBuildFarmJobSource',
     'InconsistentBuildFarmJobError',
@@ -46,40 +45,6 @@
     """
 
 
-class IBuildFarmJobOld(Interface):
-    """Defines the previous non-database BuildFarmJob interface.
-
-    This interface is still used by the temporary build queue related
-    classes (TranslationTemplatesBuildJob, SourcePackageRecipeBuildJob
-    and BuildPackageJob).
-
-    XXX 2010-04-28 michael.nelson bug=567922
-    This class can be removed (merging all the attributes directly into
-    IBuildFarmJob) once all the corresponding *Build classes and the
-    BuildQueue have been transitioned to the new database schema.
-    """
-
-    def getByJob(job):
-        """Get the specific `IBuildFarmJob` for the given `Job`.
-
-        Invoked on the specific `IBuildFarmJob`-implementing class that
-        has an entry associated with `job`.
-        """
-
-    def getByJobs(jobs):
-        """Get the specific `IBuildFarmJob`s for the given `Job`s.
-
-        Invoked on the specific `IBuildFarmJob`-implementing class that
-        has entries associated with `job`s.
-        """
-
-    def cleanUp():
-        """Job's finished.  Delete its supporting data."""
-
-    build = Attribute("Build")
-    job = Attribute("Job")
-
-
 class IBuildFarmJobDB(Interface):
     """Operations on a `BuildFarmJob` DB row.
 

=== modified file 'lib/lp/buildmaster/interfaces/buildqueue.py'
--- lib/lp/buildmaster/interfaces/buildqueue.py	2013-11-21 04:35:27 +0000
+++ lib/lp/buildmaster/interfaces/buildqueue.py	2013-11-21 04:35:28 +0000
@@ -27,10 +27,7 @@
 from lp import _
 from lp.buildmaster.enums import BuildQueueStatus
 from lp.buildmaster.interfaces.builder import IBuilder
-from lp.buildmaster.interfaces.buildfarmjob import (
-    IBuildFarmJob,
-    IBuildFarmJobOld,
-    )
+from lp.buildmaster.interfaces.buildfarmjob import IBuildFarmJob
 from lp.soyuz.interfaces.processor import IProcessor
 
 
@@ -101,10 +98,6 @@
     def cancel():
         """Cancel this job, it will not be re-dispatched."""
 
-    specific_old_job = Reference(
-        IBuildFarmJobOld, title=_("Old build farm job"),
-        description=_("Old IBuildQueue <-> IBuildFarmJob link object."))
-
     specific_build = Reference(
         IBuildFarmJob, title=_("Build farm job"),
         description=_("Concrete build farm job object."))

=== modified file 'lib/lp/buildmaster/model/buildfarmjob.py'
--- lib/lp/buildmaster/model/buildfarmjob.py	2013-11-21 04:35:27 +0000
+++ lib/lp/buildmaster/model/buildfarmjob.py	2013-11-21 04:35:28 +0000
@@ -5,7 +5,6 @@
 __all__ = [
     'BuildFarmJob',
     'BuildFarmJobMixin',
-    'BuildFarmJobOld',
     'SpecificBuildFarmJobSourceMixin',
     ]
 
@@ -35,7 +34,6 @@
     )
 from lp.buildmaster.interfaces.buildfarmjob import (
     IBuildFarmJob,
-    IBuildFarmJobOld,
     IBuildFarmJobSet,
     IBuildFarmJobSource,
     )
@@ -47,31 +45,6 @@
     )
 
 
-class BuildFarmJobOld:
-    """Some common implementation for IBuildFarmJobOld."""
-
-    implements(IBuildFarmJobOld)
-
-    @classmethod
-    def getByJob(cls, job):
-        """See `IBuildFarmJobOld`."""
-        return IStore(cls).find(cls, cls.job == job).one()
-
-    @classmethod
-    def getByJobs(cls, jobs):
-        """See `IBuildFarmJobOld`."""
-        job_ids = [job.id for job in jobs]
-        return IStore(cls).find(cls, cls.job_id.is_in(job_ids))
-
-    def cleanUp(self):
-        """See `IBuildFarmJob`.
-
-        Classes that derive from BuildFarmJobOld need to clean up
-        after themselves correctly.
-        """
-        Store.of(self).remove(self)
-
-
 class BuildFarmJob(Storm):
     """A base implementation for `IBuildFarmJob` classes."""
     __storm_table__ = 'BuildFarmJob'

=== modified file 'lib/lp/buildmaster/model/buildqueue.py'
--- lib/lp/buildmaster/model/buildqueue.py	2013-11-21 04:35:27 +0000
+++ lib/lp/buildmaster/model/buildqueue.py	2013-11-21 04:35:28 +0000
@@ -6,7 +6,6 @@
 __all__ = [
     'BuildQueue',
     'BuildQueueSet',
-    'specific_job_classes',
     'specific_build_farm_job_sources',
     ]
 
@@ -41,7 +40,6 @@
     BuildStatus,
     )
 from lp.buildmaster.interfaces.buildfarmjob import (
-    IBuildFarmJob,
     ISpecificBuildFarmJobSource,
     )
 from lp.buildmaster.interfaces.buildqueue import (
@@ -61,22 +59,6 @@
     )
 
 
-def specific_job_classes():
-    """Job classes that may run on the build farm."""
-    job_classes = dict()
-    # Get all components that implement the `IBuildFarmJob` interface.
-    components = getSiteManager()
-    implementations = sorted(components.getUtilitiesFor(IBuildFarmJob))
-    # The above yields a collection of 2-tuples where the first element
-    # is the name of the `BuildFarmJobType` enum and the second element
-    # is the implementing class respectively.
-    for job_enum_name, job_class in implementations:
-        job_enum = getattr(BuildFarmJobType, job_enum_name)
-        job_classes[job_enum] = job_class
-
-    return job_classes
-
-
 def specific_build_farm_job_sources():
     """Sources for specific jobs that may run on the build farm."""
     job_sources = dict()
@@ -116,10 +98,6 @@
     status = EnumCol(enum=BuildQueueStatus, default=BuildQueueStatus.WAITING)
     date_started = DateTime(tzinfo=pytz.UTC)
 
-    _job = ForeignKey(dbName='job', foreignKey='Job')
-    _job_type = EnumCol(
-        enum=BuildFarmJobType, notNull=True,
-        default=BuildFarmJobType.PACKAGEBUILD, dbName='job_type')
     builder = ForeignKey(dbName='builder', foreignKey='Builder', default=None)
     logtail = StringCol(dbName='logtail', default=None)
     lastscore = IntCol(dbName='lastscore', default=0)
@@ -138,14 +116,6 @@
     def _clear_specific_build_cache(self):
         del get_property_cache(self).specific_build
 
-    @property
-    def specific_old_job(self):
-        """See `IBuildQueue`."""
-        if self._job is None:
-            return None
-        specific_class = specific_job_classes()[self._job_type]
-        return specific_class.getByJob(self._job)
-
     @staticmethod
     def preloadSpecificBuild(queues):
         from lp.buildmaster.model.buildfarmjob import BuildFarmJob
@@ -172,15 +142,9 @@
 
     def destroySelf(self):
         """Remove this record."""
-        job = self._job
-        specific_old_job = self.specific_old_job
         builder = self.builder
         Store.of(self).remove(self)
-        if specific_old_job is not None:
-            specific_old_job.cleanUp()
         Store.of(self).flush()
-        if job is not None:
-            job.destroySelf()
         if builder is not None:
             del get_property_cache(builder).currentjob
         self._clear_specific_build_cache()

=== modified file 'lib/lp/buildmaster/tests/test_buildqueue.py'
--- lib/lp/buildmaster/tests/test_buildqueue.py	2013-11-21 04:35:27 +0000
+++ lib/lp/buildmaster/tests/test_buildqueue.py	2013-11-21 04:35:28 +0000
@@ -5,22 +5,16 @@
 from datetime import timedelta
 
 from storm.sqlobject import SQLObjectNotFound
-from storm.store import Store
 from zope.security.proxy import removeSecurityProxy
 
-from lp.buildmaster.enums import (
-    BuildFarmJobType,
-    BuildStatus,
-    )
+from lp.buildmaster.enums import BuildStatus
 from lp.buildmaster.model.buildqueue import BuildQueue
 from lp.services.database.interfaces import IStore
-from lp.services.job.model.job import Job
 from lp.soyuz.enums import (
     ArchivePurpose,
     PackagePublishingStatus,
     )
 from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
-from lp.soyuz.model.buildpackagejob import BuildPackageJob
 from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
 from lp.testing import TestCaseWithFactory
 from lp.testing.fakemethod import FakeMethod
@@ -74,49 +68,6 @@
             queue_entry.lastscore)
 
 
-class TestBuildQueueOldJobDestruction(TestCaseWithFactory):
-
-    layer = ZopelessDatabaseLayer
-
-    def test_destroy_without_job(self):
-        # Newly created BuildQueues won't have an associated Job.
-        build = self.factory.makeBinaryPackageBuild()
-        bq = removeSecurityProxy(build.queueBuild())
-        self.assertIs(None, bq._job)
-        self.assertIs(
-            None, Store.of(build).find(BuildPackageJob, build=build).one())
-        bq.destroySelf()
-        self.assertIs(None, Store.of(build).find(BuildQueue, id=bq.id).one())
-
-    def test_destroy_with_job(self):
-        # Old BuildQueues will have a Job and an IBuildFarmJobOld during
-        # the migration. They're all destroyed.
-        build = self.factory.makeBinaryPackageBuild()
-        bq = removeSecurityProxy(build.queueBuild())
-        bfjo = removeSecurityProxy(build).makeJob()
-        job = bfjo.job
-        bq._job = job
-        bq._job_type = BuildFarmJobType.PACKAGEBUILD
-        self.assertIsNot(None, bq.specific_old_job)
-        self.assertIsNot(None, bq._job)
-        bq.destroySelf()
-        self.assertIs(None, Store.of(build).find(BuildQueue, id=bq.id).one())
-        self.assertIs(None, Store.of(build).find(Job, id=job.id).one())
-        self.assertIs(
-            None, Store.of(build).find(BuildPackageJob, id=bfjo.id).one())
-
-    def test_destroy_with_dangling_job(self):
-        # Old BuildQueues may even have a dangling Job FK between data
-        # cleaning and schema dropping. We ignore it and just kill the
-        # remaining BuildQueue.
-        build = self.factory.makeBinaryPackageBuild()
-        bq = removeSecurityProxy(build.queueBuild())
-        bq._jobID = 123456
-        bq._job_type = BuildFarmJobType.PACKAGEBUILD
-        bq.destroySelf()
-        self.assertIs(None, Store.of(build).find(BuildQueue, id=bq.id).one())
-
-
 class TestBuildCancellation(TestCaseWithFactory):
     """Test cases for cancelling builds."""
 

=== modified file 'lib/lp/code/configure.zcml'
--- lib/lp/code/configure.zcml	2013-02-28 01:02:50 +0000
+++ lib/lp/code/configure.zcml	2013-11-21 04:35:28 +0000
@@ -845,17 +845,6 @@
     <allow interface="lp.buildmaster.interfaces.buildfarmjob.ISpecificBuildFarmJobSource"/>
   </securedutility>
 
-  <class
-     class="lp.code.model.sourcepackagerecipebuild.SourcePackageRecipeBuildJob">
-    <allow interface="lp.code.interfaces.sourcepackagerecipebuild.ISourcePackageRecipeBuildJob"/>
-  </class>
-
-  <securedutility
-     component="lp.code.model.sourcepackagerecipebuild.SourcePackageRecipeBuildJob"
-     provides="lp.code.interfaces.sourcepackagerecipebuild.ISourcePackageRecipeBuildJobSource">
-    <allow interface="lp.code.interfaces.sourcepackagerecipebuild.ISourcePackageRecipeBuildJobSource"/>
-  </securedutility>
-
   <adapter factory="lp.code.model.recipebuilder.RecipeBuildBehavior"
            permission="zope.Public" />
 
@@ -901,10 +890,6 @@
     for="lp.code.interfaces.sourcepackagerecipe.ISourcePackageRecipe zope.lifecycleevent.interfaces.IObjectModifiedEvent"
     handler="lp.code.model.sourcepackagerecipe.recipe_modified"/>
 
-  <utility component="lp.code.model.sourcepackagerecipebuild.SourcePackageRecipeBuildJob"
-        name="RECIPEBRANCHBUILD"
-        provides="lp.buildmaster.interfaces.buildfarmjob.IBuildFarmJob"/>
-
   <webservice:register module="lp.code.interfaces.webservice" />
 
   <adapter

=== modified file 'lib/lp/code/interfaces/sourcepackagerecipebuild.py'
--- lib/lp/code/interfaces/sourcepackagerecipebuild.py	2013-11-15 06:08:45 +0000
+++ lib/lp/code/interfaces/sourcepackagerecipebuild.py	2013-11-21 04:35:28 +0000
@@ -7,8 +7,6 @@
 __all__ = [
     'ISourcePackageRecipeBuild',
     'ISourcePackageRecipeBuildSource',
-    'ISourcePackageRecipeBuildJob',
-    'ISourcePackageRecipeBuildJobSource',
     ]
 
 from lazr.restful.declarations import export_as_webservice_entry
@@ -16,7 +14,6 @@
     CollectionField,
     Reference,
     )
-from zope.interface import Interface
 from zope.schema import (
     Bool,
     Int,
@@ -25,7 +22,6 @@
 
 from lp import _
 from lp.buildmaster.interfaces.buildfarmjob import (
-    IBuildFarmJobOld,
     ISpecificBuildFarmJobSource,
     )
 from lp.buildmaster.interfaces.packagebuild import IPackageBuild
@@ -35,7 +31,6 @@
     )
 from lp.registry.interfaces.distroseries import IDistroSeries
 from lp.registry.interfaces.person import IPerson
-from lp.services.job.interfaces.job import IJob
 from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuild
 from lp.soyuz.interfaces.sourcepackagerelease import ISourcePackageRelease
 
@@ -104,23 +99,3 @@
 
         :param logger: An optional logger to write debug info to.
         """
-
-
-class ISourcePackageRecipeBuildJob(IBuildFarmJobOld):
-    """A read-only interface for recipe build jobs."""
-
-    job = Reference(
-        IJob, title=_("Job"), required=True, readonly=True,
-        description=_("Data common to all job types."))
-
-
-class ISourcePackageRecipeBuildJobSource(Interface):
-    """A utility of this interface used to create _things_."""
-
-    def new(build, job):
-        """Create a new `ISourcePackageRecipeBuildJob`.
-
-        :param build: An `ISourcePackageRecipeBuild`.
-        :param job: An `IJob`.
-        :return: `ISourcePackageRecipeBuildJob`.
-        """

=== modified file 'lib/lp/code/model/sourcepackagerecipebuild.py'
--- lib/lp/code/model/sourcepackagerecipebuild.py	2013-11-21 04:35:27 +0000
+++ lib/lp/code/model/sourcepackagerecipebuild.py	2013-11-21 04:35:28 +0000
@@ -42,7 +42,6 @@
 from lp.buildmaster.interfaces.buildfarmjob import IBuildFarmJobSource
 from lp.buildmaster.model.buildfarmjob import (
     BuildFarmJob,
-    BuildFarmJobOld,
     SpecificBuildFarmJobSourceMixin,
     )
 from lp.buildmaster.model.buildqueue import BuildQueue
@@ -53,8 +52,6 @@
     )
 from lp.code.interfaces.sourcepackagerecipebuild import (
     ISourcePackageRecipeBuild,
-    ISourcePackageRecipeBuildJob,
-    ISourcePackageRecipeBuildJobSource,
     ISourcePackageRecipeBuildSource,
     )
 from lp.code.mail.sourcepackagerecipebuild import (
@@ -71,7 +68,6 @@
     IMasterStore,
     IStore,
     )
-from lp.services.job.model.job import Job
 from lp.services.librarian.browser import ProxiedLibraryFileAlias
 from lp.soyuz.interfaces.archive import CannotUploadToArchive
 from lp.soyuz.model.archive import Archive
@@ -339,15 +335,6 @@
             cls.requester_id == requester.id, cls.recipe_id == recipe.id,
             cls.date_created > old_threshold)
 
-    def makeJob(self):
-        """See `ISourcePackageRecipeBuildJob`."""
-        store = Store.of(self)
-        job = Job()
-        store.add(job)
-        specific_job = getUtility(
-            ISourcePackageRecipeBuildJobSource).new(self, job)
-        return specific_job
-
     def estimateDuration(self):
         """See `IPackageBuild`."""
         median = self.recipe.getMedianBuildDuration()
@@ -408,32 +395,3 @@
     def getUploader(self, changes):
         """See `IPackageBuild`."""
         return self.requester
-
-
-class SourcePackageRecipeBuildJob(BuildFarmJobOld, Storm):
-    classProvides(ISourcePackageRecipeBuildJobSource)
-    implements(ISourcePackageRecipeBuildJob)
-
-    __storm_table__ = 'sourcepackagerecipebuildjob'
-
-    id = Int(primary=True)
-
-    job_id = Int(name='job', allow_none=False)
-    job = Reference(job_id, 'Job.id')
-
-    build_id = Int(name='sourcepackage_recipe_build', allow_none=False)
-    build = Reference(
-        build_id, 'SourcePackageRecipeBuild.id')
-
-    def __init__(self, build, job):
-        self.build = build
-        self.job = job
-        super(SourcePackageRecipeBuildJob, self).__init__()
-
-    @classmethod
-    def new(cls, build, job):
-        """See `ISourcePackageRecipeBuildJobSource`."""
-        specific_job = cls(build, job)
-        store = IMasterStore(cls)
-        store.add(specific_job)
-        return specific_job

=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py	2013-11-21 04:35:27 +0000
+++ lib/lp/code/model/tests/test_branch.py	2013-11-21 04:35:28 +0000
@@ -1345,22 +1345,6 @@
         # Need to commit the transaction to fire off the constraint checks.
         transaction.commit()
 
-    def test_related_TranslationTemplatesBuildJob_cleaned_out(self):
-        # A TranslationTemplatesBuildJob is a type of BranchJob that
-        # comes with a BuildQueue entry referring to the same Job.
-        # Deleting the branch cleans up the BuildQueue before it can
-        # remove the Job and BranchJob.
-        build = self.factory.makeTranslationTemplatesBuild()
-        build.queueBuild()
-        build.branch.destroySelf(break_references=True)
-
-    def test_related_TranslationTemplatesBuild_cleaned_out(self):
-        # A TranslationTemplatesBuild for the branch is deleted even if
-        # the corresponding BranchJob doesn't reference the branch. This
-        # is critical as TTBs will soon not have BranchJobs.
-        build = self.factory.makeTranslationTemplatesBuild()
-        build.branch.destroySelf(break_references=True)
-
     def test_linked_translations_branch_cleared(self):
         # The translations_branch of a series that is linked to the branch
         # should be cleared.
@@ -1368,7 +1352,15 @@
         dev_focus.translations_branch = self.branch
         self.branch.destroySelf(break_references=True)
 
-    def test_unrelated_TranslationTemplatesBuildJob_intact(self):
+    def test_related_TranslationTemplatesBuild_cleaned_out(self):
+        # A TranslationTemplatesBuild may come with a BuildQueue entry.
+        # Deleting the branch cleans up the BuildQueue before it can
+        # remove the TTB.
+        build = self.factory.makeTranslationTemplatesBuild()
+        build.queueBuild()
+        build.branch.destroySelf(break_references=True)
+
+    def test_unrelated_TranslationTemplatesBuild_intact(self):
         # No innocent BuildQueue entries are harmed in deleting a
         # branch.
         build = self.factory.makeTranslationTemplatesBuild()

=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipebuild.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipebuild.py	2013-11-21 04:35:27 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipebuild.py	2013-11-21 04:35:28 +0000
@@ -24,7 +24,6 @@
 from lp.buildmaster.model.buildfarmjob import BuildFarmJob
 from lp.code.interfaces.sourcepackagerecipebuild import (
     ISourcePackageRecipeBuild,
-    ISourcePackageRecipeBuildJob,
     ISourcePackageRecipeBuildSource,
     )
 from lp.code.mail.sourcepackagerecipebuild import (
@@ -92,12 +91,6 @@
         transaction.commit()
         self.assertProvides(spb, ISourcePackageRecipeBuild)
 
-    def test_makeJob(self):
-        # A build farm job can be obtained from a SourcePackageRecipeBuild
-        spb = self.makeSourcePackageRecipeBuild()
-        job = removeSecurityProxy(spb).makeJob()
-        self.assertProvides(job, ISourcePackageRecipeBuildJob)
-
     def test_queueBuild(self):
         spb = self.makeSourcePackageRecipeBuild()
         bq = spb.queueBuild(spb)

=== modified file 'lib/lp/security.py'
--- lib/lp/security.py	2013-06-20 05:50:00 +0000
+++ lib/lp/security.py	2013-11-21 04:35:28 +0000
@@ -59,10 +59,7 @@
     IBuilder,
     IBuilderSet,
     )
-from lp.buildmaster.interfaces.buildfarmjob import (
-    IBuildFarmJob,
-    IBuildFarmJobOld,
-    )
+from lp.buildmaster.interfaces.buildfarmjob import IBuildFarmJob
 from lp.buildmaster.interfaces.packagebuild import IPackageBuild
 from lp.code.interfaces.branch import (
     IBranch,
@@ -170,7 +167,6 @@
     )
 from lp.registry.interfaces.wikiname import IWikiName
 from lp.registry.model.person import Person
-from lp.services.config import config
 from lp.services.database.interfaces import IStore
 from lp.services.identity.interfaces.account import IAccount
 from lp.services.identity.interfaces.emailaddress import IEmailAddress
@@ -1940,19 +1936,6 @@
         super(ViewTranslationTemplatesBuild, self).__init__(obj, obj.branch)
 
 
-class ViewBuildFarmJobOld(DelegatedAuthorization):
-    """Permission to view an `IBuildFarmJobOld`.
-
-    This permission is based entirely on permission to view the
-    associated `IBuildFarmJob`.
-    """
-    permission = 'launchpad.View'
-    usedfor = IBuildFarmJobOld
-
-    def __init__(self, obj):
-        super(ViewBuildFarmJobOld, self).__init__(obj, obj.build)
-
-
 class AdminQuestion(AdminByAdminsTeam):
     permission = 'launchpad.Admin'
     usedfor = IQuestion

=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml	2013-11-20 17:10:19 +0000
+++ lib/lp/soyuz/configure.zcml	2013-11-21 04:35:28 +0000
@@ -776,26 +776,9 @@
             interface="lp.soyuz.interfaces.packagesetgroup.IPackagesetGroup"/>
     </class>
 
-    <!-- BuildPackageJob -->
-    <class
-        class="lp.soyuz.model.buildpackagejob.BuildPackageJob">
-        <allow
-            interface="lp.soyuz.interfaces.buildpackagejob.IBuildPackageJob"/>
-    </class>
-    <!--
-        The registration below is used to discover all build farm job classes
-        that implement the `IBuildFarmJob` interface. Please see bug #503839
-        for more detail.
-        The 'name' attribute needs to be set to the appropriate
-        `BuildFarmJobType` enumeration value.
-    -->
-    <utility component="lp.soyuz.model.buildpackagejob.BuildPackageJob"
-        name="PACKAGEBUILD"
-        provides="lp.buildmaster.interfaces.buildfarmjob.IBuildFarmJob"/>
-
     <!-- BinaryPackageBuildBehavior -->
     <adapter
-        for="lp.soyuz.interfaces.buildpackagejob.IBinaryPackageBuild"
+        for="lp.soyuz.interfaces.binarypackagebuild.IBinaryPackageBuild"
         provides="lp.buildmaster.interfaces.buildfarmjobbehavior.IBuildFarmJobBehavior"
         factory="lp.soyuz.model.binarypackagebuildbehavior.BinaryPackageBuildBehavior"
         permission="zope.Public" />

=== removed file 'lib/lp/soyuz/interfaces/buildpackagejob.py'
--- lib/lp/soyuz/interfaces/buildpackagejob.py	2013-11-15 06:04:17 +0000
+++ lib/lp/soyuz/interfaces/buildpackagejob.py	1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""BuildPackageJob interfaces."""
-
-__metaclass__ = type
-
-__all__ = [
-    'IBuildPackageJob',
-    ]
-
-from lazr.restful.fields import Reference
-from zope.schema import Int
-
-from lp import _
-from lp.buildmaster.interfaces.buildfarmjob import IBuildFarmJobOld
-from lp.services.job.interfaces.job import IJob
-from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuild
-
-
-class IBuildPackageJob(IBuildFarmJobOld):
-    """A read-only interface for build package jobs."""
-
-    id = Int(title=_('ID'), required=True, readonly=True)
-
-    job = Reference(
-        IJob, title=_("Job"), required=True, readonly=True,
-        description=_("Data common to all job types."))
-
-    build = Reference(
-        IBinaryPackageBuild, title=_("Build"),
-        required=True, readonly=True,
-        description=_("Build record associated with this job."))

=== modified file 'lib/lp/soyuz/model/binarypackagebuild.py'
--- lib/lp/soyuz/model/binarypackagebuild.py	2013-11-21 04:35:27 +0000
+++ lib/lp/soyuz/model/binarypackagebuild.py	2013-11-21 04:35:28 +0000
@@ -71,7 +71,6 @@
     SQLBase,
     sqlvalues,
     )
-from lp.services.job.model.job import Job
 from lp.services.librarian.browser import ProxiedLibraryFileAlias
 from lp.services.librarian.model import (
     LibraryFileAlias,
@@ -101,7 +100,6 @@
 from lp.soyuz.interfaces.packageset import IPackagesetSet
 from lp.soyuz.model.binarypackagename import BinaryPackageName
 from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease
-from lp.soyuz.model.buildpackagejob import BuildPackageJob
 from lp.soyuz.model.files import BinaryPackageFile
 from lp.soyuz.model.packageset import Packageset
 from lp.soyuz.model.queue import (
@@ -515,15 +513,6 @@
         # Otherwise we can cancel it here.
         self.buildqueue_record.cancel()
 
-    def makeJob(self):
-        """See `IBuildFarmJob`."""
-        store = Store.of(self)
-        job = Job()
-        store.add(job)
-        specific_job = BuildPackageJob(build=self, job=job)
-        store.add(specific_job)
-        return specific_job
-
     def _parseDependencyToken(self, token):
         """Parse the given token.
 

=== removed file 'lib/lp/soyuz/model/buildpackagejob.py'
--- lib/lp/soyuz/model/buildpackagejob.py	2013-11-21 04:35:27 +0000
+++ lib/lp/soyuz/model/buildpackagejob.py	1970-01-01 00:00:00 +0000
@@ -1,36 +0,0 @@
-# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-__metaclass__ = type
-__all__ = [
-    'BuildPackageJob',
-    ]
-
-
-from storm.locals import (
-    Int,
-    Reference,
-    Storm,
-    )
-from zope.interface import implements
-
-from lp.buildmaster.model.buildfarmjob import BuildFarmJobOld
-from lp.soyuz.interfaces.buildpackagejob import IBuildPackageJob
-
-
-class BuildPackageJob(BuildFarmJobOld, Storm):
-    """See `IBuildPackageJob`."""
-    implements(IBuildPackageJob)
-
-    __storm_table__ = 'buildpackagejob'
-    id = Int(primary=True)
-
-    job_id = Int(name='job', allow_none=False)
-    job = Reference(job_id, 'Job.id')
-
-    build_id = Int(name='build', allow_none=False)
-    build = Reference(build_id, 'BinaryPackageBuild.id')
-
-    def __init__(self, build, job):
-        self.build, self.job = build, job
-        super(BuildPackageJob, self).__init__()

=== modified file 'lib/lp/translations/configure.zcml'
--- lib/lp/translations/configure.zcml	2013-11-15 09:31:08 +0000
+++ lib/lp/translations/configure.zcml	2013-11-21 04:35:28 +0000
@@ -591,17 +591,6 @@
             interface="lp.translations.interfaces.poexportrequest.IPOExportRequestSet"/>
     </securedutility>
 
-    <!-- TranslationTemplateBuildJob -->
-    <class
-        class="lp.translations.model.translationtemplatesbuildjob.TranslationTemplatesBuildJob">
-        <allow
-            interface="lp.translations.interfaces.translationtemplatesbuildjob.ITranslationTemplatesBuildJob"/>
-    </class>
-    <securedutility
-        component="lp.translations.model.translationtemplatesbuildjob.TranslationTemplatesBuildJob"
-        provides="lp.translations.interfaces.translationtemplatesbuildjob.ITranslationTemplatesBuildJobSource">
-        <allow interface="lp.translations.interfaces.translationtemplatesbuildjob.ITranslationTemplatesBuildJobSource"/>
-    </securedutility>
     <securedutility
         component='lp.translations.model.translationpackagingjob.TranslationPackagingJob'
         provides='lp.translations.interfaces.translationpackagingjob.ITranslationPackagingJobSource'
@@ -621,10 +610,6 @@
         class="lp.translations.model.translationpackagingjob.TranslationTemplateChangeJob">
         <allow interface='lp.services.job.interfaces.job.IRunnableJob'/>
     </class>
-    <utility
-        component="lp.translations.model.translationtemplatesbuildjob.TranslationTemplatesBuildJob"
-        provides="lp.buildmaster.interfaces.buildfarmjob.IBuildFarmJob"
-        name="TRANSLATIONTEMPLATESBUILD"/>
 
     <!-- TranslationTemplatesBuild -->
     <class

=== removed file 'lib/lp/translations/interfaces/translationtemplatesbuildjob.py'
--- lib/lp/translations/interfaces/translationtemplatesbuildjob.py	2013-11-15 09:31:08 +0000
+++ lib/lp/translations/interfaces/translationtemplatesbuildjob.py	1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-__metaclass__ = type
-
-__all__ = [
-    'ITranslationTemplatesBuildJob',
-    'ITranslationTemplatesBuildJobSource',
-    ]
-
-from zope.interface import (
-    Attribute,
-    Interface,
-    )
-
-from lp.buildmaster.interfaces.buildfarmjob import IBuildFarmJobOld
-
-
-class ITranslationTemplatesBuildJob(IBuildFarmJobOld):
-
-    branch = Attribute("Branch")
-
-
-class ITranslationTemplatesBuildJobSource(Interface):
-    """Container for `TranslationTemplatesBuildJob`s."""
-
-    def getByBranch(branch):
-        """Find `TranslationTemplatesBuildJob` for given `Branch`."""

=== modified file 'lib/lp/translations/model/translationtemplatesbuild.py'
--- lib/lp/translations/model/translationtemplatesbuild.py	2013-11-15 06:50:22 +0000
+++ lib/lp/translations/model/translationtemplatesbuild.py	2013-11-21 04:35:28 +0000
@@ -18,7 +18,6 @@
     DateTime,
     Int,
     Reference,
-    Store,
     Storm,
     )
 from zope.component import getUtility
@@ -41,10 +40,6 @@
 from lp.code.interfaces.branchjob import IRosettaUploadJobSource
 from lp.code.model.branch import Branch
 from lp.code.model.branchcollection import GenericBranchCollection
-from lp.code.model.branchjob import (
-    BranchJob,
-    BranchJobType,
-    )
 from lp.registry.model.product import Product
 from lp.services.config import config
 from lp.services.database.bulk import load_related
@@ -55,9 +50,6 @@
     ITranslationTemplatesBuild,
     ITranslationTemplatesBuildSource,
     )
-from lp.translations.model.translationtemplatesbuildjob import (
-    TranslationTemplatesBuildJob,
-    )
 from lp.translations.pottery.detect_intltool import is_intltool_structure
 
 
@@ -119,18 +111,6 @@
         """See `IBuildFarmJob`."""
         return timedelta(seconds=10)
 
-    def makeJob(self):
-        """See `IBuildFarmJob`."""
-        # Pass public HTTP URL for the branch.
-        metadata = {
-            'branch_url': self.branch.composePublicURL(),
-            'build_id': self.id,
-            }
-        branch_job = BranchJob(
-            self.branch, BranchJobType.TRANSLATION_TEMPLATES_BUILD, metadata)
-        Store.of(self).add(branch_job)
-        return TranslationTemplatesBuildJob(branch_job)
-
     @classmethod
     def _getStore(cls, store=None):
         """Return `store` if given, or the default."""
@@ -159,7 +139,7 @@
 
     @classmethod
     def generatesTemplates(cls, branch):
-        """See `ITranslationTemplatesBuildJobSource`."""
+        """See `ITranslationTemplatesBuildSource`."""
         logger = logging.getLogger('translation-templates-build')
         if branch.private:
             # We don't support generating template from private branches
@@ -198,7 +178,7 @@
 
     @classmethod
     def scheduleTranslationTemplatesBuild(cls, branch):
-        """See `ITranslationTemplatesBuildJobSource`."""
+        """See `ITranslationTemplatesBuildSource`."""
         logger = logging.getLogger('translation-templates-build')
         if not config.rosetta.generate_templates:
             # This feature is disabled by default.
@@ -272,6 +252,6 @@
     def calculateScore(self):
         """See `IBuildFarmJob`."""
         # Hard-code score for now.  Most PPA jobs start out at 2505;
-        # TranslationTemplateBuildJobs are fast so we want them at a
-        # higher priority.
+        # TranslationTemplateBuild are fast so we want them at a higher
+        # priority.
         return HARDCODED_TRANSLATIONTEMPLATESBUILD_SCORE

=== modified file 'lib/lp/translations/model/translationtemplatesbuildbehavior.py'
--- lib/lp/translations/model/translationtemplatesbuildbehavior.py	2013-11-21 04:35:27 +0000
+++ lib/lp/translations/model/translationtemplatesbuildbehavior.py	2013-11-21 04:35:28 +0000
@@ -1,7 +1,7 @@
 # Copyright 2010-2013 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-"""An `IBuildFarmJobBehavior` for `TranslationTemplatesBuildJob`.
+"""An `IBuildFarmJobBehavior` for `TranslationTemplatesBuild`.
 
 Dispatches translation template build jobs to build-farm slaves.
 """

=== removed file 'lib/lp/translations/model/translationtemplatesbuildjob.py'
--- lib/lp/translations/model/translationtemplatesbuildjob.py	2013-11-21 04:35:27 +0000
+++ lib/lp/translations/model/translationtemplatesbuildjob.py	1970-01-01 00:00:00 +0000
@@ -1,101 +0,0 @@
-# Copyright 2010-2013 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-__metaclass__ = type
-__all__ = [
-    'TranslationTemplatesBuildJob',
-    ]
-
-from storm.store import Store
-from zope.component import getUtility
-from zope.interface import (
-    classProvides,
-    implements,
-    )
-
-from lp.buildmaster.model.buildfarmjob import BuildFarmJobOld
-from lp.code.model.branchjob import (
-    BranchJob,
-    BranchJobDerived,
-    BranchJobType,
-    )
-from lp.services.database.interfaces import IStore
-from lp.translations.interfaces.translationtemplatesbuild import (
-    ITranslationTemplatesBuildSource,
-    )
-from lp.translations.interfaces.translationtemplatesbuildjob import (
-    ITranslationTemplatesBuildJob,
-    ITranslationTemplatesBuildJobSource,
-    )
-
-
-class TranslationTemplatesBuildJob(BuildFarmJobOld, BranchJobDerived):
-    """An `IBuildFarmJob` implementation that generates templates.
-
-    Implementation-wise, this is actually a `BranchJob`.
-    """
-    implements(ITranslationTemplatesBuildJob)
-    class_job_type = BranchJobType.TRANSLATION_TEMPLATES_BUILD
-
-    classProvides(ITranslationTemplatesBuildJobSource)
-
-    def cleanUp(self):
-        """See `IBuildFarmJob`."""
-        # This class is not itself database-backed.  But it delegates to
-        # one that is.  We can't call its SQLObject destroySelf method
-        # though, because then the BuildQueue and the BranchJob would
-        # both try to delete the attached Job.
-        Store.of(self.context).remove(self.context)
-
-    @property
-    def build_id(self):
-        """Return the ID of the TranslationTemplatesBuild for this job."""
-        build_id = self.context.metadata.get('build_id', None)
-        if build_id is None:
-            return None
-        else:
-            return int(build_id)
-
-    @property
-    def build(self):
-        """Return a TranslationTemplateBuild for this build job."""
-        if self.build_id is None:
-            return None
-        else:
-            return getUtility(ITranslationTemplatesBuildSource).getByID(
-                self.build_id)
-
-    @classmethod
-    def getByJob(cls, job):
-        """See `IBuildFarmJob`.
-
-        Overridden here to search via a BranchJob, rather than a Job.
-        """
-        store = IStore(BranchJob)
-        branch_job = store.find(BranchJob, BranchJob.job == job).one()
-        if branch_job is None:
-            return None
-        else:
-            return cls(branch_job)
-
-    @classmethod
-    def getByJobs(cls, jobs):
-        """See `IBuildFarmJob`.
-
-        Overridden here to search via a BranchJob, rather than a Job.
-        """
-        store = IStore(BranchJob)
-        job_ids = [job.id for job in jobs]
-        branch_jobs = store.find(
-            BranchJob, BranchJob.jobID.is_in(job_ids))
-        return [cls(branch_job) for branch_job in branch_jobs]
-
-    @classmethod
-    def getByBranch(cls, branch):
-        """See `ITranslationTemplatesBuildJobSource`."""
-        store = IStore(BranchJob)
-        branch_job = store.find(BranchJob, BranchJob.branch == branch).one()
-        if branch_job is None:
-            return None
-        else:
-            return cls(branch_job)

=== removed file 'lib/lp/translations/tests/test_translationtemplatesbuildjob.py'
--- lib/lp/translations/tests/test_translationtemplatesbuildjob.py	2013-11-21 04:35:27 +0000
+++ lib/lp/translations/tests/test_translationtemplatesbuildjob.py	1970-01-01 00:00:00 +0000
@@ -1,103 +0,0 @@
-# Copyright 2010-2013 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-__metaclass__ = type
-
-from storm.store import Store
-from zope.component import getUtility
-from zope.security.proxy import removeSecurityProxy
-
-from lp.buildmaster.enums import BuildFarmJobType
-from lp.buildmaster.interfaces.buildfarmjob import IBuildFarmJobOld
-from lp.buildmaster.model.buildqueue import BuildQueue
-from lp.code.interfaces.branch import IBranchSet
-from lp.code.interfaces.branchjob import IBranchJob
-from lp.services.job.model.job import Job
-from lp.testing import (
-    TestCaseWithFactory,
-    verifyObject,
-    )
-from lp.testing.layers import (
-    LaunchpadZopelessLayer,
-    ZopelessDatabaseLayer,
-    )
-from lp.translations.interfaces.translationtemplatesbuildjob import (
-    ITranslationTemplatesBuildJobSource,
-    )
-from lp.translations.model.translationtemplatesbuildjob import (
-    TranslationTemplatesBuildJob,
-    )
-
-
-def get_job_id(job):
-    """Peek inside a `Job` and retrieve its id."""
-    return removeSecurityProxy(job).id
-
-
-class TestTranslationTemplatesBuildJob(TestCaseWithFactory):
-    """Test `TranslationTemplatesBuildJob`."""
-
-    layer = ZopelessDatabaseLayer
-
-    def setUp(self):
-        super(TestTranslationTemplatesBuildJob, self).setUp()
-        self.jobset = getUtility(ITranslationTemplatesBuildJobSource)
-        self.build = self.factory.makeTranslationTemplatesBuild()
-        self.buildqueue = removeSecurityProxy(self.build.queueBuild())
-        bfjo = removeSecurityProxy(self.build).makeJob()
-        self.buildqueue._job = bfjo.job
-        self.buildqueue._job_type = BuildFarmJobType.TRANSLATIONTEMPLATESBUILD
-        self.specific_job = self.jobset.getByBranch(self.build.branch)
-
-    def test_new_TranslationTemplatesBuildJob(self):
-        # TranslationTemplateBuildJob implements IBuildFarmJobOld,
-        # and IBranchJob.
-        verifyObject(IBranchJob, self.specific_job)
-        verifyObject(IBuildFarmJobOld, self.specific_job)
-
-        # Each of these jobs knows the branch it will operate on.
-        self.assertEqual(self.build.branch, self.specific_job.branch)
-
-    def test_has_Job(self):
-        # Associated with each TranslationTemplateBuildJob is a Job.
-        base_job = self.specific_job.job
-        self.assertIsInstance(base_job, Job)
-
-        # From a Job, the TranslationTemplatesBuildJobSource can find the
-        # TranslationTemplatesBuildJob back for us.
-        specific_job_for_base_job = removeSecurityProxy(
-            TranslationTemplatesBuildJob.getByJob(base_job))
-        self.assertEqual(self.specific_job, specific_job_for_base_job)
-
-    def test_cleanUp(self):
-        # TranslationTemplatesBuildJob has its own customized cleanup
-        # behaviour, since it's actually a BranchJob.
-        job = removeSecurityProxy(self.specific_job.job)
-
-        job_id = job.id
-        store = Store.of(job)
-        branch_name = self.build.branch.unique_name
-
-        self.buildqueue.destroySelf()
-
-        # BuildQueue is gone.
-        self.assertIs(
-            None, store.find(BuildQueue, id=self.buildqueue.id).one())
-        # Job is gone.
-        self.assertIs(None, store.find(Job, Job.id == job_id).one())
-        # TranslationTemplatesBuildJob is gone.
-        self.assertIs(None, TranslationTemplatesBuildJob.getByJob(job_id))
-        # Branch is still here.
-        branch_set = getUtility(IBranchSet)
-        self.assertEqual(
-            self.build.branch, branch_set.getByUniqueName(branch_name))
-
-
-class TestTranslationTemplatesBuildJobSource(TestCaseWithFactory):
-    """Test `TranslationTemplatesBuildJobSource`."""
-
-    layer = LaunchpadZopelessLayer
-
-    def test_baseline(self):
-        utility = getUtility(ITranslationTemplatesBuildJobSource)
-        verifyObject(ITranslationTemplatesBuildJobSource, utility)


Follow ups