Search in sources :

Example 16 with UserSession

use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.

the class DummyClassificationStage method execute.

@Override
protected void execute() throws Exception {
    final UserSession session = this.sessionInputPort.receive();
    final Long timestamp = this.timerInputPort.receive();
    if (session != null) {
        DummyClassificationStage.LOGGER.debug("session: host={} id={} time=[{}:{}] events={}", session.getHost(), session.getSessionId(), session.getEntryTime(), session.getExitTime(), session.getEvents().size());
    }
    if (timestamp != null) {
        DummyClassificationStage.LOGGER.debug("time {}", timestamp);
    }
}
Also used : UserSession(org.iobserve.analysis.session.data.UserSession)

Example 17 with UserSession

use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.

the class BehaviorModelPreparation method executeEntryCallSequenceModel.

/**
 * Execute case object instanceof EntryCallSequenceModel.
 *
 * @param userSessionCollectionModel
 *            entryCallSequenceModel
 */
private void executeEntryCallSequenceModel(final UserSessionCollectionModel userSessionCollectionModel) {
    if (this.behaviorModelTable == null) {
        this.sequenceModelCache.add(userSessionCollectionModel);
    } else {
        final List<UserSession> userSessions = userSessionCollectionModel.getUserSessions();
        BehaviorModelPreparation.LOGGER.debug("Executing {}", userSessionCollectionModel.getClass());
        BehaviorModelPreparation.LOGGER.debug("userSessions: {}", userSessions.size());
        for (final UserSession userSession : userSessions) {
            final BehaviorModelTable modelTable = this.behaviorModelTable.getClearedCopy(this.keepEmptyTransitions);
            final List<EntryCallEvent> entryCalls = userSession.getEvents();
            EntryCallEvent lastCall = null;
            for (final EntryCallEvent eventCall : entryCalls) {
                final boolean isAllowed = modelTable.isAllowedSignature(eventCall);
                if (lastCall != null && isAllowed) {
                    modelTable.addTransition(lastCall, eventCall);
                    modelTable.addInformation(eventCall);
                } else if (isAllowed) {
                    // only called at first valid event
                    // (condition lastCall == null is not needed
                    modelTable.addInformation(eventCall);
                }
                lastCall = isAllowed ? eventCall : lastCall;
            }
            this.outputPort.send(modelTable);
        }
    }
}
Also used : BehaviorModelTable(org.iobserve.analysis.behavior.models.data.BehaviorModelTable) EntryCallEvent(org.iobserve.stages.general.data.EntryCallEvent) UserSession(org.iobserve.analysis.session.data.UserSession)

Example 18 with UserSession

use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.

the class BehaviorModelTableGenerationStage method execute.

@Override
protected void execute(final UserSessionCollectionModel entryCallSequenceModel) {
    final List<UserSession> userSessions = entryCallSequenceModel.getUserSessions();
    for (final UserSession userSession : userSessions) {
        BehaviorModelTableGenerationStage.LOGGER.debug("entryCalls: {}", userSession.getEvents().size());
        final List<EntryCallEvent> entryCalls = userSession.getEvents();
        EntryCallEvent lastCall = null;
        for (final EntryCallEvent eventCall : entryCalls) {
            if (lastCall != null) {
                this.modelTable.addTransition(lastCall, eventCall);
                this.modelTable.addInformation(eventCall);
            } else {
                /**
                 * only called at first valid event (condition lastCall == null is not needed)
                 */
                this.modelTable.addInformation(eventCall);
            }
            lastCall = eventCall;
        }
    }
}
Also used : EntryCallEvent(org.iobserve.stages.general.data.EntryCallEvent) UserSession(org.iobserve.analysis.session.data.UserSession)

Example 19 with UserSession

use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.

the class UserSessionToModelGeneratorTest method setup.

@Before
public void setup() {
    final String[] parameters1 = { "view A" };
    final String[] values1 = { "" };
    final PayloadAwareEntryCallEvent event1 = TestHelper.createEvent(1, "A", parameters1, values1);
    final String[] parameters2 = { "view B" };
    final String[] values2 = { "" };
    final PayloadAwareEntryCallEvent event2 = TestHelper.createEvent(2, "B", parameters2, values2);
    final String[] parameters3 = { "stay at B" };
    final String[] values3 = { "with value 1" };
    final PayloadAwareEntryCallEvent event3 = TestHelper.createEvent(3, "B", parameters3, values3);
    final String[] parameters4 = { "stay at B" };
    final String[] values4 = { "with value 2" };
    final PayloadAwareEntryCallEvent event4 = TestHelper.createEvent(4, "B", parameters4, values4);
    final String[] parameters5 = { "stay at B with other parameter name" };
    final String[] values5 = { "" };
    final PayloadAwareEntryCallEvent event5 = TestHelper.createEvent(5, "B", parameters5, values5);
    this.session = new UserSession("", "");
    this.session.add(event1);
    this.session.add(event2);
    this.session.add(event3);
    this.session.add(event4);
    this.session.add(event5);
}
Also used : PayloadAwareEntryCallEvent(org.iobserve.stages.general.data.PayloadAwareEntryCallEvent) UserSession(org.iobserve.analysis.session.data.UserSession) Before(org.junit.Before)

Example 20 with UserSession

use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.

the class TEntryCallSequenceFilter method filterSession.

private UserSession filterSession(final UserSession session) {
    final UserSession filteredUserSession = new UserSession(session.getHost(), session.getSessionId());
    session.getEvents().stream().filter(this.filter::isAllowed).forEach(filteredUserSession::add);
    return filteredUserSession;
}
Also used : UserSession(org.iobserve.analysis.session.data.UserSession)

Aggregations

UserSession (org.iobserve.analysis.session.data.UserSession)39 EntryCallEvent (org.iobserve.stages.general.data.EntryCallEvent)16 ArrayList (java.util.ArrayList)14 UserSessionCollectionModel (org.iobserve.analysis.data.UserSessionCollectionModel)8 EntryCallSequenceModel (org.iobserve.analysis.data.EntryCallSequenceModel)5 HashMap (java.util.HashMap)3 List (java.util.List)3 PayloadAwareEntryCallEvent (org.iobserve.stages.general.data.PayloadAwareEntryCallEvent)3 Random (java.util.Random)2 PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)2 AbstractUserAction (org.palladiosimulator.pcm.usagemodel.AbstractUserAction)2 BranchTransition (org.palladiosimulator.pcm.usagemodel.BranchTransition)2 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)2 Loop (org.palladiosimulator.pcm.usagemodel.Loop)2 ScenarioBehaviour (org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour)2 Start (org.palladiosimulator.pcm.usagemodel.Start)2 Stop (org.palladiosimulator.pcm.usagemodel.Stop)2 UsageModel (org.palladiosimulator.pcm.usagemodel.UsageModel)2 UsageScenario (org.palladiosimulator.pcm.usagemodel.UsageScenario)2 HashSet (java.util.HashSet)1