Search in sources :

Example 1 with RepositoryLookupModelProvider

use of org.iobserve.model.provider.deprecated.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.
 * @throws DBException
 */
// @Test
public void testBranchWithinLoop() throws IOException, DBException {
    final Neo4JModelResource<Repository> repositoryModelProvider = new Neo4JModelResource<>(RepositoryPackage.eINSTANCE, new File("x"));
    final RepositoryLookupModelProvider repositoryLookupModel = new RepositoryLookupModelProvider(repositoryModelProvider.getAndLockModelRootNode(Repository.class, RepositoryPackage.Literals.REPOSITORY));
    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 = SimpleSequenceReferenceHelper.getModel(UserBehaviorTransformationTest.REFERENCE_USAGE_MODEL, repositoryLookupModel, null, thinkTime, isClosedWorkload);
        final UserBehaviorTransformation behaviorModeling = new UserBehaviorTransformation(referenceElements.getEntryCallSequenceModel(), numberOfUserGroups, varianceOfUserGroups, isClosedWorkload, thinkTime, repositoryLookupModel, null);
        behaviorModeling.modelUserBehavior();
        final AccuracyResults accuracyResults = UserBehaviorEvaluation.matchUsageModels(behaviorModeling.getPcmUsageModel(), referenceElements.getUsageModel());
        results.add(accuracyResults);
        final double relativeMeasurementError = WorkloadEvaluationHelper.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 : Neo4JModelResource(org.iobserve.model.persistence.neo4j.Neo4JModelResource) ArrayList(java.util.ArrayList) Repository(org.palladiosimulator.pcm.repository.Repository) UserBehaviorTransformation(org.iobserve.analysis.behavior.karlsruhe.UserBehaviorTransformation) File(java.io.File) RepositoryLookupModelProvider(org.iobserve.model.provider.deprecated.RepositoryLookupModelProvider)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 UserBehaviorTransformation (org.iobserve.analysis.behavior.karlsruhe.UserBehaviorTransformation)1 Neo4JModelResource (org.iobserve.model.persistence.neo4j.Neo4JModelResource)1 RepositoryLookupModelProvider (org.iobserve.model.provider.deprecated.RepositoryLookupModelProvider)1 Repository (org.palladiosimulator.pcm.repository.Repository)1