def testExecute(self):
        """
        Runs the plugin and then compares expected output with obtained output to verify that it executed correctly. 
        """
        self.run()

        # Checks the obtained result against the expected result
        edStringExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
        edStringObtainedOutput = self.readAndParseFile(self.m_edObtainedOutputDataFile)

        xsDataResultISPyBExpected = XSDataResultISPyB.parseString(edStringExpectedOutput)
        xsDataResultISPyBObtained = XSDataResultISPyB.parseString(edStringObtainedOutput)

        self.DEBUG("Checking obtained result...")

        xsDataIntegerExpDataCollectionId = xsDataResultISPyBExpected.getDataCollectionId()
        xsDataResultStatusExpScreening = xsDataResultISPyBExpected.getScreeningStatus()
        xsDataResultStatusExpScreeningInputs = xsDataResultISPyBExpected.getScreeningInputStatus()
        xsDataResultStatusExpScreeningOutputs = xsDataResultISPyBExpected.getScreeningOutputStatus()
        xsDataResultStatusExpScreeningOutputLattices = xsDataResultISPyBExpected.getScreeningOutputLatticeStatus()
        xsDataResultStatusExpScreeningStrategies = xsDataResultISPyBExpected.getScreeningStrategyStatus()
        xsDataResultStatusExpScreeningRanks = xsDataResultISPyBExpected.getScreeningRankStatus()
        xsDataResultStatusExpScreeningRankSet = xsDataResultISPyBExpected.getScreeningRankSetStatus()

        xsDataIntegerDataCollectionId = xsDataResultISPyBObtained.getDataCollectionId()
        xsDataResultStatusScreening = xsDataResultISPyBObtained.getScreeningStatus()
        xsDataResultStatusScreeningInputs = xsDataResultISPyBObtained.getScreeningInputStatus()
        xsDataResultStatusScreeningOutputs = xsDataResultISPyBObtained.getScreeningOutputStatus()
        xsDataResultStatusScreeningOutputLattices = xsDataResultISPyBObtained.getScreeningOutputLatticeStatus()
        xsDataResultStatusScreeningStrategies = xsDataResultISPyBObtained.getScreeningStrategyStatus()
        xsDataResultStatusScreeningRanks = xsDataResultISPyBObtained.getScreeningRankStatus()
        xsDataResultStatusScreeningRankSet = xsDataResultISPyBObtained.getScreeningRankSetStatus()

        if xsDataIntegerExpDataCollectionId != None:
            self.DEBUG("Checking dataCollectionId ...")
            EDAssert.equal(xsDataIntegerDataCollectionId.getValue(), xsDataIntegerExpDataCollectionId.getValue())
        if xsDataResultStatusExpScreening != None:
            self.DEBUG("Checking screening ...")
            EDAssert.equal(xsDataResultStatusScreening.getCode().getValue(), "ok")
            iId = xsDataResultStatusScreening.getId().getValue()
            EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusExpScreeningInputs != None:
            self.DEBUG("Checking inputs...")
            for xsDataResultStatusScreeningInput in xsDataResultStatusScreeningInputs:
                EDAssert.equal(xsDataResultStatusScreeningInput.getCode().getValue(), "ok")
                iId = xsDataResultStatusScreeningInput.getId().getValue()
                EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusExpScreeningOutputs != None:
            self.DEBUG("Checking outputs ...")
            for xsDataResultStatusScreeningOutput in xsDataResultStatusScreeningOutputs:
                EDAssert.equal(xsDataResultStatusScreeningOutput.getCode().getValue(), "ok")
                iId = xsDataResultStatusScreeningOutput.getId().getValue()
                EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusExpScreeningOutputLattices != None:
            self.DEBUG("Checking output lattices...")
            for xsDataResultStatusScreeningOutputLattice in xsDataResultStatusScreeningOutputLattices:
                EDAssert.equal(xsDataResultStatusScreeningOutputLattice.getCode().getValue(), "ok")
                iId = xsDataResultStatusScreeningOutputLattice.getId().getValue()
                EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusExpScreeningStrategies != None:
            self.DEBUG("Checking strategies...")
            for xsDataResultStatusScreeningStrategy in xsDataResultStatusScreeningStrategies:
                EDAssert.equal(xsDataResultStatusScreeningStrategy.getCode().getValue(), "ok")
                iId = xsDataResultStatusScreeningStrategy.getId().getValue()
                EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusExpScreeningRanks != None:
            self.DEBUG("Checking ranks...")
            for xsDataResultStatusScreeningRank in xsDataResultStatusScreeningRanks:
                EDAssert.equal(xsDataResultStatusScreeningRank.getCode().getValue(), "ok")
                iId = xsDataResultStatusScreeningRank.getId().getValue()
                EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusScreeningRankSet != None:
            self.DEBUG("Checking rank sets...")
            EDAssert.equal(xsDataResultStatusScreeningRankSet.getCode().getValue(), "ok")
            iId = xsDataResultStatusScreeningRankSet.getId().getValue()
            EDAssert.equal((iId >= 0), True)
Ejemplo n.º 2
0
    def testExecute(self):
        """
        Runs the plugin and then compares expected output with obtained output to verify that it executed correctly. 
        """
        self.run()

        # Checks the obtained result against the expected result
        edStringExpectedOutput = self.readAndParseFile(
            self.getReferenceDataOutputFile())
        edStringObtainedOutput = self.readAndParseFile(
            self.m_edObtainedOutputDataFile)

        xsDataResultISPyBExpected = XSDataResultISPyB.parseString(
            edStringExpectedOutput)
        xsDataResultISPyBObtained = XSDataResultISPyB.parseString(
            edStringObtainedOutput)

        self.DEBUG("Checking obtained result...")

        xsDataIntegerExpDataCollectionId = xsDataResultISPyBExpected.getDataCollectionId(
        )
        xsDataResultStatusExpScreening = xsDataResultISPyBExpected.getScreeningStatus(
        )
        xsDataResultStatusExpScreeningInputs = xsDataResultISPyBExpected.getScreeningInputStatus(
        )
        xsDataResultStatusExpScreeningOutputs = xsDataResultISPyBExpected.getScreeningOutputStatus(
        )
        xsDataResultStatusExpScreeningOutputLattices = xsDataResultISPyBExpected.getScreeningOutputLatticeStatus(
        )
        xsDataResultStatusExpScreeningStrategies = xsDataResultISPyBExpected.getScreeningStrategyStatus(
        )
        xsDataResultStatusExpScreeningRanks = xsDataResultISPyBExpected.getScreeningRankStatus(
        )
        xsDataResultStatusExpScreeningRankSet = xsDataResultISPyBExpected.getScreeningRankSetStatus(
        )

        xsDataIntegerDataCollectionId = xsDataResultISPyBObtained.getDataCollectionId(
        )
        xsDataResultStatusScreening = xsDataResultISPyBObtained.getScreeningStatus(
        )
        xsDataResultStatusScreeningInputs = xsDataResultISPyBObtained.getScreeningInputStatus(
        )
        xsDataResultStatusScreeningOutputs = xsDataResultISPyBObtained.getScreeningOutputStatus(
        )
        xsDataResultStatusScreeningOutputLattices = xsDataResultISPyBObtained.getScreeningOutputLatticeStatus(
        )
        xsDataResultStatusScreeningStrategies = xsDataResultISPyBObtained.getScreeningStrategyStatus(
        )
        xsDataResultStatusScreeningRanks = xsDataResultISPyBObtained.getScreeningRankStatus(
        )
        xsDataResultStatusScreeningRankSet = xsDataResultISPyBObtained.getScreeningRankSetStatus(
        )

        if xsDataIntegerExpDataCollectionId != None:
            self.DEBUG("Checking dataCollectionId ...")
            EDAssert.equal(xsDataIntegerDataCollectionId.getValue(),
                           xsDataIntegerExpDataCollectionId.getValue())
        if xsDataResultStatusExpScreening != None:
            self.DEBUG("Checking screening ...")
            EDAssert.equal(xsDataResultStatusScreening.getCode().getValue(),
                           "ok")
            iId = xsDataResultStatusScreening.getId().getValue()
            EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusExpScreeningInputs != None:
            self.DEBUG("Checking inputs...")
            for xsDataResultStatusScreeningInput in xsDataResultStatusScreeningInputs:
                EDAssert.equal(
                    xsDataResultStatusScreeningInput.getCode().getValue(),
                    "ok")
                iId = xsDataResultStatusScreeningInput.getId().getValue()
                EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusExpScreeningOutputs != None:
            self.DEBUG("Checking outputs ...")
            for xsDataResultStatusScreeningOutput in xsDataResultStatusScreeningOutputs:
                EDAssert.equal(
                    xsDataResultStatusScreeningOutput.getCode().getValue(),
                    "ok")
                iId = xsDataResultStatusScreeningOutput.getId().getValue()
                EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusExpScreeningOutputLattices != None:
            self.DEBUG("Checking output lattices...")
            for xsDataResultStatusScreeningOutputLattice in xsDataResultStatusScreeningOutputLattices:
                EDAssert.equal(
                    xsDataResultStatusScreeningOutputLattice.getCode().
                    getValue(), "ok")
                iId = xsDataResultStatusScreeningOutputLattice.getId(
                ).getValue()
                EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusExpScreeningStrategies != None:
            self.DEBUG("Checking strategies...")
            for xsDataResultStatusScreeningStrategy in xsDataResultStatusScreeningStrategies:
                EDAssert.equal(
                    xsDataResultStatusScreeningStrategy.getCode().getValue(),
                    "ok")
                iId = xsDataResultStatusScreeningStrategy.getId().getValue()
                EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusExpScreeningRanks != None:
            self.DEBUG("Checking ranks...")
            for xsDataResultStatusScreeningRank in xsDataResultStatusScreeningRanks:
                EDAssert.equal(
                    xsDataResultStatusScreeningRank.getCode().getValue(), "ok")
                iId = xsDataResultStatusScreeningRank.getId().getValue()
                EDAssert.equal((iId >= 0), True)
        if xsDataResultStatusScreeningRankSet != None:
            self.DEBUG("Checking rank sets...")
            EDAssert.equal(
                xsDataResultStatusScreeningRankSet.getCode().getValue(), "ok")
            iId = xsDataResultStatusScreeningRankSet.getId().getValue()
            EDAssert.equal((iId >= 0), True)