Exemplo n.º 1
0
 void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) {
     StreamingReporterBase::sectionStarting( sectionInfo );
     if( m_sectionDepth++ > 0 ) {
         m_xml.startElement( "Section" )
             .writeAttribute( "name", trim( sectionInfo.name ) );
         writeSourceInfo( sectionInfo.lineInfo );
         m_xml.ensureTagClosed();
     }
 }
Exemplo n.º 2
0
PriorityFlag ACSLogImpl::write(const ACSLog::RTContext & rtCont,
		    const ACSLog::SourceInfo & srcInfo,
		    const ACSLog::NVPairSeq & data)
{
  PriorityFlag flag=0;
 
  flag |= writeRTContext (rtCont);
  flag |= writeSourceInfo (srcInfo);
 
  writeData (data);

  return flag;
}
Exemplo n.º 3
0
    void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) {
        StreamingReporterBase::testCaseStarting(testInfo);
        m_xml.startElement( "TestCase" )
            .writeAttribute( "name", trim( testInfo.name ) )
            .writeAttribute( "description", testInfo.description )
            .writeAttribute( "tags", testInfo.tagsAsString() );

        writeSourceInfo( testInfo.lineInfo );

        if ( m_config->showDurations() == ShowDurations::Always )
            m_testCaseTimer.start();
        m_xml.ensureTagClosed();
    }
Exemplo n.º 4
0
void ACSLogImpl::logWithAudience (ACSLog::Priorities p,
			      acscommon::TimeStamp time,
			      const char * msg,
			      const ACSLog::RTContext & rtCont,
			      const ACSLog::SourceInfo & srcInfo,
			      const char * audience,
                              const char * array,
                              const char * antenna) 
{  
  PriorityFlag  flag = writeRTContext(rtCont)|writeSourceInfo(srcInfo);
  ACS_CHECK_LOGGER;
  LoggingProxy::Flags(flag);
  if(audience!=NULL)LoggingProxy::audience(audience);
  if(array!=NULL)LoggingProxy::array(array);
  if(antenna!=NULL)LoggingProxy::antenna(antenna);
  LOG_RECORD(acslog2loggingPriority(p), msg, srcInfo.file.in(), srcInfo.line, srcInfo.routine.in(), time, rtCont.sourceObject.in());
}
Exemplo n.º 5
0
    bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) {

        AssertionResult const& result = assertionStats.assertionResult;

        bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();

        if( includeResults || result.getResultType() == ResultWas::Warning ) {
            // Print any info messages in <Info> tags.
            for( auto const& msg : assertionStats.infoMessages ) {
                if( msg.type == ResultWas::Info && includeResults ) {
                    m_xml.scopedElement( "Info" )
                            .writeText( msg.message );
                } else if ( msg.type == ResultWas::Warning ) {
                    m_xml.scopedElement( "Warning" )
                            .writeText( msg.message );
                }
            }
        }

        // Drop out if result was successful but we're not printing them.
        if( !includeResults && result.getResultType() != ResultWas::Warning )
            return true;


        // Print the expression if there is one.
        if( result.hasExpression() ) {
            m_xml.startElement( "Expression" )
                .writeAttribute( "success", result.succeeded() )
                .writeAttribute( "type", result.getTestMacroName() );

            writeSourceInfo( result.getSourceInfo() );

            m_xml.scopedElement( "Original" )
                .writeText( result.getExpression() );
            m_xml.scopedElement( "Expanded" )
                .writeText( result.getExpandedExpression() );
        }

        // And... Print a result applicable to each result type.
        switch( result.getResultType() ) {
            case ResultWas::ThrewException:
                m_xml.startElement( "Exception" );
                writeSourceInfo( result.getSourceInfo() );
                m_xml.writeText( result.getMessage() );
                m_xml.endElement();
                break;
            case ResultWas::FatalErrorCondition:
                m_xml.startElement( "FatalErrorCondition" );
                writeSourceInfo( result.getSourceInfo() );
                m_xml.writeText( result.getMessage() );
                m_xml.endElement();
                break;
            case ResultWas::Info:
                m_xml.scopedElement( "Info" )
                    .writeText( result.getMessage() );
                break;
            case ResultWas::Warning:
                // Warning will already have been written
                break;
            case ResultWas::ExplicitFailure:
                m_xml.startElement( "Failure" );
                writeSourceInfo( result.getSourceInfo() );
                m_xml.writeText( result.getMessage() );
                m_xml.endElement();
                break;
            default:
                break;
        }

        if( result.hasExpression() )
            m_xml.endElement();

        return true;
    }