/** * Create the expected model from the input model * * @throws InputModelInvalidException error during expected model initialization * @throws IOException error during expected model serialization */ protected void initializeRemoveExpectedModelForLinkEndCreationDataValue() throws InputModelInvalidException, IOException { // Create the expected model content by applying the attempted command on a copy of the input // model content createExpectedModel(); EObject linkEndCreationData = EEFTestsModelsUtils.getFirstInstanceOf(expectedModel, linkEndCreationDataMetaClass); if (linkEndCreationData == null) throw new InputModelInvalidException(linkEndCreationDataMetaClass.getName()); CompoundCommand cc = new CompoundCommand(); allInstancesOf = EEFTestsModelsUtils.getAllInstancesOf(expectedModel, inputPinMetaClass); cc.append( SetCommand.create( editingDomain, linkEndCreationData, UMLPackage.eINSTANCE.getLinkEndData_Value(), null)); editingDomain.getCommandStack().execute(cc); expectedModel.save(Collections.EMPTY_MAP); }
/** * Test the editor properties : - init the input model - calculate the expected model - initialize * the model editor - change the properties in the editor properties - compare the expected and * the real model : if they are equals the test pass - delete the models */ public void testEditLinkEndCreationDataInsertAt() throws Exception { // Import the input model initializeInputModel(); linkEndCreationData = EEFTestsModelsUtils.getFirstInstanceOf( bot.getActiveResource(), linkEndCreationDataMetaClass); if (linkEndCreationData == null) throw new InputModelInvalidException(linkEndCreationDataMetaClass.getName()); // Create the expected model initializeExpectedModelForLinkEndCreationDataInsertAt(); // Open the input model with the treeview editor SWTBotEditor modelEditor = bot.openActiveModel(); // Open the EEF wizard (by double click) to edit the LinkEndCreationData element EObject firstInstanceOf = EEFTestsModelsUtils.getFirstInstanceOf( bot.getActiveResource(), linkEndCreationDataMetaClass); if (firstInstanceOf == null) throw new InputModelInvalidException(linkEndCreationDataMetaClass.getName()); SWTBotShell wizardShell = bot.prepareBatchEditing(modelEditor, linkEndCreationDataMetaClass, firstInstanceOf, null); // Change value of the insertAt feature of the LinkEndCreationData element bot.editEObjectFlatComboViewerFeature( wizardShell, UmlViewsRepository.LinkEndCreationData.Properties.insertAt, allInstancesOf.indexOf(referenceValueForInsertAt) + 1); // Save the modification bot.finalizeEdition(modelEditor); // Compare real model with expected model assertExpectedModelReached(expectedModel); // Delete the input model deleteModels(); }