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);
}
Aggregations