Search in sources :

Example 1 with TestComponent

use of org.eclipse.titan.log.viewer.views.msc.model.TestComponent in project titan.EclipsePlug-ins by eclipse.

the class Parser method preParseLogRecord.

// parse
/**
 * Parse a single log record.
 *
 * @param logRecord the record to analyze.
 */
private void preParseLogRecord(final LogRecord logRecord, final Set<String> currentlyLivingComponents) {
    final String message = logRecord.getMessage();
    this.messageAnalyser.setMessage(message);
    boolean isLogRecordIgnored = false;
    if (executionModel.getFilterPattern() != null) {
        isLogRecordIgnored = !executionModel.getFilterPattern().match(logRecord);
    }
    // This branch handles send events.
    if (this.messageAnalyser.isSend()) {
        String sendType = messageAnalyser.getSendType();
        if (!isLogRecordIgnored && !isSignalIgnored(sendType) && components != null) {
            String sendTarget = messageAnalyser.getSendTarget();
            TestComponent tc = components.get(sendTarget);
            if (tc != null) {
                String logComponentRef = logRecord.getComponentReference();
                Set<String> sources = tc.getMappedFromReference(messageAnalyser.getSendSource());
                String source = getSource(logComponentRef, sources);
                if (source != null && !isComponentIgnored(source)) {
                    sends++;
                    eventVector.add(logRecord.getRecordNumber());
                }
            }
        }
    } else if (messageAnalyser.isReceive()) {
        // This branch handles receive events.
        String receiveType = messageAnalyser.getReceiveType();
        if (!isLogRecordIgnored && !isSignalIgnored(receiveType) && components != null) {
            String sourceRef = messageAnalyser.getReceiveSource();
            TestComponent tc = components.get(sourceRef);
            if (tc != null) {
                String receiveTargetPort = messageAnalyser.getReceiveTarget();
                String logComponentRef = logRecord.getComponentReference();
                Set<String> targetRefs = tc.getMappedFromReference(receiveTargetPort);
                String targetRef = getTargetRef(logComponentRef, targetRefs);
                if (targetRef != null && !isComponentIgnored(targetRef)) {
                    recs++;
                    eventVector.add(logRecord.getRecordNumber());
                }
            }
        }
    } else if (messageAnalyser.isEnqueued()) {
        // This branch handles enqueued events.
        String receiveType = messageAnalyser.getReceiveType();
        if (!isLogRecordIgnored && !isSignalIgnored(receiveType) && components != null) {
            String sourceRef = messageAnalyser.getReceiveSource();
            TestComponent tc = components.get(sourceRef);
            if (tc != null) {
                String enqueuedTargetPort = messageAnalyser.getEnqueuedTarget();
                String logComponentRef = logRecord.getComponentReference();
                Set<String> targetRefs = tc.getMappedFromReference(enqueuedTargetPort);
                // In case of valid log files it cannot happen.
                String targetRef = getTargetRef(logComponentRef, targetRefs);
                if (targetRef != null && !isComponentIgnored(targetRef)) {
                    enqs++;
                    eventVector.add(logRecord.getRecordNumber());
                }
            }
        }
    } else if (this.messageAnalyser.isReceiveOperation()) {
        // This branch handles receive operation events. AFAIK,
        // it is obsolete in new (>= 1.7.pl0) TITAN versions.
        String recieveType = messageAnalyser.getReceiveOperationType();
        if (!isLogRecordIgnored && !isSignalIgnored(recieveType) && components != null) {
            String sourceRef = messageAnalyser.getReceiveSource();
            TestComponent tc = components.get(sourceRef);
            if (tc != null) {
                String receiveTargetPort = messageAnalyser.getReceiveOperationTarget();
                String logComponentRef = logRecord.getComponentReference();
                Set<String> targetRefs = tc.getMappedFromReference(receiveTargetPort);
                String targetRef = getTargetRef(logComponentRef, targetRefs);
                if (targetRef != null && !isComponentIgnored(targetRef)) {
                    recs++;
                    eventVector.add(logRecord.getRecordNumber());
                }
            }
        }
    } else if (this.messageAnalyser.isStartFunction()) {
        // This branch handles function start events.
        if (components != null) {
            String targetRef = this.messageAnalyser.getStartFunctionReference();
            if ((targetRef != null) && !isLogRecordIgnored && !isComponentIgnored(targetRef) && !isFunctionIgnored(this.messageAnalyser.getStartFunctionName())) {
                eventVector.add(logRecord.getRecordNumber());
            }
        }
    } else if (this.messageAnalyser.isComponentCreation()) {
        // This branch handles component creation events.
        if (components != null) {
            EventObject event = createEventObject(logRecord, EventType.PTC_CREATE);
            event.setEventNumber(eventVector.size() + 3);
            String reference = event.getReference();
            currentlyLivingComponents.add(reference);
            TestComponent tc = components.get(reference);
            if (tc == null) {
                addComponent(event);
                if ((reference != null) && !isComponentIgnored(reference)) {
                    this.ptcs++;
                    eventVector.add(logRecord.getRecordNumber());
                    executionModel.addLifeLineInfo(event);
                }
            } else {
                if (!isComponentIgnored(reference)) {
                    logRecord.setComponentReference(Constants.MTC_REFERENCE);
                    eventVector.add(logRecord.getRecordNumber());
                    executionModel.addLifeLineInfo(event);
                }
            }
        }
    } else if (this.messageAnalyser.isComponentDone()) {
        // This branch handles component done events.
        EventObject event = createEventObject(logRecord, EventType.PTC_DONE);
        String reference = event.getReference();
        if ((reference != null) && !isComponentIgnored(reference)) {
            eventVector.add(logRecord.getRecordNumber());
        }
    } else if (this.messageAnalyser.isComponentTermination()) {
        // This branch handles component termination events.
        if (components != null) {
            String ref = this.messageAnalyser.getComponentTerminationReference();
            currentlyLivingComponents.remove(ref);
            if ((ref != null) && !isComponentIgnored(ref)) {
                String terminationVerdict = this.messageAnalyser.getComponentTerminationVerdict();
                TestComponent component = components.get(ref);
                if (component != null) {
                    component.setVerdict(terminationVerdict);
                }
                EventObject event = createEventObject(logRecord, EventType.PTC_TERMINATE);
                event.setEventNumber(eventVector.size() + 3);
                event.setReference(ref);
                eventVector.add(logRecord.getRecordNumber());
                executionModel.addLifeLineInfo(event);
            }
        }
    } else if (this.messageAnalyser.isPortMapping()) {
        // This branch handles port mapping events.
        String mappingSource = this.messageAnalyser.getPortMappingSource();
        final String compRef = this.messageAnalyser.getComponentRef(mappingSource);
        String target = this.messageAnalyser.getPortMappingTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        String sourcePort = this.messageAnalyser.getPort(mappingSource);
        String targetPort = this.messageAnalyser.getPort(target);
        if (!filterMappingPorts && !isLogRecordIgnored && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            eventVector.add(logRecord.getRecordNumber());
            this.maps++;
        }
        // Used for mapping ports to reference
        addPortMapping(compRef, sourcePort, targetRef, targetPort);
    } else if (this.messageAnalyser.isPortUnmapping()) {
        // This branch handles port unmapping events.
        String unmappingSource = this.messageAnalyser.getPortUnMapping();
        String compRef = this.messageAnalyser.getComponentRef(unmappingSource);
        compRef = this.messageAnalyser.getComponentRef(compRef);
        String target = this.messageAnalyser.getPortUnMappingTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        if (!filterMappingPorts && !isLogRecordIgnored && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            eventVector.add(logRecord.getRecordNumber());
            this.maps++;
        }
    // Used for mapping ports to reference
    // removePortMapping(messageAnalyser.getPortMappingSource(),
    } else if (this.messageAnalyser.isPortConnection()) {
        // This branch handles port connection events.
        String connectionSource = this.messageAnalyser.getPortConnectionSource();
        final String compRef = this.messageAnalyser.getComponentRef(connectionSource);
        // Used for connect port and reference
        String target = this.messageAnalyser.getPortConnectionTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        String sourcePort = this.messageAnalyser.getPort(connectionSource);
        String targetPort = this.messageAnalyser.getPort(target);
        if (!filterConnectingPorts && !isLogRecordIgnored && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            eventVector.add(logRecord.getRecordNumber());
            this.cons++;
        }
        addPortMapping(compRef, sourcePort, targetRef, targetPort);
    } else if (this.messageAnalyser.isPortDisconnection()) {
        // This branch handles port disconnection events.
        String disconnectionSource = this.messageAnalyser.getPortDisconnectionSource();
        final String compRef = this.messageAnalyser.getComponentRef(disconnectionSource);
        // Used for disconnect port and reference
        String target = this.messageAnalyser.getPortConnectionTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        if (!filterConnectingPorts && !isLogRecordIgnored && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            eventVector.add(logRecord.getRecordNumber());
            this.cons++;
        }
    } else if (this.messageAnalyser.isTestcaseStart()) {
        // This branch handles test case start events.
        eventVector.add(logRecord.getRecordNumber());
    } else if (this.messageAnalyser.isTestcaseEnd()) {
        // This branch handles test case end events.
        eventVector.add(logRecord.getRecordNumber());
        notifyChange();
    } else if (this.messageAnalyser.isMTCCreation()) {
        EventObject event = createEventObject(logRecord, EventType.MTC_CREATE);
        addComponent(event);
        eventVector.add(logRecord.getRecordNumber());
    } else if (this.messageAnalyser.isMTCTermination()) {
        // This branch handles master test component termination events.
        eventVector.add(logRecord.getRecordNumber());
        mtcTerminated = true;
    } else if (this.messageAnalyser.isMTCDone()) {
        // This branch handles master test component done and sets the verdict.
        eventVector.add(logRecord.getRecordNumber());
    } else if (this.messageAnalyser.isSetverdict()) {
        if ((logRecord.getComponentReference() != null) && !isLogRecordIgnored && !isComponentIgnored(logRecord.getComponentReference())) {
            // Get type - change type inconc
            String setverdicttype = this.messageAnalyser.getSetverdictType();
            if (Constants.TEST_CASE_VERDICT_INCONCLUSIVE.equals(setverdicttype) && displaySetverdictInconc) {
                setverdictVector.add(eventVector.size());
                eventVector.add(logRecord.getRecordNumber());
            } else if (Constants.TEST_CASE_VERDICT_ERROR.equals(setverdicttype) && displaySetverdictError) {
                setverdictVector.add(eventVector.size());
                eventVector.add(logRecord.getRecordNumber());
            } else if (Constants.TEST_CASE_VERDICT_FAIL.equals(setverdicttype) && displaySetverdictFail) {
                setverdictVector.add(eventVector.size());
                eventVector.add(logRecord.getRecordNumber());
            } else if (Constants.TEST_CASE_VERDICT_NONE.equals(setverdicttype) && displaySetverdictNone) {
                setverdictVector.add(eventVector.size());
                eventVector.add(logRecord.getRecordNumber());
            } else if (Constants.TEST_CASE_VERDICT_PASS.equals(setverdicttype) && displaySetverdictPass) {
                setverdictVector.add(eventVector.size());
                eventVector.add(logRecord.getRecordNumber());
            }
            errorVector.clear();
            failVector.clear();
        }
    } else {
        // Silent events
        Boolean filtered = isEventIgnored(logRecord.getEventType());
        String compRef = logRecord.getComponentReference();
        if (compRef == null || compRef.length() == 0) {
            compRef = this.messageAnalyser.isSilentEvent();
        }
        if (compRef != null && compRef.length() > 0 && !isComponentIgnored(logRecord.getComponentReference())) {
            addDummyComponent(compRef);
            currentlyLivingComponents.add(compRef);
        }
        isLogRecordIgnored = isLogRecordIgnored || isComponentIgnored(logRecord.getComponentReference());
        if (!filtered && !isLogRecordIgnored) {
            eventVector.add(logRecord.getRecordNumber());
        }
    }
    // setverdict(error)
    if (this.messageAnalyser.isDynamicTestCaseError()) {
        ConnectedRecord connectedRecord = new ConnectedRecord(logRecord.getRecordOffset(), logRecord.getRecordLength(), logRecord.getRecordNumber());
        errorVector.add(connectedRecord);
    }
    // check if fail messages, used for setverdict(fail)
    if (this.messageAnalyser.isFailMessages()) {
        ConnectedRecord connectedRecord = new ConnectedRecord(logRecord.getRecordOffset(), logRecord.getRecordLength(), logRecord.getRecordNumber());
        failVector.add(connectedRecord);
    }
}
Also used : TestComponent(org.eclipse.titan.log.viewer.views.msc.model.TestComponent) HashSet(java.util.HashSet) Set(java.util.Set) EventObject(org.eclipse.titan.log.viewer.views.msc.model.EventObject)

Example 2 with TestComponent

use of org.eclipse.titan.log.viewer.views.msc.model.TestComponent in project titan.EclipsePlug-ins by eclipse.

the class Parser method parseLogRecord.

/**
 * Parse a single log record.
 *
 * @param logRecord the record to analyze.
 * @param eventIndex the index of the event to be used in setverdict handling.
 */
private EventObject parseLogRecord(final LogRecord logRecord, final int eventIndex) {
    final String message = logRecord.getMessage();
    this.messageAnalyser.setMessage(message);
    // TODO remove filtering from this function
    boolean isLogRecordIgnored = false;
    if (executionModel.getFilterPattern() != null) {
        isLogRecordIgnored = !executionModel.getFilterPattern().match(logRecord);
    }
    // This branch handles send events.
    if (this.messageAnalyser.isSend()) {
        String sendType = messageAnalyser.getSendType();
        if (!isSignalIgnored(sendType) && components != null) {
            String sendTarget = messageAnalyser.getSendTarget();
            TestComponent tc = components.get(sendTarget);
            if (tc != null) {
                String logComponentRef = logRecord.getComponentReference();
                Set<String> sources = tc.getMappedFromReference(messageAnalyser.getSendSource());
                String source = getSource(logComponentRef, sources);
                if (source != null && !isComponentIgnored(source)) {
                    sends++;
                    EventObject event = createEventObject(logRecord, EventType.SEND);
                    String deciphered = decipherer.decipher(sendType.trim(), messageAnalyser.getSendValue());
                    if (deciphered != null) {
                        event.setName(deciphered);
                    } else {
                        event.setName(sendType);
                    }
                    event.setReference(source);
                    event.setTarget(sendTarget);
                    if (tc.getAlternative() != null) {
                        event.setTarget(tc.getAlternative());
                    }
                    return event;
                }
            }
        }
    } else if (messageAnalyser.isReceive()) {
        // This branch handles receive events.
        String recieveType = messageAnalyser.getReceiveType();
        if (!isSignalIgnored(recieveType) && !isLogRecordIgnored && components != null) {
            String sourceRef = messageAnalyser.getReceiveSource();
            TestComponent tc = components.get(sourceRef);
            if (tc != null) {
                String recieveTargetPort = messageAnalyser.getReceiveTarget();
                String logComponentRef = logRecord.getComponentReference();
                Set<String> targetRefs = tc.getMappedFromReference(recieveTargetPort);
                String targetRef = getTargetRef(logComponentRef, targetRefs);
                if (targetRef != null && !isComponentIgnored(targetRef)) {
                    return handleReceive(logRecord, recieveType, sourceRef, tc, recieveTargetPort, targetRef);
                }
            }
        }
    } else if (messageAnalyser.isEnqueued()) {
        // This branch handles enqueued events.
        String recieveType = messageAnalyser.getReceiveType();
        if (!isSignalIgnored(recieveType) && !isLogRecordIgnored && components != null) {
            String sourceRef = messageAnalyser.getReceiveSource();
            TestComponent tc = components.get(sourceRef);
            if (tc != null) {
                String enqueuedTargetPort = messageAnalyser.getEnqueuedTarget();
                String logComponentRef = logRecord.getComponentReference();
                Set<String> targetRefs = tc.getMappedFromReference(enqueuedTargetPort);
                // In case of valid log files it cannot happen.
                String targetRef = getTargetRef(logComponentRef, targetRefs);
                if (targetRef != null && !isComponentIgnored(targetRef)) {
                    enqs++;
                    EventObject event = createEventObject(logRecord, EventType.ENQUEUED);
                    String msg = messageAnalyser.getReceiveValue();
                    String deciphered = decipherer.decipher(recieveType, msg);
                    if (deciphered != null) {
                        event.setName(deciphered);
                    } else {
                        event.setName(recieveType);
                    }
                    event.setReference(sourceRef);
                    event.setTarget(targetRef);
                    event.setPort(enqueuedTargetPort);
                    if (tc.getAlternative() != null) {
                        event.setReference(tc.getAlternative());
                    }
                    return event;
                }
            }
        }
    } else if (this.messageAnalyser.isReceiveOperation()) {
        // This branch handles receive operation events. AFAIK,
        // it is obsolete in new (>= 1.7.pl0) TITAN versions.
        String recieveType = messageAnalyser.getReceiveOperationType();
        if (!isSignalIgnored(recieveType) && components != null) {
            String sourceRef = messageAnalyser.getReceiveSource();
            TestComponent tc = components.get(sourceRef);
            if (tc != null) {
                String receiveTargetPort = messageAnalyser.getReceiveOperationTarget();
                String logComponentRef = logRecord.getComponentReference();
                Set<String> targetRefs = tc.getMappedFromReference(receiveTargetPort);
                String targetRef = getTargetRef(logComponentRef, targetRefs);
                if (targetRef != null && !isComponentIgnored(targetRef)) {
                    return handleReceive(logRecord, recieveType, sourceRef, tc, receiveTargetPort, targetRef);
                }
            }
        }
    } else if (this.messageAnalyser.isStartFunction()) {
        // This branch handles function start events.
        if (components != null) {
            String targetRef = this.messageAnalyser.getStartFunctionReference();
            if ((targetRef != null) && !isComponentIgnored(targetRef) && !isFunctionIgnored(this.messageAnalyser.getStartFunctionName())) {
                EventObject event = createEventObject(logRecord, EventType.FUNCTION);
                event.setName(this.messageAnalyser.getStartFunctionName());
                event.setReference(Constants.MTC_REFERENCE);
                event.setTarget(targetRef);
                return event;
            }
        }
    } else if (this.messageAnalyser.isComponentCreation()) {
        // This branch handles component creation events.
        if (components != null) {
            EventObject event = createEventObject(logRecord, EventType.PTC_CREATE);
            String reference = event.getReference();
            TestComponent tc = components.get(reference);
            if (tc == null || tc.getRecordNumber() == logRecord.getRecordNumber()) {
                if ((reference != null) && !isComponentIgnored(reference)) {
                    return event;
                }
            } else {
                if (!isComponentIgnored(reference)) {
                    logRecord.setComponentReference(reference);
                    event = eventObjectFactory.createEventObject(EventType.SILENT_EVENT, logRecord, this.messageAnalyser, this.logFileMetaData.getTimeStampConstant());
                    return event;
                }
            }
        }
    } else if (this.messageAnalyser.isComponentDone()) {
        // This branch handles component done events.
        EventObject event = createEventObject(logRecord, EventType.PTC_DONE);
        String reference = event.getReference();
        if ((reference != null) && !isComponentIgnored(reference)) {
            return event;
        }
    } else if (this.messageAnalyser.isComponentTermination()) {
        // This branch handles component termination events.
        if (components != null) {
            String ref = this.messageAnalyser.getComponentTerminationReference();
            if ((ref != null) && !isComponentIgnored(ref)) {
                String terminationVerdict = this.messageAnalyser.getComponentTerminationVerdict();
                TestComponent component = components.get(ref);
                if (component != null) {
                    component.setVerdict(terminationVerdict);
                }
                EventObject event = createEventObject(logRecord, EventType.PTC_TERMINATE);
                event.setReference(ref);
                event.setName(terminationVerdict);
                return event;
            }
        }
    } else if (this.messageAnalyser.isPortMapping()) {
        // This branch handles port mapping events.
        String mappingSource = this.messageAnalyser.getPortMappingSource();
        final String compRef = this.messageAnalyser.getComponentRef(mappingSource);
        String target = this.messageAnalyser.getPortMappingTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        String sourcePort = this.messageAnalyser.getPort(mappingSource);
        String targetPort = this.messageAnalyser.getPort(target);
        if (!filterMappingPorts && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            EventObject event = createEventObject(logRecord, EventType.MAPPING_PORT);
            event.setPort(sourcePort);
            event.setTargetPort(targetPort);
            event.setTarget(targetRef);
            event.setName(MAPPING);
            return event;
        }
        // Used for mapping ports to reference
        addPortMapping(compRef, sourcePort, targetRef, targetPort);
    } else if (this.messageAnalyser.isPortUnmapping()) {
        // This branch handles port unmapping events.
        String unmappingSource = this.messageAnalyser.getPortUnMapping();
        String compRef = this.messageAnalyser.getComponentRef(unmappingSource);
        compRef = this.messageAnalyser.getComponentRef(compRef);
        String target = this.messageAnalyser.getPortUnMappingTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        String sourcePort = this.messageAnalyser.getPort(unmappingSource);
        String targetPort = this.messageAnalyser.getPort(target);
        if (!filterMappingPorts && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            EventObject event = createEventObject(logRecord, EventType.UNMAPPING_PORT);
            event.setPort(sourcePort);
            event.setTargetPort(targetPort);
            event.setTarget(targetRef);
            event.setName(UNMAPPING);
            return event;
        }
    // Used for mapping ports to reference
    } else if (this.messageAnalyser.isPortConnection()) {
        // This branch handles port connection events.
        String connectionSource = this.messageAnalyser.getPortConnectionSource();
        final String compRef = this.messageAnalyser.getComponentRef(connectionSource);
        // Used for connect port and reference
        String target = this.messageAnalyser.getPortConnectionTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        String sourcePort = this.messageAnalyser.getPort(connectionSource);
        String targetPort = this.messageAnalyser.getPort(target);
        if (!filterConnectingPorts && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            EventObject event = createEventObject(logRecord, EventType.CONNECTING_PORT);
            event.setPort(sourcePort);
            event.setTargetPort(targetPort);
            event.setTarget(targetRef);
            event.setName(CONNECTING);
            return event;
        }
        addPortMapping(compRef, sourcePort, targetRef, targetPort);
    } else if (this.messageAnalyser.isPortDisconnection()) {
        // This branch handles port disconnection events.
        String disconnectionSource = this.messageAnalyser.getPortDisconnectionSource();
        final String compRef = this.messageAnalyser.getComponentRef(disconnectionSource);
        // Used for disconnect port and reference
        String target = this.messageAnalyser.getPortConnectionTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        String sourcePort = this.messageAnalyser.getPort(disconnectionSource);
        String targetPort = this.messageAnalyser.getPort(target);
        if (!filterConnectingPorts && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            EventObject event = createEventObject(logRecord, EventType.DISCONNECTING_PORT);
            event.setPort(sourcePort);
            event.setTargetPort(targetPort);
            event.setTarget(targetRef);
            event.setName(DISCONNECTING);
            return event;
        }
    } else if (this.messageAnalyser.isTestcaseStart()) {
        // This branch handles test case start events.
        return eventObjectFactory.createEventObject(EventType.TC_START, logRecord, this.messageAnalyser, this.logFileMetaData.getTimeStampConstant());
    } else if (this.messageAnalyser.isTestcaseEnd()) {
        // This branch handles test case end events.
        return eventObjectFactory.createEventObject(EventType.TC_END, logRecord, this.messageAnalyser, this.logFileMetaData.getTimeStampConstant());
    } else if (this.messageAnalyser.isMTCCreation()) {
        EventObject event = createEventObject(logRecord, EventType.MTC_CREATE);
        addComponent(event);
        return event;
    } else if (this.messageAnalyser.isMTCTermination()) {
        // This branch handles master test component termination events.
        return eventObjectFactory.createEventObject(EventType.MTC_TERMINATE, logRecord, this.messageAnalyser, this.logFileMetaData.getTimeStampConstant());
    } else if (this.messageAnalyser.isMTCDone()) {
        // This branch handles master test component done and sets the verdict.
        if (components != null) {
            TestComponent component = components.get(Constants.MTC_REFERENCE);
            if (component != null) {
                String verdict = this.messageAnalyser.getMTCVerdict();
                component.setVerdict(verdict);
            }
        }
        EventObject event = createEventObject(logRecord, EventType.SILENT_EVENT);
        event.setReference(Constants.MTC_REFERENCE);
        return event;
    } else if (this.messageAnalyser.isSetverdict()) {
        if ((logRecord.getComponentReference() != null) && !isComponentIgnored(logRecord.getComponentReference())) {
            // Get type - change type inconc
            String setverdicttype = this.messageAnalyser.getSetverdictType();
            if (Constants.TEST_CASE_VERDICT_INCONCLUSIVE.equals(setverdicttype) && displaySetverdictInconc) {
                setverdictVector.add(eventIndex);
                EventObject event = createEventObject(logRecord, EventType.SETVERDICT_INCONC);
                event.setName(setverdicttype);
                return event;
            } else if (Constants.TEST_CASE_VERDICT_ERROR.equals(setverdicttype) && displaySetverdictError) {
                setverdictVector.add(eventIndex);
                EventObject event = createEventObject(logRecord, EventType.SETVERDICT);
                event.setName(setverdicttype);
                ConnectedRecord[] connectedRecords = errorVector.toArray(new ConnectedRecord[errorVector.size()]);
                event.setConnectedRecords(connectedRecords);
                return event;
            } else if (Constants.TEST_CASE_VERDICT_FAIL.equals(setverdicttype) && displaySetverdictFail) {
                setverdictVector.add(eventIndex);
                EventObject event = createEventObject(logRecord, EventType.SETVERDICT);
                event.setName(setverdicttype);
                ConnectedRecord[] connectedRecords = failVector.toArray(new ConnectedRecord[failVector.size()]);
                event.setConnectedRecords(connectedRecords);
                return event;
            } else if (Constants.TEST_CASE_VERDICT_NONE.equals(setverdicttype) && displaySetverdictNone) {
                setverdictVector.add(eventIndex);
                EventObject event = createEventObject(logRecord, EventType.SETVERDICT_NONE);
                event.setName(setverdicttype);
                return event;
            } else if (Constants.TEST_CASE_VERDICT_PASS.equals(setverdicttype) && displaySetverdictPass) {
                setverdictVector.add(eventIndex);
                EventType setverdictPass = EventType.SETVERDICT_PASS;
                EventObject event = createEventObject(logRecord, setverdictPass);
                event.setName(setverdicttype);
                return event;
            }
            errorVector.clear();
            failVector.clear();
        }
    } else {
        // Silent events
        Boolean filtered = isEventIgnored(logRecord.getEventType());
        if (!filtered) {
            // component reference exists in the log record
            if ((logRecord.getComponentReference() != null) && (logRecord.getComponentReference().trim().length() > 0)) {
                return eventObjectFactory.createEventObject(EventType.SILENT_EVENT, logRecord, this.messageAnalyser, this.logFileMetaData.getTimeStampConstant());
            } else {
                final String compRef = this.messageAnalyser.isSilentEvent();
                logRecord.setComponentReference(compRef != null ? compRef : Constants.MTC_REFERENCE);
                return eventObjectFactory.createEventObject(EventType.SILENT_EVENT, logRecord, this.messageAnalyser, this.logFileMetaData.getTimeStampConstant());
            }
        }
    }
    // setverdict(error)
    if (this.messageAnalyser.isDynamicTestCaseError()) {
        ConnectedRecord connectedRecord = new ConnectedRecord(logRecord.getRecordOffset(), logRecord.getRecordLength(), logRecord.getRecordNumber());
        errorVector.add(connectedRecord);
    }
    // check if fail messages, used for setverdict(fail)
    if (this.messageAnalyser.isFailMessages()) {
        ConnectedRecord connectedRecord = new ConnectedRecord(logRecord.getRecordOffset(), logRecord.getRecordLength(), logRecord.getRecordNumber());
        failVector.add(connectedRecord);
    }
    return null;
}
Also used : TestComponent(org.eclipse.titan.log.viewer.views.msc.model.TestComponent) HashSet(java.util.HashSet) Set(java.util.Set) EventType(org.eclipse.titan.log.viewer.views.msc.model.EventType) EventObject(org.eclipse.titan.log.viewer.views.msc.model.EventObject)

Aggregations

HashSet (java.util.HashSet)2 Set (java.util.Set)2 EventObject (org.eclipse.titan.log.viewer.views.msc.model.EventObject)2 TestComponent (org.eclipse.titan.log.viewer.views.msc.model.TestComponent)2 EventType (org.eclipse.titan.log.viewer.views.msc.model.EventType)1