Search in sources :

Example 1 with RepositoryLookupModelProvider

use of org.iobserve.model.provider.RepositoryLookupModelProvider in project iobserve-analysis by research-iobserve.

the class UserBehaviorTransformationTest method testBranchWithinLoop.

/**
 * TODO this test is dysfunctional as models are missing Test branch within a loop.
 *
 * @throws IOException
 *             when reading and writing files.
 */
// @Test
public void testBranchWithinLoop() throws IOException {
    // TODO load that model
    final ICorrespondence correspondenceModel = null;
    // TODO fix location
    final GraphLoader graphLoader = new GraphLoader(null);
    final Graph graph = graphLoader.createRepositoryModelGraph();
    final ModelProvider<Repository> repositoryModelProvider = new ModelProvider<>(graph);
    final RepositoryLookupModelProvider repositoryLookupModel = new RepositoryLookupModelProvider(repositoryModelProvider.readRootComponent(Repository.class));
    final int numberOfIterations = 500;
    final int stepSize = 1;
    final List<AccuracyResults> results = new ArrayList<>();
    for (int i = 1; i <= numberOfIterations; i += stepSize) {
        final int numberOfUserGroups = UserBehaviorTransformationTest.NUMBER_OF_USER_GROUPS;
        final int varianceOfUserGroups = 0;
        final int thinkTime = UserBehaviorTransformationTest.THINK_TIME;
        final boolean isClosedWorkload = UserBehaviorTransformationTest.CLOSED_WORKLOAD;
        final ReferenceElements referenceElements = SimpleSequenceReference.getModel(UserBehaviorTransformationTest.REFERENCE_USAGE_MODEL, repositoryLookupModel, correspondenceModel, thinkTime, isClosedWorkload);
        final UserBehaviorTransformation behaviorModeling = new UserBehaviorTransformation(referenceElements.getEntryCallSequenceModel(), numberOfUserGroups, varianceOfUserGroups, isClosedWorkload, thinkTime, repositoryLookupModel, correspondenceModel);
        behaviorModeling.modelUserBehavior();
        final AccuracyResults accuracyResults = UserBehaviorEvaluation.matchUsageModels(behaviorModeling.getPcmUsageModel(), referenceElements.getUsageModel());
        results.add(accuracyResults);
        final double relativeMeasurementError = WorkloadEvaluation.calculateRME(behaviorModeling.getPcmUsageModel(), referenceElements);
        if (UserBehaviorTransformationTest.LOGGER.isDebugEnabled()) {
            UserBehaviorTransformationTest.LOGGER.debug("RME " + relativeMeasurementError);
        }
        TestHelper.saveModel(behaviorModeling.getPcmUsageModel(), UserBehaviorTransformationTest.OUTPUT_USAGE_MODEL);
        if (UserBehaviorTransformationTest.LOGGER.isDebugEnabled()) {
            UserBehaviorTransformationTest.LOGGER.debug("Iteration :" + i + "/" + numberOfIterations);
        }
    }
    TestHelper.writeAccuracyResults(results);
}
Also used : RepositoryLookupModelProvider(org.iobserve.model.provider.RepositoryLookupModelProvider) ModelProvider(org.iobserve.model.provider.neo4j.ModelProvider) ArrayList(java.util.ArrayList) Repository(org.palladiosimulator.pcm.repository.Repository) Graph(org.iobserve.model.provider.neo4j.Graph) GraphLoader(org.iobserve.model.provider.neo4j.GraphLoader) ICorrespondence(org.iobserve.model.correspondence.ICorrespondence) RepositoryLookupModelProvider(org.iobserve.model.provider.RepositoryLookupModelProvider)

Aggregations

ArrayList (java.util.ArrayList)1 ICorrespondence (org.iobserve.model.correspondence.ICorrespondence)1 RepositoryLookupModelProvider (org.iobserve.model.provider.RepositoryLookupModelProvider)1 Graph (org.iobserve.model.provider.neo4j.Graph)1 GraphLoader (org.iobserve.model.provider.neo4j.GraphLoader)1 ModelProvider (org.iobserve.model.provider.neo4j.ModelProvider)1 Repository (org.palladiosimulator.pcm.repository.Repository)1